Functional reactive programming combines functional programming and reactive programming. Functional programming avoids mutable state and side effects through referential transparency and reusable functions. Reactive programming builds reactive systems through asynchronous data streams and treating everything as a stream. Observables are the core component, representing a stream of data over time, and operators allow querying, transforming, and combining observables. RxJS is a popular library for implementing functional reactive programming.
2. Functional Programming
Evaluation of mathematical functions
■ Avoid mutable state
■ Referential transparency
■ Avoid side-effects
■ Reusable functions over reusable object
■ Function composition over object composition
3. Reactive Programming
A programming paradigm that helps you to build ‘Reactive Systems’. E.g.: Google Spreadsheet
• In a reactive world, we can't just wait for a function result, a network call, or a database query
to return.
• Every moment we wait for something, we lose the opportunity to do other things in parallel.
• Reactive programming can be done in several ways
◦ • Akka Actors
◦ • Reactive Extensions (Rx) – reactive + functional
4. Why Reactive Programming?
Why another programming paradigm?
• Things are different now!
• Conventional software applications won’t be able to fulfill the modern enterprise needs.
• Its time to rethink about our software architecture patterns and programming techniques.
5. What it actually means to be Reactive?
“Readily responsive to a stimulus” - merriam-webster
Reactive Systems :
•responds in a timely manner
•stays responsive in the face of failure
•stays responsive under varying workload
•rely on asynchronous message-passing
15. Observables
o Stream of data over time
o Hot vs Cold Observables
o Asynchronous
o Lazy
o queryable, bufferable, pausable…
o more than 120 operations
27. Conclusion
There is a learning curve
Great abstraction for async & events
Improves
Readability
Reusability
Scalability
Both on the front- and backend