BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News JavaScript Streams Introduced at Strange Loop

JavaScript Streams Introduced at Strange Loop

This item in japanese

At the Strange Loop conference this year, Pam Selle introduced JavaScript streams, calling them "the data structure we need".

Streams are unlike typical sequential data manipulation. Selle says that streams "let us do list operations without the expense and annoyance of having to have them in a list structure."

While some may be familiar with streams in Node, Selle took the crowd on a journey from piping together UNIX commands to state of the art JavaScript with its ES6 generators. The latter are a part of the ES6 spec and Selle says the important thing to know is that they are "reusable and pausable functions" and that you'll know you're working with a generator when you see function* and yield. Here's what one looks like:

function* sayHello() {
    yield "hello";
}

Selle highlighted three libraries she like to work with: BaconJS, HighlandJS, and RxJS. RxJS in particular is poised to break out in 2016 due to promotion by a popular JavaScript framework. In Angular 2, observables are first-class entities and the new Angular 2 Http module uses RxJS observables. In the recent Angular 2 Survey Results, 38.7% of respondants indicated they plan to use RxJS while only 6.6% chose BaconJS. Additionally, ES7 includes a proposed observable type based on RxJS-style observables.

What excites Selle the most about streams is what uses people will come up with for them:

My dream is that you'll be able to do things like massive data visualizations. And that's the beginning. That's just the most obvious thing to me which means that people are going to do really cool things with it.

Front-end developers using the gulp build system are already familiar with streams. In gulp, commands are combined to perform build steps using the pipe() function.

The video of Selle's talk is available on YouTube and the slides are at http://pselle.github.io/omgstreams/. Next year's Strange Loop conference is September 15-17, 2016 in St. Louis.

Rate this Article

Adoption
Style

BT