Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Reactive Programming With Java 8

You're reading from   Learning Reactive Programming With Java 8 Learn how to use RxJava and its reactive Observables to build fast, concurrent, and powerful applications through detailed examples

Arrow left icon
Product type Paperback
Published in Jun 2015
Publisher Packt
ISBN-13 9781785288722
Length 182 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Nickolay Tzvetinov Nickolay Tzvetinov
Author Profile Icon Nickolay Tzvetinov
Nickolay Tzvetinov
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Preface 1. An Introduction to Reactive Programming 2. Using the Functional Constructions of Java 8 FREE CHAPTER 3. Creating and Connecting Observables, Observers, and Subjects 4. Transforming, Filtering, and Accumulating Your Data 5. Combinators, Conditionals, and Error Handling 6. Using Concurrency and Parallelism with Schedulers 7. Testing Your RxJava Application 8. Resource Management and Extending RxJava Index

What is reactive programming?

Reactive programming is a paradigm that revolves around the propagation of change. In other words, if a program propagates all the changes that modify its data to all the interested parties (users, other programs, components, and subparts), then this program can be called reactive.

A simple example of this is Microsoft Excel. If you set a number in cell A1 and another number in cell 'B1', and set cell 'C1' to SUM(A1, B1); whenever 'A1' or 'B1' changes, 'C1' will be updated to be their sum.

Let's call this the reactive sum.

What is the difference between assigning a simple variable c to be equal to the sum of the a and b variables and the reactive sum approach?

In a normal Java program, when we change 'a' or 'b', we will have to update 'c' ourselves. In other words, the change in the flow of the data represented by 'a' and 'b', is not propagated to 'c'. Here is this illustrated through source code:

int a = 4;
int b = 5;
int c = a + b;
System.out.println(c); // 9

a = 6;
System.out.println(c);
// 9 again, but if 'c' was tracking the changes of 'a' and 'b',
// it would've been 6 + 5 = 11

Tip

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

This is a very simple explanation of what "being reactive" means. Of course, there are various implementations of this idea and there are various problems that these implementations must solve.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image