staltz/mvi-example — pull request #1 by paldepind (2014-11-05 17:40:05+00:00)
Title: Avoid naming intent operations and switch table in model

Currently all objects sent through streams from the intent to the model are being tagged with an `operation` property. The model then simply merges them into one stream and handles them based on the `operation` property in an if else chain. As far as I can see that is done in order to end up with `items$` as one single stream.

I do however think that approach is quite ugly. Having to name the different kinds of objects because they end up being mixed together doesn't seem to take advantage of the fact that they are separated to begin with. It doesn't seem very scalable either. Actually you do mention in your splendid introduction to reactive programming that reactive programming should allow us to reduce the amount of if else control structures.

This commit cleans things up by using a variation of a technique I've seen used in [this blog post](http://nullzzz.blogspot.dk/2013/02/chicken-egg-and-baconjs.html) by the author of bacon.js. All the different streams from the intents are mapped into mutator functions that are merged into a single stream and applied trough `scan`.

Please tell me what you think!

Your blog post about MVI was a _very_ interesting read btw :)