DEV Community

Discussion on: Learn callbacks, promises, Async/Await by Making Ice Cream 🍧🍨🍦

Collapse
 
codewaseem profile image
codewaseem • Edited

I highly appreciate the effort you have put to write this article.

But it looks like you have totally misunderstood the concept of synchronous vs asynchronous code.

The analogy you used here doesn't fit and I would say it is exact opposite to describe asynchronous code, which explains why you misunderstood the concept yourself in the first place.

Asynchronous code has nothing to do with dividing the task in smaller pieces.

In very basic terms, synchronous code will say "Please WAIT and be on the line while I finish processing your request.
And asynchronous code will say "Thank for calling, I will process your request soon, you DON'T HAVE TO WAIT HERE. You can continue with other tasks and I will call you back once I finish.

You can use callbacks, promises, or async/await and still be synchronous, like in your ice-cream example. You are waiting at every step to finish before continuing on to the other. This is what synchronous is.

Synchronous code is blocking, makes you wait.
Asynchronous code is non-blocking, allows you to move forward with other things.

Asynchronous code doesn't mean that it runs on multiple threads. JavaScript is single-threaded, no matter if you write synchronous or asynchronous code.

Please correct your understanding and update the article at its earliest. Otherwise you will end up misleading other developers.

Thanks. Again, I highly appreciate your work.