Reactive Programming for newbies :

Kishan Nakum
3 min readNov 22, 2017

--

Developing the great apps nowadays require many things like handle User Interaction , handle network related stuff , manage data as well as present them. For that Developer has to write lots of concurrent as well as asynchronous code.

Nowadays if you take a look on the internet as a developer than somewhere you have read the term “Reactive programming“. You might wonder what’s this term actually means and why it takes storm between the developers. Many developers says it is the “Next big thing” in programming world.May be as a developer you are still unaware what the world is talking about so you are curious to know on this and make yourself to be the part of this incredible world of programming.

So if you are bibelot about this topic and search on the internet than here is what type of definition you will find:

“reactive programming is an asynchronous programming paradigm concerned with data streams and the propagation of change.”
-wikipedia

At the initial stage it is very hard to understand what it really meant . This is the reason why I am writing this blog. So that everyone can able to know how reactive programming will help you in coding with easy and understandable way.

I will try to explain you in a very easy and fun manner that how it will attract you to use in your real world apps and projects. I am sure you will definitely understand this by the fun conversation between me and my friend Taral :)

As an application developer we always need to make our app smooth as butter . For that we have to handle many things like below :
- Handle multiple URL responses at the same time
- Multiple UI changes
- Manage Database
- Handling all the other frameworks we are using
- Many more things

To tackle all these we often use many frameworks also use some logic by putting UI related changes to Main thread and other time consuming stuff in background thread. We’ll try to keep our main thread free.Writing code that truly runs in parallel, however, is rather complex, especially when different bits of code need to work with the same pieces of data. It’s hard to argue about which piece of code updates the data first, or which code read the latest value.

So for alternative of all these ,Here comes the Reactive Programming to give you power and fight for your code.

Reactive Programming ~= Asynchronous programming

Basically , Rx is an asynchronous programming that handles your code to react the data in observable sequences . It defines the structural programming in which one component emits the data and other components which are registered to receive will propagate those changes.

There are three building blocks of Rx
1. Observables — Component that Emits the Data
2. Observers — Components that subscribes to observable to get changes
3. Schedulers — schedule the different pieces of data coming from observable

For example :
X = Y + Z
X is observer here because it subscribes to the result of y+z
Y & Z are observables here because it omits the changes .

--

--