Chapter 1. Thinking reactively

 

Chapter 2 from RxJS in Action by Paul Pl Daniels and Luis Atencio

This chapter covers

  • Comparing asynchronous JavaScript with callback - and Promise - based solutions
  • sing streams to model static, dynamic, and time-bound data
  • Using observable streams to handle unbounded data in a functional manner
  • Thinking reactively to deal with the composition of asynchronous data flows

Right now, somewhere in the world, someone just created a tweet, a stock price just dropped, and, most certainly, a mouse just moved. These tiny pinpricks of data light up the internet and pass ubiquitously through semiconductors scattered across the planet. A deluge of data propagates from any connected device. What does this have to do with you? As you push your code to production, this fire hose of events is pointed squarely at your JavaScript application, which needs to be prepared to handle it effectively. This creates two important challenges: scalability and latency.

As more and more data is received, the amount of memory that your application consumes or requires will grow linearly or, in worst cases, exponentially; this is the classic problem of scalability, and trying to process it all at once will certainly cause the user interface (UI) to become unresponsive. Buttons may no longer appear to work, fancy animations will lag, and the browser may even flag the page to terminate, which is an unacceptable notion for modern web users.

1.1. Synchronous vs. asynchronous computing

1.2. Better callbacks with Promises

1.3. The need for a different paradigm

1.4. The Reactive Extensions for JavaScript

1.5. Reactive and other programming paradigms

1.6. Summary

sitemap