Closed jessehattabaugh closed 8 years ago
Hi @jessehattabaugh. You are right.
Not the easiest subject to get and to explain. Mostly because human languages aren't so strict as programming ones. But I will try.
All diagrams are, of course, simplified to present the essence of the architecture. They could include much more "parts" but my goal was to discover the "main loop". Every frontend app contains one because it does not end normally.
Program consists of parts. Those parts interact with each other. It may be a module, or class but all interactions boil down to function calls.
Passive is what experiences action of some actor in some interaction. Pure data is always passive. So even in fully Reactive system you will have Interactive layers. Those which works directly with data.
One code may be Passive at one moment and Active at the next. Take this chunk from the Flummox example:
Component => Action => Dispatcher ...
Component listens reactively to the DOM. This is not showed. Then:
onClick="someData => someAction(someData)"
[... <- Component => Action]
dispatch("someAction", someData)
[Action => Dispatcher]
So Action is passive
from the Component view. And active
from the Dispatcher view.
Active is the opposite to passive and represents some layer of control.
Controllers are never passive
in the backend app because noone calls them.
Reactive is what listens to some source and "react" in some way. This source
may be an Event emitter, a Stream, a Promise, an Observable. It does not matter and it does not have established name, that's why I mark it as any
.
active => passive
Here active
should have access to passive
. Import module and call some function from it.
Or have a data and apply some function on it.
Left part is aware of the right, right part is not aware of the left.
any <- reactive
Here reactive
should have access to any
. Import module and subcribe to some emitter from it.
Or have a Stream data and subscribe on it. Whatever fits.
Left part is not aware of the right, right part is aware of the left.
That's what direction means. What must be aware of what.
Also I suggest you to see https://github.com/Yomguithereal/baobab/issues/240 and my comments there.
Is it more clear now?
So you could say
Interactive: actor => actee Reactive: observer <- observable
This is correct
Interactive:
actor => actee
This is wrong
Reactive:
observer <- observable
Should be
Reactive:
observable <- observer
Left-to-right direction follows the timeline Type of arrow helps to differ between different relations. Interactive mutates Future in terms of what is Now. Reactive describes Now in terms of the Past.
Interactive = mutable time Reactive = immutable time
The problem with the word "actor" is that it heavily associates with an Actor pattern in concurrency. Erlang users would be very confused cause we use it here in a totally different meaning.
Definitions added.
What does
mean?