A library to streamline (no pun intented) our code through an Unidirectional Data Flow based on Functional Reactive Programming
(aka FRP) & OOP Observer and Iterator Design Pattern.
Introduce a new Asynchronous Structure concerning the code, but also the Error-Handling
=> The chief goal consist to make it easier the composition of asynchronous code
Paradigm Tree!
JavaScript Multi-Paradigm or Zero-Paradigm?
Natural language has no dominant paradigm, and neither does JavaScript. Developers can select from a grab bag of approaches procedural, functional, and object-oriented and blend them as appropriate
Angus Croll, If Hemingway Wrote JavaScript
Appendix side-effect
Side-effects concern function which update/use:
Global or Static variable
Update argument
Write/Read data from/to file, database, call API
Declarative vs Imperative
Applying these functions declaratively meaning your code expresses the
what and not the
how of what you’re trying to accomplish
RxJS Principles & Mindset
FP (Higher-Order Function, Pure Function, Immutability, Functor, Lazyness)
Promise returns an immutable, single postponed cached value
Promise drawbacks!
Manage only one value (not like mouse event or sequence of bytes in a file stream => no repeatable/retriable)
Once run/trig couldn't be cancelled
Don't worry stream is beautiful!
We have to shift our mindset to think in terms of streams, also known as functional sequences of events. RxJS implements
under the hood through the use of familiar patterns such as Iterator and Observer.