2 ms·
You are correct, there isn't really any synergy, and it's just a re-framing of synchronous dataflow programming using somewhat convoluted terminology and techno
by mpweiher 8y ago
You are correct, there isn't really any synergy, and it's just a re-framing of synchronous dataflow programming using somewhat convoluted terminology and technology.
In fact, what "reactive programming" does is solve the problem that FP has with reactive systems[1], in that it isn't suited for them at all. FP, pretty much by definition, is suitable for transformational systems, i.e. systems that map some inputs to some outputs and are then done.
With just FP, there really isn't any way to build reactive systems, that is systems that continuously react to external and internal stimuli, whereas reacting (responding) to stimuli (messages) is pretty much the definition of OO.
By treating input as (infinite) streams of data and applying collection processing to those, you can sort of map this to the aforementioned dataflow programming and solve your problem. Of course, just using dataflow programming directly is both simpler and faster, but hey...
[1] https://www.inf.ed.ac.uk/teaching/courses/seoc/2005_2006/resources/statecharts.pdf https://www.inf.ed.ac.uk/teaching/courses/seoc/2005_2006/res...
- fpoling 8y agoElm is pure function and reactive but it is not FRP especially with its latest Elm architecture. The language does not use anything like Haskell's IO or State monad, yet is perfectly capable of building complex applications. It shows that one can have pure functional language for reactive systems with relatively simple type system. One just needs to provide thoughtful architecture and libraries.
- mchahn 8y ago> just using dataflow programming directly is both simpler and faster, But a good reactive system is simpler to write, understand, and debug. At least that is what I found in my latest project.
- mpweiher 8y agoWhat dataflow system/language did you use to compare?
- mchahn 8y agoThe framework is custom. But I was really talking about how great reactive was for my application. It is a control system with a lot of inputs and outputs. The graph is about a dozen levels deep.
- mpweiher 8y agoSo you weren't actually comparing reactive with dataflow? Because what you write certainly sounds a lot like just dataflow.
- mchahn 8y agoI can't answer this without knowing your definition of reactive. To me, dataflow is simply a stream of data triggering calculations even if the data is unchanged. e.g. the stream of 1,2,2,3 would cause four calculations. Reactive means that only 1,2,3 would appear to the calculations. In other word only changes are reacted to. My framework is reactive by these definitions.