Currently, I am using an EventBus/PubSub architecture/pattern with Scala (and JavaFX) to implement a simple note organizing app (sort of like an Evernote client with some ad
I learned one or two things since I asked this question 2 years ago, here is my current understanding (as explained in Stephen's FRP book):
The both try to help to describe a state machine, i.e. describe how the state of the program is changing in response to events.
The key difference between EventBus and FRP is compositionality:
What is compositional ?
FRP is a compositional way of describing a state machine, and event-bus is not. Why ?
EventBus is not a compositional way of describing a state machine. Why not ?
In summary, EventBus is not compositional, because the meaning and behaviour of a composed EventBus (i.e. the time evolution of the state that is influenced by said composed EventBus) depends on time (i.e the state of those parts of the software which are not included explicitly in the declaration of the composed EventBus). In other words, if I would try to declare a composed EventBus then it would not be possible to determine (just by looking at the declaration of the composed EventBus) what rules govern the state evolution of those states that are influenced by the composed EventBus, this is in contrast to FRP, where this can be done.)