https://kotlinlang.org logo
Title
s

Shabinder Singh

02/17/2021, 10:02 PM
MVI approach is all solid and gr8 and leaves no place for unintended behaviour/things to happen or atleast we can say it minimises it to gr8 extent! However i have been developing most of my projects in MVVM and as now i am trying out to port the same projects to MVI , i feel like MVI requires more effort or you can say its more time-consuming . I also feel MVI is more clean and descriptive ! Anybody else feels same? If yes is that extra effort worth it ? , and is MVI your goto choice for large scale apps?
a

Arkadii Ivanov

02/18/2021, 9:55 AM
Hi! There are always tradeoffs. The MVI pattern itself (regardless of the framework) has two main differences from MVVM. 1. State is represented by one class, so you need the Reducer. 2. View is passive and stateless, and is not responsible for subscribing to ViewModel. Overall you need more code for MVI, and some code may look like boilerplate. This is due to better separation of concerns, compile time safety, single source of truth.
o

Oliver Mwitia

08/17/2021, 12:59 AM
We use a viewmodel in MVVM to preserve state across configuration changes. In MVI, we have one single source of truth, ie one immutable store. Do we still need viewmodels in MVI with that in mind?