Introduction to Reactiveness
Explore the fundamentals of reactive programming and understand how RxJS observables provide a natural way to handle asynchronous events. Learn to build responsive applications with improved concurrency and reduced complexity by adopting reactive thinking.
We'll cover the following...
The real world is pretty messy: Events happen in a random order, applications crash, and networks fail. Only a few applications are completely synchronous, and writing asynchronous code is necessary to keep applications responsive. Most of the time it’s downright painful, but it really doesn’t have to be.
Modern applications need super-fast responses and the ability to process data from different sources at the same time without missing a beat. Current techniques won’t get us there because they don’t scale—code becomes exponentially more complex as we add concurrency and application state.
They get the job done, but at the expense of a considerable mental load on the developer, and that leads to bugs and complexity in our code.
This chapter introduces us to Reactive programming, a natural and easier way to think about asynchronous code. We’ll see how streams of events—which we call Observables—are a beautiful way to handle asynchronous code. Then, we’ll create an Observable and see how reactive thinking and RxJS help to dramatically improve existing techniques and make us happier and more productive programmers.