News for hackers. Stuff that matters.
Re:Async/await: It’s Good and Bad by acjohnson55 on Saturday February 27, 2016 @09:29AM (#11187153)
I don't really buy the con of async/await allowing you to write really long functions. You can do the same thing in completely synchronous logic. Additionally, I don't really buy the chopping up of a cohesive process into itty bitty functions. Certainly small, simple function are nice, but when small for smallness sake, you basically end up with unreadable spaghetti code.

A benefit the author didn't quite touch on is what a boon async/await is for branching processes. I've got a block of logic that takes credit card info for Stripe, and it needs to validate user info, tokenize payment info, add it to the user model, and then add the tokenized card to the Stripe customer associated with the card. There are a lot of places this can go wrong or data can fail a validation. In promises, branching mid-flow is a huge pain.

The much more interesting issue with callback-driven approach to async, no matter what the sugar, was raised by http://journal.stuffwithstuff.com/2015/02/01/what-color-is-y....

There are no comments on this comment yet.