Sobes.tech
Middle+

Would you prefer MVI or MVVM?

sobes.tech AI

Answer from AI

I choose MVVM (Model-View-ViewModel) for most projects for several reasons:

  1. Simplicity: MVVM is easier to understand and start using, especially for newcomers to the team.
  2. Testability: Separating business logic (ViewModel) from UI (View) makes unit testing simpler and more effective.
  3. Support from Google: Android Architecture Components are initially oriented towards building architecture using ViewModel and LiveData/Flow.

However, MVI (Model-View-Intent) might be a better choice when:

  1. Explicit state handling: MVI provides a unidirectional data flow and a clear representation of the current UI state, which can be useful for complex screens with many interactions and states.
  2. Debugging: Thanks to fixed states and explicit intents, debugging becomes more predictable.
  3. Using reactive approach: MVI integrates well with reactive frameworks like RxJava or Flow.

Overall, MVVM is a more versatile and maintainable approach for most Android applications, while MVI may be preferred for applications with a pronounced need for strict state management and predictability. I would evaluate the complexity and specifics of the project before making a final choice.

Would you prefer MVI or MVVM? — Android - sobes.tech