2 ms·
What's the bane of JS? Callbacks? That's probably because you were trained on languages without heavy use of asynchronous concepts. JS is my first language, and
by woah 12y ago
What's the bane of JS? Callbacks? That's probably because you were trained on languages without heavy use of asynchronous concepts. JS is my first language, and I have never had any sort of issue with callbacks.
Most good JS coders never even have 'callback pyramids'. The pyramid is a symptom of
A) bad modularity and encapsulation in your code and
B) lack of clarity on which tasks depend on one another.
The author ends up with a long 'laundry list' of things that happen to work in a certain order, and needs to ensure they happen in that exact order, using a pyramid.
- general_failure 12y agoI agree with your points but I was talking in the context of node.js. Having await/async will make node.js programming infinitely better. Lots of programming tasks in server side are really 'step' driven i.e doing a lot of things one by one. Of course, at this point someone will point me to 'async' and 'step' and 'q' modules but that's not the point.
- woah 12y agoGood point. No reason not to have tools in the toolbox for when you need them. You might be interested in https://github.com/Raynos/continuable https://github.com/Raynos/continuable for dealing with async, it is an extremely simple library that allows you to build up async ops step by step. When you call the resulting function, it runs all the steps in the order you defined them.