Android Architecture's Four Ages: From MVC to MVI, with the Same App in Kotlin
The four-pattern walkthrough shows exactly which architectural costs you trade for which benefits, so a team can stop cargo-culting MVI and pick the pattern that matches its bug count, UI framework, and tolerance for boilerplate. The pragmatic hybrid Google now endorses (single StateFlow output, direct method calls input) gives most projects MVI-grade state safety without forcing sealed Intent classes on every trivial form.
Android client architecture has gone through four major generations: MVC, MVP, MVVM, and MVI. Rather than memorizing what each letter stands for, the useful question is why each previous architecture died and what nerve the next one changed. This article answers that by implementing the same business scenario (load a user, like to level up, rotate the screen, fail a request) in all four patterns, with Kotlin code and a companion GitHub project that runs all six implementations (four plus two pragmatic variants).
The evolution tracks three escalating goals: responsibility decoupling (MVC to MVP), reactive data-driven UI (MVP to MVVM), and unidirectional data flow with state convergence (MVVM to MVI). MVC collapses because Activity becomes a God class that mixes view, controller, and business logic, leaks memory on rotation, and is untestable. MVP extracts business logic into a presenter but pays with interface explosion (contract hell) and imperative UI calls that easily miss state resets. MVVM removes the contracts using LiveData/StateFlow, but scatters state across many independent streams, producing "ghost states" where UI elements contradict each other, and LiveData's sticky events replay one-time toasts after rotation.
MVI solves those three by using a single immutable UiState, a single dispatch(Intent) entry, and a Channel-based UiEffect for one-time events. It works with both Jetpack Compose and traditional XML via state slicing (map + distinctUntilChanged). The article closes with pragmatic selection advice: merge scattered LiveData into one StateFlow for legacy MVVM, adopt a "converged output, direct-call input" hybrid for normal development (the official Now in Android approach), and reserve full MVI for new Compose projects or high-interaction pages. A runnable ArchEvolutionDemo repo accompanies every example.
The real driver of each architecture change is a specific, reproducible failure mode: a God Activity, a contract explosion, a ghost state, a sticky toast. Naming the failure mode makes the next architecture feel like a patch rather than a fashion.
Sticky event replay is fundamentally a semantics defect: mixing persistent state with one-time events in the same channel. MVI's separation of UiState and UiEffect is the clean fix, but the Channel-based UiEffect itself has a catch: it is point-to-point and buffers while backgrounded, so it trades replay for delayed delivery.
The pragmatic hybrid pattern (single StateFlow output, direct method calls input) suggests that once you have a single source of truth, the ceremony of a sealed Intent interface adds little for simple screens. It becomes valuable only when you need uniform interception, logging, or debouncing of user actions.
The article's honest admission that a flat data class UiState still permits illegal combinations (isLoading=true and isError=true) shows that compile-time state validation requires sealed interfaces; the choice between data class and sealed interface is a real engineering trade-off, not a stylistic one.
XML users of MVI must do manual state slicing with distinctUntilChanged, which reveals that MVI's convenience in Compose relies on smart recomposition. Without it, the pattern demands extra care to avoid needless layout passes.