REACTIVE programming FRAMEWORK
Who uses RX
Problem
How difficult is to manage asynchronous data?
Solution?
I don't mind whether you have the data or not, just keep going
Don't wait the data and continue working
Solution?
I hope the data is coming soon, I was expecting it to come a long time ago
Function callback
Solution
You take my word I will give you a result, or at least tell you I failed at it
Promises
Solution
Promises
Multiple times
Observable
How it Works
GENERATOR
OBSERVABLE
PROMISE
FUNCTION
Synchonous
Asynchonous
Multiple
Single
Reactive Programming
What is Reactive Programming?
Microsoft's Rx terminology
KISS
Reactive programming is programming with asynchronous data streams
Reactive in Action
Event buses are really asynchronous event streams, on which you can observe and do some side effects.
Reactive is that idea on steroids
DAta streams
You are able to create data streams of anything
variables, user inputs, properties, caches, data structures, etc.
Functions and more
you are given an amazing toolbox of functions to combine, create and filter any of those streams
Importat Concepts
-
Pure functions:
- Same result with same given parameters
-
High order functions:
- Receives Functions => Returns Functions
-
Iterator:
- Sequential access to data
-
Observer:
- Notify changes, one to many relationship
Advantages
Reactive Systems are:
- flexible y scalable
- highly responsive
- failure tolerant
- evolutive
Flexible
When a change is required the response is managed by our set of tools
Changes in data streams are easy to make
RESPONSIVE
The user will get an immediate response
No delay between an action and its result
Evolutive
The application can grow and expand new features with no time
Making the code easier to maintain and evolve
Overview
Overview
Overview
Overview
Overview
Overview
http://reactivex.io/documentation/operators/combinelatest.html
Rxjs marbles
http://rxmarbles.com/
REAL POWER
https://github.com/Reactive-Extensions/RxJS
RX MORE than JS
http://reactivex.io/
RX MORE than JS
Disadvantages
Learning it is hard, even harder by the lack of good material
Disadvantages
the master sword - starts with low power
Disadvantages
Don't know how to use the master sword you just swing it
you go through trials to increase the master sword power
Disadvantages
you go through trials to increase the master sword power
Disadvantages
the master sword becomes the most powerful weapon you can use
Disadvantages
-
Just a tool you don't know how to use it
-
Hard to debug
-
Learning it requires patience and experimentation
-
Difficult to drop observables/reactive programming into existing complex apps
What´s New
Goals
- Smaller overall bundles sizes
- Provide better performance than preceding versions of RxJS
- To model/follow the Observable Spec Proposal to the observable.
- Provide more modular file structure in a variety of formats
- Provide more debuggable call stacks than preceding versions of RxJS
OBSERVABLE AS STANDARD
- https://github.com/tc39/proposal-observable
SugGestions
- Keep observables as simple as possible
- Keep consistent data sources
- Models representing data are required
- Do not to overload an observer with too many functions
Thank You!
References
- http://slides.com/santiagorodriguezsordo/functional-reactive-programming-spanish
- https://michalzalecki.com/use-rxjs-with-react/
- https://medium.com/frintjs/deep-dive-into-observed-components-with-react-js-and-frintjs-e2726eaeff2b
- https://x-team.com/blog/rxjs-observables/
- https://xgrommx.github.io/rx-book/index.html
- https://gist.github.com/staltz/868e7e9bc2a7b8c1f754
Rxjs
By Mateo Restrepo Restrepo
Rxjs
Presentation about rxjs framework
- 455