Programming Paradigm
- Procedural
- Object oriented
- Functional
- Reactive
Reactive Manifesto
- Responsive- reply within a time limit. If you need to send a report, go async and say we will reply in email.
- Resilient- errors are first class system. Better handle them.
- Message driven. whatsapp vs phone call.
Async vs Sync
- Main program loop not blocked.
- Without RxJava, you need a callback. Callback hell!
Push vs Pull
- Most programming model is Request — Response model which is pull.
- RxJava is push based. We can use callbacks for push too.
Observer design pattern
- when an something changes subject updates all other observers
- Subject is an Observable and observer is an observer in Rxjava
- Observable emits data when it gets the data.
RxJava
- Push based
- Different channels for different signals as data, completion and error
- RxJava uses schedulers for concurrency and parallel programming
- Handles back-pressure using flowable.
- Java 9 flowable works with RxJava flowable
- Flowable is backpressure ready and observable is not.