How it works · 37 of 49 Foundation

What are MVC and MVVM architecture patterns?

Screen, logic and data kept apart

MVC and its family (MVVM): MVC keeps an app's data and rules (the model) apart from what draws the screen (the view) and what handles input (the controller), so one change to a rule reaches every screen at once and the rule can be tested with no screen at all. MVVM adds a view model per screen that holds exactly what that screen shows.

Loading the animation…

Say it like this MVC keeps an app's data and rules (model) apart from what draws the screen (view) and what handles input (controller), so one change to a rule reaches every screen at once and can be tested with no screen at all.

Under the hood — for builders
Worked example: the ₹599 change
On the card the cart is ₹550. The rule "free delivery over ₹499" lives once, in the model; both views ask the model and show "free". Change it to ₹599 in one place and both show ₹40. Copy the rule into the web view instead, change only the model, and the phone says ₹40 while the web says free: one cart, two prices.
The source, in its words
Reenskaug, Xerox PARC, 10 December 1979, the note that named the pattern: "Models represent knowledge." "A view is a (visual) representation of its model." "A controller is the link between a user and the system." And: "a view should never know about user input, such as mouse operations and keystrokes."
Terms
Model: the data and the rules about it, with no idea how it is drawn. View: draws the model and asks it questions. Controller: takes taps and keys and turns them into messages. View model (MVVM): one per screen, holds exactly what that screen shows, ready formatted; the view binds to it, meaning it redraws itself when the value changes.
Why the split pays: tests without a screen
Microsoft's MVVM guide: "Developers can create unit tests for the view model and the model, without using the view." We timed the card's delivery rule both ways.
The family
MVC (Reenskaug, 1979, Smalltalk at Xerox PARC): the controller handles input. MVVM, in Microsoft's guide, adds a view model between them: "the view model isolates the view from the model, and allows the model to evolve independently of the view."
Measure it
Rules found in view code (grep for prices and limits in templates) · share of rule tests that need a browser · places a rule change touches · screens that disagree for one input.
Watch out
Fat controllers: the rule moves out of the view and into the controller, still not reusable. Anaemic models that only hold data push rules back out. A small screen with no shared rules doesn't need three files; the split pays when a second screen or a test arrives.
Sources
Trygve Reenskaug, "Models - Views - Controllers", Xerox PARC, 10 Dec 1979 (Zenodo 3676092) · Microsoft Learn, "Model-View-ViewModel", Enterprise Application Patterns Using .NET MAUI, 2024 · both read in session · rule-check timing, Node and Playwright, 21 Nov 2026.

What happens in the MVC and its family (MVVM) animation, step by step?

  1. A puppet theatre: the script holds the story (the model), each stage only shows it (a view), and the puppeteer turns the audience's taps into changes to the script (the controller).
  2. Your turn: drag each job to the script, a stage or the puppeteer.
  3. Change the rule once, in the script: free delivery now starts at ₹599. Both stages read the script, so both show ₹40 delivery at once.
  4. Now someone pastes the old rule onto the web stage. Same cart, two answers: the phone charges ₹40, the web says free.
  5. MVVM adds a stage-hand per stage who readies exactly what it shows, so stages hold no logic at all. Here data flows one way, script to stage; next, a whole app as a line of steps: pipes and filters.

What everyday example explains MVC and its family (MVVM)?

A puppet show: one script (model) played on any number of stages (views); the puppeteer (controller) takes the audience's cues and changes the script; a stage-hand per stage (view model) readies what that stage needs.

Why should a team care about MVC and its family (MVVM)?

The day a second screen (an app beside the website) or a test suite arrives, every rule written inside a screen becomes a copy to keep in step; deciding where rules live is cheapest on day one.