Introduction to Reactive Programming
Introduction:
Reactive programming is an asynchronous programming paradigm concerned with data streams and the propagation of change.
Reactive Programming means you're not blocking your current thread and doing all your IO bound tasks such as network calls asynchronously. If you are do so you can serve lots of requests by merely.
Advantages:
- It makes a lot easier to do complex threading, synchronizes work in parallel and running some code when everything is done.
- Doing things in a more functional way leads to readable, clean, concise and declarative code that is easier to understand.
- Has a standard mechanism for error recovery.
- Straight forward and obvious way to compose asynchronous operations.
- Easier events handling of UI interactions.
- It helps make things more maintainable as you can add and remove blocks of code to a stream as needed.
Similarities with observer pattern:
Reactive programming has principal similarities with the observer software design pattern, commonly used in object-oriented programming. The observer pattern commonly describes data-flows between whole objects/classes, whereas object-oriented reactive programming could target the members of objects/classes.
Disadvantages:
- Steeper learning curve, because you're changing the paradigm of programming.
- More memory intensive to store streams of data most of the times.
- Unconventional for new programmers or conventional procedural style of programming.
- Lack of good and simple resources to learn.
Conclusion: As soon as you understand the basics you can learn other operators as you need them, you don't have to understand everything to start using it.