DEV Community

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

Collapse
 
rolfst profile image
Rolf Strijdhorst

Why is everyone confusing asynchronisity with parallelism?
What you describe is parallelism. Async means: the call doesn't complete right away. This can be handled using the eventloop (v8 or something simular) or threads (Java et. al). the loading of images is asynchronous because of latency not because of the runtime.
And following one after another is sequentality.
Often these things can be used interchangeably but not in your examples.
You describe parallelism mostly. One of the key enablers is promise.all() which executes in parallel. An ajax (xhr) request is async and the runtime itself waits on the eventloop to finish this is what promise.all does it waits till all calls are resolved and then continues.

This also makes the async/await confusing since you're making the execution look like a synchronous/sequentual execution while it actually is not.
(I know that was the purpose of the developers though, to make it look synchronous)

Collapse
 
slikts profile image
Reinis Ivanovs

As unkind as that may sound, since a lot of work has obviously gone into the article, it should be unpublished or a significant correction added, because it's actively misleading about what an "evented", non-blocking or async i/o concurrency model is.