Cycle.js coding style puzzle: sink-HTTP-source, or just wrapping ajax promise to a metastream and then flatMap?
See original GitHub issueIn the traditional RxJS programming, when doing Http request, we just use fromCallback
or fromPromise
to wrap a new stream, then map the request stream with it, building a meta-stream, and then flatMap
it.
But cycle.js recommends to put the Http thing out of main() and into the HTTP driver, just like what we do with DOM.
I understand the drivers mean ‘outside world’ or 'human user’and main() means ‘computer’. But, yes, DOM events are from human users, while HTTP should still be on the ‘computer’ side.
So what’s the point to put HTTP operations into drivers? Is it just because Http operations introduce side effects? Does that mean main() is not just ‘computer’ bu also pure, and all side effects must go to drivers, no matter they are from humans or from HTTP data fetching?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:19 (6 by maintainers)
Top GitHub Comments
@staltz thank you for your patience. Yes now I realize my previous proposal is actually reducing Cycle.js into merely a wrapper of RxJS with a v-dom plugin. That’s clearly not what you want. Cycle.js is more about a beautiful programming paradigm.
@jvanbruegge don’t get me wrong, I get @staltz 's analogy with horses and cars made in a talk. I just happen to question edges that look a little sharper than needed for a smooth introduction of cycles to a 14-year old. There are 14-year olds that fly planes, you know. Activity that doesn’t require pure math thinking. Just practical.