11 ms·
>Automating restarts / Automatic browser refresh I don't think this is very beneficial when your project's complexity grows enough to require a non-trivial bui
by nawitus 12y ago
>Automating restarts / Automatic browser refresh
I don't think this is very beneficial when your project's complexity grows enough to require a non-trivial build. It's nice to have for simple projects, of course.
> Using control flow modules (such as async)
In my experience the async module creates verbose and ugly looking code. In almost all cases promises are a better solution. Of course, even promises are pretty ugly as it's a "hack" to solve a problem at the language level. ES7 proposal includes async/await, maybe that'll finally solve this problem.
>Not using static analysis tools
I'd also recommend checking out TypeScript and tslint for complex Node.js applications.
- esailija 12y ago`async/await` is only for sequencing, it's not gonna replace anything other than `.then` chains. If you have such chains to the extent that you think `async/await` will solve your problems, you should think very hard if every item in the chain is truly depending on the previous item in the chain because you are currently losing a lot of performance to that otherwise. I have often seen examples using generators and `async await` that needlessly turn fast concurrent promise code into slower sequential code.
- nawitus 12y agoYou can sequence multiple async operations with promises quite easily by using Q.all (of course this depends on the promise library you're using). Even if async/await will only replace .then chains, that already fixes most of the issues. Most async code actually consists of .then chains (or just a single async function call). Anyway, I agree with your point. Developers need to understand how to use async/await correctly. I wonder if async/await could be implemented for grouping multiple async operations together..