CommonGarden / Grow-IoT

Software packages for smart growing environments.
http://commongarden.org/
Other
25 stars 6 forks source link

Should Thing.js be an extension of Stream instead of Event Emitter? #434

Closed JakeHartnell closed 6 years ago

JakeHartnell commented 6 years ago

Open question for me. A stream is also an instance of an Event Emitter...

JakeHartnell commented 6 years ago

@mitar's original code that kicked all this off used streams. It's my bad for taking that out.

newswim commented 6 years ago

FWIW, I think events are more easy to reason about. Streams are certainly awesome, particularly when applied to FRP as Cycle.js has done, but part of the issue i think is that the two aren't interchangeable in the same way that other concepts might be.

Domenic's answer in question on StackOverflow contrasts some of the differences in terms of pull-based and push-based API's.

You could probably construct a decision table based on some metrics, eg. single-consumer vs. multi-consumer, push vs. pull, etc.

It might be the case that both are used, in different use cases.