MVI — a new member of the MV* band
Iveta Jurčíková
6342

Hi, thanks for the grate article. I started using MVI architecture few months ago — I was inspired by Benoit’s Quenaudon talk on Droidcon. I find this architecture more effective than MVP for both small and complex projects.

I have few notes about the drawbacks you have discribed:
1. A lot of boilerplate — yes even for a one simple screen you need to write the following components: Intents, IntentMapper, Actions ActionProcessors, Results, Reducer, ViewState and ViewModel which will tie it all together. But for all screens those components will be working the same way so it is quite easy to add some interfaces and base classes and create own mini MVI framework. I’ve done something like this in my smaple project.

2. SingleLiveEvents — I think that emiting `showMessage = false` after few seconds is not a good solution, because in the meantime other state can be emited (in response to diffrent action) and our single event will be handled twice. I’ve approach it differently with ViewStateEvent class.
Now handling events is very easy — `viewState.event?.consume { … }`. We have also certainty that event will be consumed only once, and we do not need to emit another viewState after it happens. Let me know what you think and if you see any potential drawbacks of this solution.