
Demystifying Async Programming in JavaScript - jasonmoo
https://blog.usebutton.com/demystifying-async-programming-in-javascript-47e417566f61#.qeim9n8wx
======
ng12
Am I wrong in feeling that callback hell is a symptom of bad design? In what
scenario are you making four server requests before you can do something on a
webpage?

I like async/await more for it's brevity than utility.

~~~
dcwca
"Callback hell" as it is described in this article is a symptom of not
understanding how to flatten your code for readability. Deep nesting is a trap
in every language, it's the programmers job to know how to write readable
code.

[http://callbackhell.com/](http://callbackhell.com/)

~~~
always_good
The problem with callbacks isn't the indentation. It's that downstream
dependent logic has to take place in the callback.

If you have two logical branches that share a downstream, now you have a fork
with identical callbacks.

So reducing callback indentation comes at the expense of indirection. You're
not changing the nesting at all. Usually just brooming stuff under the rug.

------
jasonmoo
It's interesting I think having an understanding of the history of javascript
concurrency is almost a prerequisite to using it correctly. I wonder how new
people approaching the language for the first time find it.

~~~
brito
I find two camps: 1\. those who need to produce backwards-compatible code,
avoiding or not thinking about new features 2\. those who can/want to use new
features

Camp 1 has the problem of continuously importing kitchen sinks instead of
polyfills, which would allow getting into camp 2.

Camp 2 is essentially a luxury of time, thus rare. It already requires mental
commitment, which may be scarce after a day of battling bugs for IE.

