The Holy Java

Building the right thing, building it right, fast

NDC: Async and Streaming JavaScript, We’re All Doing it Wrong! (Promises, Streams, Rx)

Posted by Jakub Holý on June 17, 2015

By Matthew Podwysocki


Lot of work (setup, remove listeners …), not composable.


No way to abort promise in progress. (Me: has to remember to check for errors: then(onOk, onError).)

No try-catch-finally; only try-catch.


Node: Stream 1 were terrible (pause/resume unusable, data sent before ready, …).

Streams 2: A lot to trip over. Streams 3: Similar.

WHATWG Streams:

  • focused on low-level I/I, not on object mode
  • Think Node Streams + Promises

Reactive Programming

Behavior: values over time
Event: discrete phenomena with a value and a time

“The majority of your asynchronous code is written with just a few flexible functions.”

The general theory of reactivity

multiple values |   iterable        observable
single value    |   value           promise
                    sync            async

Observables: No need for low-level programming, combine existing powerful primitives (debounce, flatMapLatest, …).

JS Future

Async/Await a la C#?

  • for promises

Dart: Async progr. with futures and streams

Futures = promises, streams unify IO and events, mirrors Rx by adding map/… .

Observables coming to ES2016



Sorry, the comment form is closed at this time.

%d bloggers like this: