<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Akshayan Muhunthan on Medium]]></title>
        <description><![CDATA[Stories by Akshayan Muhunthan on Medium]]></description>
        <link>https://medium.com/@muhunthanakshayan?source=rss-807723c21aaf------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*mozqbp0cBCGDFjEe</url>
            <title>Stories by Akshayan Muhunthan on Medium</title>
            <link>https://medium.com/@muhunthanakshayan?source=rss-807723c21aaf------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 05 Nov 2026 08:00:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@muhunthanakshayan/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Who Owns the State? MVC, MVP, MVVM and MVI in Mobile Apps]]></title>
            <link>https://medium.com/@muhunthanakshayan/who-owns-the-state-mvc-mvp-mvvm-and-mvi-in-mobile-apps-bcb03f7ac97a?source=rss-807723c21aaf------2</link>
            <guid isPermaLink="false">https://medium.com/p/bcb03f7ac97a</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[clean-architecture]]></category>
            <category><![CDATA[mvvm]]></category>
            <category><![CDATA[android-development]]></category>
            <dc:creator><![CDATA[Akshayan Muhunthan]]></dc:creator>
            <pubDate>Wed, 04 Nov 2026 13:35:13 GMT</pubDate>
            <atom:updated>2026-11-04T13:35:13.611Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aDFYKhUP7GpFGgCi8XQYzg.png" /></figure><p>Most mobile apps don’t become messy because of one bad decision. They get messy because nobody decided where the state lives.</p><p>A login button gets a loading spinner. Then an error message. Then a “remember me” toggle. A few weeks later, the screen’s logic is spread across three files and a rotation bug is wiping out half of it. Architecture patterns exist to stop this slide.</p><p>In this article I’ll walk through four patterns you’ll meet in mobile development: <strong>MVC, MVP, MVVM and MVI</strong>. I’ll focus on three questions for each:</p><ol><li>Where does the data and state live?</li><li>How do user actions travel through the app?</li><li>How easy is it to test and maintain?</li></ol><p>I’ll use one running example, a simple login screen, with Kotlin/Android-flavored snippets. The ideas apply equally to iOS and Flutter.</p><h3>The core problem: state and separation of concerns</h3><p><strong>State</strong> is everything the screen needs to know to draw itself right now: the text in the fields, whether a request is in flight, whether there’s an error.</p><p><strong>Separation of concerns</strong> means UI code draws things, business logic makes decisions, and data code talks to the network or database. All four patterns are different answers to the same question: <em>how do these pieces talk to each other without becoming tangled?</em></p><h3>1. MVC (Model-View-Controller)</h3><p>The oldest of the four. It was the default for early iOS (UIKit) and still shows up everywhere.</p><ul><li><strong>Model</strong>: data and business rules</li><li><strong>View</strong>: what the user sees</li><li><strong>Controller</strong>: takes input, updates the model, picks the view</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w5dE_QWK-t1Yyi1q4gXtKQ.png" /></figure><p><strong>In practice:</strong> the Controller and View end up tightly coupled. On Android, an Activity is both the View and the Controller. On iOS, you get the famous “Massive View Controller,” a file with 2,000 lines doing everything.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*baxZYYpNJGocZol8Euj6WQ.png" /></figure><p><strong>Good:</strong> simple, quick to learn, fine for small apps.<br><strong>Bad:</strong> hard to unit test (logic is trapped in UI classes), state lives in scattered view properties, and it falls apart as screens grow.</p><h3>2. MVP (Model-View-Presenter)</h3><p>MVP exists to fix MVC’s biggest flaw: it pulls logic out of the View.</p><ul><li><strong>View</strong>: a dumb interface. It only displays and forwards events.</li><li><strong>Presenter</strong>: holds the logic, tells the View exactly what to do</li><li><strong>Model</strong>: data and rules</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y1iItnt6QJFNWkri3zH8dA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XL0q_3YN-1gOGZebr6wngQ.png" /></figure><p><strong>Good:</strong> the Presenter is plain Kotlin, so you can unit test it with a fake View. Responsibilities are clear.<br><strong>Bad:</strong> lots of boilerplate (an interface per screen), the Presenter and View hold references to each other (a leak risk if you forget to detach), and state is still scattered. The Presenter <em>commands</em> the View step by step, so it’s easy for the screen to drift out of sync.</p><h3>3. MVVM (Model-View-ViewModel)</h3><p>MVVM flips the relationship. The ViewModel doesn’t know the View exists. It just exposes state, and the View <strong>observes</strong> it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D_cL_SwMfVABBpVO5RV-oQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RwQqL6gVC6V50mYHO5aWgw.png" /></figure><p>The View just reacts:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wr34WZiYEmZOmXrtmx91GA.png" /></figure><p><strong>Good:</strong> no View reference in the ViewModel (fewer leaks, easier tests), it survives configuration changes like rotation, and it fits naturally with Jetpack Compose and SwiftUI. This is why it’s the officially recommended approach on Android.<br><strong>Bad:</strong> a ViewModel can bloat into a mini god-class. And if you expose several separate observables (isLoading, error, data), they can get out of sync with each other, and one-off events like “show a toast” are awkward to model.</p><h3>4. MVI (Model-View-Intent)</h3><p>MVI takes MVVM’s observable idea and adds strictness: <strong>one state object, one direction, and every change goes through a defined path.</strong></p><ul><li><strong>Intent</strong>: what the user wants to do (LoginClicked, EmailChanged)</li><li><strong>Model</strong>: the single, immutable state of the screen</li><li><strong>View</strong>: renders the state, nothing else</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pM48FKIDMVXi6SxYc5fNWA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t9m9afaS85RpqQ9akqHqjw.png" /></figure><p><strong>Good:</strong> state is predictable. There’s one source of truth, so any bug can be reproduced by replaying the intents. It’s great for complex screens with lots of interacting inputs, and the logs read like a story of what the user did.<br><strong>Bad:</strong> more code and more concepts for simple screens (a tiny settings page doesn’t need sealed intents), copying large state objects can feel heavy, and the learning curve is steeper for beginners.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oaT0CX4FGCQ0CjTSB__8Hw.png" /></figure><h3>So which one should you use?</h3><p>My honest take:</p><ul><li><strong>Tiny app or prototype?</strong> MVC is fine. Don’t over-engineer a weekend project.</li><li><strong>Maintaining an older codebase?</strong> You’ll likely meet MVP. Understand it, and migrate gradually if you can.</li><li><strong>Building a typical modern app?</strong> Go with <strong>MVVM</strong>. It’s the best balance of structure and simplicity, and it’s what the platforms themselves push.</li><li><strong>Complex, interaction-heavy screens</strong> (forms with dependent fields, real-time data, chat, checkout flows)? Use <strong>MVI</strong>, or MVVM with a single-state-object discipline. In practice, many teams end up with something in between.</li></ul><p>The pattern matters less than the principle underneath all four: <strong>keep logic out of the UI, and make it obvious where state lives and how it changes.</strong> A well-disciplined MVVM beats a sloppy MVI every time.</p><h3>Final thoughts</h3><p>These patterns aren’t rival religions; they’re stages in the same evolution. MVC separated data from display. MVP pulled logic out of the UI. MVVM made the UI react to state instead of being commanded. MVI made that state a single, predictable truth.</p><p>If you’re starting out, learn MVVM well, then try rebuilding one screen in MVI to see the difference. That exercise will teach you more than any article, including this one.</p><p><strong>Medium tips:</strong> paste the code blocks as code blocks (type ``` on a new line), turn the ASCII diagrams into clean images if you have time (draw.io or Excalidraw works), and add 4 or 5 tags like Android, Software Architecture, MVVM, Mobile Development. Since the deadline is today, publish first and polish after, because you only need to submit the URL.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bcb03f7ac97a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>