FRP
Reactive programming is programming with asynchronous data streams.
A stream is a sequence of ongoing events ordered in time. It can emit three different things: a value (of some type), an error, or a "completed" signal. Consider that the "completed" takes place, for instance, when the current window or view containing that button is closed.
We capture these emitted events only asynchronously, by defining a function that will execute when a value is emitted, another function when an error is emitted, and another function when 'completed' is emitted. Sometimes these last two can be omitted and you can just focus on defining the function for values. The "listening" to the stream is called subscribing. The functions we are defining are observers. The stream is the subject (or "observable") being observed. This is precisely the Observer Design Pattern.
Example: (Excel tables. Depending on changing one column the whole table can change.), RX.js, ReduxObservable,
Reactive programming (eg. RXJS) pros:
streams
merging
writing declarative code
avoiding callback hell
threading and asynchronous mechanisms implementation
purity
Reactive programming (eg. RXJS) cons:
hard debugging
making documentation
memory consumption
time to start
managing concurrency
data immutability required
complexity of testing
learning curve
Last updated
Was this helpful?