Web Unleashed 2014
Web Dev
  • 2014-09-17 00:00:00 2014-09-18 00:00:00 America/Toronto Web Unleashed 2014 Toronto FITC
  • Toronto

Presentation

SlideShare

Overview

I bet you think “callback hell” is about function nesting and levels of indentation. Not so much. I bet you’ve heard that Promises replace callbacks. Nope.

We need some clarity on what async flow control is all about in JavaScript. We’ll explore the perils of “Inversion of Control”, and see just what hell that leads us to. Then we’ll talk about promises as “continuation events” for function calls, and abstractions on top of promises that clean up our code. Finally, we’ll see how generators give us synchronous-looking async, and even how we can create cooperative concurrency with coroutines.

Yield those confused async notions and control your flow. I promise we’ll get your thoughts in order.

Objective

Learn why async flow control patterns are necessary for JS, why callbacks aren’t sufficient and how promises and generators are the solution.

Target Audience

JS developers

Assumed Audience Knowledge

Intermediate to advanced JS (3+ years experience).

Five things audience members will learn

  1. Why our brains reason about code differently than the JS engine does
  2. Why callback hell has much less to do with nesting/indentation than you thought
  3. What inversion of control is all about, and what trust issues it creates for our code
  4. What promises are and why they not only make code easier to reason about, but also solve inversion of control issues
  5. Why generators are even better, and how generators+promises are potentially the best pattern we can achieve thus far