Whoa! such a well written article. I actually hate this new syntax. I blame all the java developers who are coming to node and not being able to understand promises
I was reading the comments, and your definition of "imperative" vs functional is correct.
# IMPERATIVE
let x = someFunc();
let y = anotherFunc(x);
return y;
looks exactly like
# LOOKS IMPERATIVE
let x = await someFunc();
let y = await anotherFunc(x);
return y;
with promises you are EXPLICITLYcommunicating to other devs that the value of x will be passed to another function y and that someFunc returns
# ER MUH GRR! mah value iz being pazzed to a funk-shun!
someFunc()
.then(x => anotherFunc(x))
.then(y => {'ok': true, err: null, result: y})
.catch(err => {'ok': false, err, result: null})
However, I feel like you missed the most important thing when using promises vs await...DEBUGGING!!! As of a few months ago, it wasn't possible to add breakpoints to await statements using chrome, but with promises, it was easy by literally
now, this brings me to another problem, devs printing stuff out instead of using breakpoints :SMH but, that's another rant. I wanted to say you're not in the minority of not liking async and await and it's imperative looking code
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Whoa! such a well written article. I actually hate this new syntax. I blame all the java developers who are coming to node and not being able to understand promises
I was reading the comments, and your definition of "imperative" vs functional is correct.
looks exactly like
with promises you are EXPLICITLY communicating to other devs that the value of x will be passed to another function y and that someFunc returns
However, I feel like you missed the most important thing when using promises vs await...DEBUGGING!!! As of a few months ago, it wasn't possible to add breakpoints to await statements using chrome, but with promises, it was easy by literally
now, this brings me to another problem, devs printing stuff out instead of using breakpoints :SMH but, that's another rant. I wanted to say you're not in the minority of not liking
async
andawait
and it's imperative looking code