3 ms·
The reason these types of arguments are generally perceived as being ignored is because they generally argue a point that everyone who has experience with async
by viscanti 14y ago
The reason these types of arguments are generally perceived as being ignored is because they generally argue a point that everyone who has experience with asynchronous programming already realizes. You need to change your level of abstraction. That can be through language choice, or through flow control programs, or streams, or switching to a monadic coding style or replacing nesting with a more functional approach.
If you prefer that the language does that for you, then that's great. There's enough viable options out there to fit anyone's preferred asynchronous style. Node exposes a lot of the low level elements of asynchronous programming (much like the low level programming you could do in C). You can stick with that, or use a flow control library, or employ any other number of viable strategies to avoid deeply nested callback soup. You get to pick the level of abstraction you work on, and not everyone wants to work on the highest levels of abstraction (where the language or framework handles everything and you just write synchronous style code).
The node community could probably do a better job of directing people to good documentation on those different levels of abstraction (it's a bit silly to assume someone will know to use streams, or monads to clean up the style of their code). When node first started to gain traction, it felt like almost everyone wrote a flow control library. Now the problem is solved in almost every way imaginable. The problem is that new users don't know where to look to find those 3rd party solutions, or how to evaluate the tradeoffs.
You're right to find it maddening. A lot of other people did as well. It doesn't need to be maddening though, and while you have a valid point, it's not especially relevant given the number of possible solutions (you just have to know how to find the style you're after).
- ef4 14y agoThe problem with the "solve it with a library" answer is interoperability. You and your dependencies usually need to agree on which paradigm you're going to use. The Node ecosystem clearly has no consensus on this point. So you spend a lot of time gluing pieces together. And I do know how to find the style I'm after. At the moment I'm doing a lot with Q, and I have also used node-fibers. But in either case, you end up doing a lot of plumbing, because you end up depending on other people who chose different (or non-existent) high-level flow control abstractions.
- pooriaazimi 14y agoCare to share a link to Q? I haven't heard of it before, and as you might guess, it's almost impossible to find it through search :) Edit: forget it. Someone else mentioned it in another comment: https://github.com/kriskowal/q/ https://github.com/kriskowal/q/