Apr 17, 2012 · 7:00 PM
This location is shown only to members
Node developers are well acquainted with callback hell, the tendency of any node program to become a rat's nest of callbacks calling callbacks, tedious error checks, and exceptions spinning off into the void. There are several popular ways to tame the mess, and one of the most elegant is the promise pattern (aka deferreds). I'll give a brief introduction to promises with a special focus on the Q API and jQuery flavors, and show how the pattern can help you keep your asynchronous code understandable, modular, maintainable, and testable. I will also discuss the lurking pitfalls (there are a few), and try to help people decide whether or not to make the leap.