Combining asynchronous programming patterns

Promises allow us to address some of the shortcomings of the callback pattern and write more readable code. Now we have a new problem, though. One of the merits of Node.js is the consistent approach to asynchronous programming. We seem to have negated this by introducing promises as well as the conventional callback pattern.

Furthermore, although native promises are new to ECMAScript 2015, the concept is not new. There are many pre-existing libraries that provide their own implementation of promises.

Fortunately, these competing approaches to asynchronous programming are actually very consistent. The biggest value of the consistency in the Node.js-style callback pattern comes from the following:

  • All library ...

Get Learning Node.js for .NET Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.