DEV Community

Discussion on: Best Practices for ES2017 Asynchronous Functions (`async`/`await`)

Collapse
 
remshams profile image
Mathias Remshardt

First of all, thank you very much for the article and the details provided in there, especially the last two section gave me a new point of view on promises and async/await.

I like to use then chaining (not nesting) for Promises a lot (same as for Observables and map) and have so far not considered the memory and performance impacts while doing so.

I like the chaining approach as, with the functions named appropriately, it reads like text. It is certainly possible to achieve something similar in a single then block calling properly named functions but, at least to me, it does not read as "fluently" as chaining (this is of course opinionated).

I also do not want to fall in the "premature optimization" trap so one/I may need to find (as always) a balance between readability, writability and performance...