New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Favor promises over async #4493
Comments
I think so, but how much refactoring will it take? Tons |
Never let developer convenience decide over product quality was one of the first things i was taught 😋 |
I've attended a couple of presentations about promises, and I have not heard a sufficient argument to switching from our use of async. Don't take this sentence to mean that I am against it, I am simply attempting to view the situation objectively. Every discussion or presentation I attend focuses on how promises are a cure for the callback pyramid, and are faster/easier to read compared to using callbacks, but I have not seen concrete evidence that promises are better than async. If anything, they're equivalent ways of doing the same thing. Keep in mind I have very limited knowledge of what promises (either via Q or bluebird or what-have-you) can do:
More importantly, is there something significantly broken with async that would force us off of it? I understand that promises are built into ES6, and I have no problem transitioning in time, but at current, as with when we started, I do not see a compelling enough reason to switch. (That, and a ton of plugins |
I specifically did not comment on "developer friendliness" because after nearly three years of using async, I am very accustomed to it and find writing async to be very natural. However I do realise this is not the case for all developers (esp. new developers/contributors), and if the prevailing winds suggest a shift to promises, then that's the way we will sway. Again, it's a matter of when, not if. |
@julianlam I found this to be an interesting read which covers most of these points. What I think is a great argument for using promises is that the probability of them throwing uncaught exceptions is way lower. |
Thank you for sharing, good bedtime reading 😄 |
In addition to the article:
(untested) All in all my current setup is |
Don't have a big opinion about async vs promises, but both can be messy if you don't do it right. We have had some ridiculously messy async control code in the past. Leave this to our community forum for discussion please. I'm closing because it's a) not an issue per se b) who can fix this in one commit? |
I would like to suggest to re-consider switching to promises. if (err) {
return callback(err);
} all the time. Apart from that |
I think it would be great to get rid of the async module and replace these calls with promises. It's faster, cleaner, easier to wrap your head around and will becoming more and more important in the next years. What do you think?
The text was updated successfully, but these errors were encountered: