Chapter 1. Introduction to reactive programming

 

In this chapter

  • What to expect from this book
  • How to use this book
  • Why RxJava 2 for Android?
  • Deep dive in to RxJava 2 on Android

Perhaps you picked up this book because...

1 Everyone’s using RxJava and you have no idea why.

It’s hard to name a large company that would do native Android and not use a reactive programming library such as RxJava 2. In this book you’lll focus on why it’s hot and what you can do with it.

You may also have heard of functional reactive programming (FRP), which is indeed related to Rx. You’ll learn about both concepts in this book.

2 You’ve used RxJava on Android and want to learn more.

It’s common these days to see snippets of RxJava code that solve a particular asynchronous problem. But a whole world lies behind what sometimes looks like a simple utility.

The programming syntax used in Rx can seem like the entire point, but it’s just a nice add-on. This book will teach you how to think in Rx.

3 You’ve used RxJava and hate it with a passion.

In the wrong hands, RxJava can make traditional spaghetti code even worse. With any power comes responsibility. You’ll learn where to use RxJava and where not.

You’ll learn to design applications in a sensible and extensible way. You can be reassured there’s a way to maintain your Rx code.

Whatever your reason, I want you to...

Don’t read this book if...

OOP, Rx, FP, and FRP

Benefits of Rx

What you code is what you get

The reactive landscape

What do you need to know before you start?

About this book

RxJava 2 and Android

Setting up the Android environment

Java 8 lambdas

Deep dive into Rx: Live search

Conditions for triggering search

Project setup

Text input as an emitter of data

The publish-subscribe pattern

Text input as an observable

Filtering observables

Bending time

Bending time to your benefit

Debounce: The bus stop operator

Putting your code into Android