Async patterns: Promises

Given our understanding of what async is, how the callback pattern manages async, and some of the deficiencies of the callback pattern, let’s dive into another, newer pattern — promises.

Promises are clearly exciting the JS community. As someone who never really knew JavaScript before promises, I have only an academic understanding of the magnitude of this shift. In fact, I think I was exposed to management of async first with callbacks to make promises seem just that much more awesome (like building a node server before meeting Express). Understanding both is important to a deeper understanding of each, individually.

As with callbacks, for a new developer, it can be difficult to sift through the massive amount of information available online. For the benefit of anyone else newly exposed to promises, in this post I’ve attempted to cull the resources and posts that I have found most enlightening through my own learning.

Continue reading Async patterns: Promises

Async patterns: Callbacks

So what is a callback function?

A callback function, also known as a higher-order function, is a function that is passed to another function (let’s call this other function “otherFunction”) as a parameter, and the callback function is called (or executed) inside the otherFunction. A callback function is essentially a pattern (an established solution to a common problem), and therefore, the use of a callback function is also known as a callback pattern. (Source)

Continue reading Async patterns: Callbacks