# Model-View-ViewModel (MVVM)

> A way to split screen code into three parts. Data, the view, and a view model.

**Field:** Software Development  
**Category:** Architecture  
**Also known as:** MVVM, MVVM Pattern, View Model

## Think of it like

It is like a scoreboard. When the score changes, the board shows it by itself.

## Definition

MVVM is a way to split an app's screen code into three parts. The model holds the data and the rules. The view is what the user sees, and it holds no logic. The view model sits between them and holds the screen's state and actions. The view is tied to the view model by data binding, so a change in one shows up in the other by itself. It is common in .NET apps.

## Example

Emma's login screen binds its button to a SignIn command on the view model. She tests that command with no screen at all.

## Why it matters

The view model can be tested without a screen. Designers can change the look without touching the logic.

## Common mistake

Putting logic in the view's own code file. Then it cannot be tested on its own, which was the point of MVVM.

## Three principles

- **Model.** Data and rules.
- **View.** Only what is seen.
- **Data binding.** Changes flow both ways.

## Related terms

- [Model-View-Controller (MVC)](https://learn.benibix.com/term/development/mvc)
- [Separation of Concerns](https://learn.benibix.com/term/development/separation-of-concerns)
- [Layered Architecture](https://learn.benibix.com/term/development/layered-architecture)
- [SwiftUI](https://learn.benibix.com/term/development/swiftui)
- [Jetpack Compose](https://learn.benibix.com/term/development/jetpack-compose)
- [Observer Pattern](https://learn.benibix.com/term/development/observer-pattern)

## Told apart from

- [MVC vs MVVM](https://learn.benibix.com/compare/mvc-vs-mvvm): People think MVVM is just MVC with a new name, since both split screen code into three parts. In MVC, a controller takes the user's input and picks what the view shows. In MVVM, a view model holds the screen's state, and the view binds to it. Changes then flow both ways by themselves. The view model never touches the view, so it is easy to test.

![Three boxes in a row. The view on the left shows a login screen. The view model in the middle holds email, password and a sign in command. The model on the right holds users and the rules. A two-way arrow marked data binding joins the view and view model. A one-way arrow joins the view model to the model. A note says the model does not know about the view.](https://learn.benibix.com/diagrams/dev6-mvvm.svg)

---

Source: https://learn.benibix.com/term/development/mvvm
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-18
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
