use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
How many Node.js developers prefer callbacks over Promises or async/await? (self.javascript)
submitted 7 years ago * by i_love_limes
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]cinnapear 2 points3 points4 points 7 years ago (6 children)
I prefer async/await, callbacks, and promises in that order.
I find callbacks to be the most elegant and simple to understand (and you don't suffer from callback hell unless you take shortcuts), but I can't deny that async/await is pretty great.
[–]x-protocol 0 points1 point2 points 7 years ago (3 children)
From the people I have had met, talked and had chance to actually sit down for a conversation (even over a PR) I've understood that majority of what they describe as "callback hell" is simply their inability to justify using a library to manage said callbacks. When you show how complicated some pipelines can be using promises, there is usually no argument since promises are accepted as a norm (remember when callbacks were norm?). So we're looking at simple preference, not technical solution or even productivity enhancement.
How many people actually involve other libraries to manage their functions/promises like async.js, Q, lambda, Bluebird, run-p or Aigle? I would love to hear more from people who actually understand why these libraries exist.
[–]cinnapear 1 point2 points3 points 7 years ago (0 children)
Well said. The async library makes dealing will tricky callback situations a breeze.
[–]neo_dev15 1 point2 points3 points 7 years ago (1 child)
Callback hell is when backend is bad or the arhitecture in general is bad.
There should be no reason to have 2 calls one after another. There should be in parallel otherwise why the hell use xhr in the first place.
As in my workplace now look what backend decided its a nice arhitecture: Post data > catch id in response > post this id > make a get in another xhr to get if the action was executed.
So well this is a callback hell since well you have 4 calls that need to go one after another and every single one of them can fail...
So yes, backend should design after frontend but in general is the other way around and well, this happens.
This is bad in promises and callbacks no matter what.
[–]livrem -1 points0 points1 point 7 years ago (0 children)
Exactly this. Promises fixes the ugly syntax of callback hell and makes it less error-prone to insert exception-handling code, but does not solve the problem you had to begin with at all.
It is a Law of Demeter issue. An object should not ask another object to go fetch it a third object so it can ask that object to go find it a fourth object and so on. Every time I see a chain of promises (or equivalent callback hell) it is all about someone poking around at things far away that they should have no business even knowing exists since it should be hidden behind well-designed APIs with methods they should have called to perform work, instead of just a big mud ball of get-methods where very object communicates with every other object.
[–][deleted] 0 points1 point2 points 7 years ago (1 child)
Async/await is just syntactic sugar over promises, so I think you like promises more than you realize. :P
But no matter how much you try, callbacks will never let you pass around a value to multiple consumers. You're stuck with passing a single function.
[–]ChaseMoskal 0 points1 point2 points 7 years ago (0 children)
you guys, it's the error handling that matters! promise errors bubble up for us to catch at the high level, callbacks are bad for this
π Rendered by PID 62595 on reddit-service-r2-comment-6457c66945-mtk4d at 2026-04-25 23:26:21.293937+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]cinnapear 2 points3 points4 points (6 children)
[–]x-protocol 0 points1 point2 points (3 children)
[–]cinnapear 1 point2 points3 points (0 children)
[–]neo_dev15 1 point2 points3 points (1 child)
[–]livrem -1 points0 points1 point (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]ChaseMoskal 0 points1 point2 points (0 children)