← Back to all posts

10 Sentences About Promises

Jacob Elder — 2 minutes to read — March 27, 2017

For someone coming from a strong background in Ruby, transitioning to JavaScript was not without hardship. In particular, the callback-centric, highly asynchronous style had me pining for the ability to block. The new-ish Promise pattern improves the situation, but it still has a learning curve. After working with it, specifically the great Bluebird promise library, I can tell you it’s not as complicated as it sounds.

Most of the functions in the Promise interface fall into little groups, arranged along a few small dimensions. Those dimensions are:

  1. Type of value contained in the promise (scalar, array, or object), or of its properties (function or not).
  2. Side effects like mutation vs. pure functions
  3. Success callback vs. error callback

This would be fun to graph, but in English:

← Back to all posts

10 Sentences About Promises - March 27, 2017 - Jacob Elder