Architecture Patterns
A guide to UI architecture patterns (MVC, MVP, MVVM and MVU), with a short introduction to layered, hexagonal, onion and clean architecture.
· Last updated: 2026-10-26 · 17 min read
Overview
Suppose an order screen has a quantity field whose change handler parses the input as a number, fills an error label if it exceeds stock, and otherwise calculates the total, updates its label and enables the order button. The button's click handler checks stock again, then saves the order to a database. Even checking the single rule "an order cannot exceed available stock" requires opening a window, connecting a database and entering a quantity. Input interpretation, screen updates, business rules and persistence are mixed into two handlers, so none can run or change on its own. An order screen makes a useful example because one input leads through validation, calculation, display and saving, letting us compare the responsibilities that need to be separated within one situation.
In this document, architecture patterns name ways to divide this code at the screen or application level. Each pattern defines the roles, the route user input and screen updates take through those roles, and the direction of source-code dependencies. The GoF design patterns introduced in Programming Patterns have a smaller scope: they describe how objects are created, assembled and made to cooperate. The two levels work together. In MVC, for example, the model notifies views of changes through the Observer pattern.
Architecture patterns address two kinds of questions. The division of input, presentation and presentation rules within a screen is the subject of UI architecture patterns such as MVC, MVP, MVVM and MVU, each covered in its own article. Boundaries and dependencies between business rules and external technologies such as databases, web frameworks and external services are the subject of application structure patterns. Layered, hexagonal, onion and clean architecture receive a brief introduction here. In the order screen above, separating the stock rule from its handler addresses the first question; preventing that rule from directly calling database code addresses the second.
The two kinds overlap within a program. In his article on clean architecture, Robert C. Martin places the GUI's entire MVC structure in the interface adapters layer, the third concentric circle from the inside.1
Comparing UI architecture patterns
All four patterns separate screen code from other logic so that some of it can be tested without opening a window, but the testable part differs. They also differ in who receives user input first and how changed values reach the screen.
When reading the table and diagrams, follow who first receives user input, who changes state, and who transfers changed values to the screen. Displaying a total after a quantity change, for example, requires both interpreting the input and applying the new total to the screen. The comparison below follows the roles involved in these two stages. The individual articles use counters, searches and carts to expose each flow on a small scale; the table does not compare four executions of the same ordering program.
Pattern | Who receives user input | How the view updates | What can be tested without a UI | Where it is used |
|---|---|---|---|---|
The controller translates input into calls to the model. | When the model announces a change, registered views read the model again and render. In web MVC, the controller selects a view and passes data for each request, without change notifications. | The model: data and rules | Smalltalk-80; server-side web frameworks such as JSP Model 2, Ruby on Rails and ASP.NET MVC | |
The view passes input to the presenter, which decides how to respond. | In Passive View, the presenter supplies display values through the view interface. In original MVP and Supervising Controller, the view observes the model or stays synchronized through data binding. | The presenter, using a fake view, and the model | Taligent (C++, Java), Dolphin Smalltalk, Windows Forms and ASP.NET Web Forms | |
The view. A command source such as a button calls the bound command's ( | When the ViewModel announces changes through | ViewModel and Model | WPF, Silverlight, .NET MAUI and JavaScript's Knockout | |
The screen elements built by the view function translate input into messages and send them to the runtime. | The runtime receives a new model from update and calls the view function with it to build the next screen. | Update and view: pure functions | Elm; Redux, where the reducer serves as update; Fabulous in F# |
- Pattern
- Who receives user input
The controller translates input into calls to the model.
- How the view updates
When the model announces a change, registered views read the model again and render. In web MVC, the controller selects a view and passes data for each request, without change notifications.
- What can be tested without a UI
The model: data and rules
- Where it is used
Smalltalk-80; server-side web frameworks such as JSP Model 2, Ruby on Rails and ASP.NET MVC
- Pattern
- Who receives user input
The view passes input to the presenter, which decides how to respond.
- How the view updates
In Passive View, the presenter supplies display values through the view interface. In original MVP and Supervising Controller, the view observes the model or stays synchronized through data binding.
- What can be tested without a UI
The presenter, using a fake view, and the model
- Where it is used
Taligent (C++, Java), Dolphin Smalltalk, Windows Forms and ASP.NET Web Forms
- Pattern
- Who receives user input
The view. A command source such as a button calls the bound command's (
ICommand)Execute, while data binding transfers field values to the ViewModel.- How the view updates
When the ViewModel announces changes through
PropertyChanged, the binding engine reads the values and puts them into the view.- What can be tested without a UI
ViewModel and Model
- Where it is used
WPF, Silverlight, .NET MAUI and JavaScript's Knockout
- Pattern
- Who receives user input
The screen elements built by the view function translate input into messages and send them to the runtime.
- How the view updates
The runtime receives a new model from update and calls the view function with it to build the next screen.
- What can be tested without a UI
Update and view: pure functions
- Where it is used
Elm; Redux, where the reducer serves as update; Fabulous in F#
The figure contains four UML communication diagrams. Each panel numbers the messages from one user input through the resulting screen update. Dots indicate nested calls: 1.1.2 is the second message sent while handling 1.1. Participant names come from the examples in the individual pattern articles; Button, TextBlock, BindingExpression (WPF) and Html (Elm) are framework types. The MVVM panel shows a binding engine such as WPF's, rather than the example's console Binder. As a command source, the button directly calls the bound command's Execute;2 binding (BindingExpression) appears only when it receives PropertyChanged and updates a displayed value. In the MVU panel, Render(html) names the runtime step that applies the new screen. Class and sequence diagrams appear in each pattern's article.
MVC and MVVM both update the screen through change notifications, but different recipients handle them. In Smalltalk-80 MVC, a view registers as a dependent of the model and receives an update message when the model changes.3 In MVVM, the binding engine receives the ViewModel's PropertyChanged notification and updates the view.4 MVP's Passive View updates through explicit presenter calls, so the view and model have no dependency in either direction.5 In MVU, messages go to update to calculate a new model instead of subscribing to model-property changes. Update is the sole route for state changes, and the view function recalculates the screen whenever a new model arrives.6
History
This timeline combines the histories from the four UI pattern articles with the main publications on application structure, in chronological order. Links in the source column support each row.
Year | Event | Source |
|---|---|---|
1978 | Reenskaug conceived MVC while visiting Xerox PARC's LRG, from summer 1978 to summer 1979. | |
1979 | The May 12 note "Thing-Model-View-Editor" explained Thing, Model, View and Editor through examples. | |
1979 | The December 10 note "Models-Views-Controllers" settled on the names model, view and controller. The editor, which lets users modify a view's information, remained a supporting element. | |
1988 | Krasner and Pope published their Smalltalk-80 MVC guide in JOOP's August/September issue. | |
1995 | After building a widget-based UI framework, the Dolphin Smalltalk team began replacing it with MVC late that year, taking about two months. | |
1996 | Mike Potel introduced Taligent's MVP in "MVP: Model-View-Presenter, The Taligent Programming Model for C++ and Java". | |
1999 | Seshadri described the JSP Model 2 architecture as a server-side implementation of MVC. | |
2000 | Andy Bower and Blair McGlashan described Dolphin Smalltalk's adoption of MVP in the ESUG 2000 tutorial paper "Twisting the Triad". | |
2002 | Michael Feathers described a logic object pushing values to a dialog through a view interface in "The Humble Dialog Box". | |
2002 | Fowler's Patterns of Enterprise Application Architecture was published. Dividing enterprise applications into layers is one of its main subjects. | |
2004 | Martin Fowler published drafts of Model View Presenter and Presentation Model on July 19. | |
2005 | Alistair Cockburn documented Ports and Adapters, also called hexagonal architecture. The article is version 0.9, dated September 4. | |
2005 | John Gossman published an introduction to Model/View/ViewModel on his blog on October 8. | |
2005 | Ruby on Rails 1.0 was released. The Rails guide describes Action Controller as the C in MVC. | |
2006 | Gossman published a discussion of M-V-VM's advantages and disadvantages. | |
2006 | Fowler retired the MVP entry after splitting it into Supervising Controller and Passive View on July 11. He then surveyed MVC and its variations in "GUI Architectures" on July 18. | |
2008 | Jeffrey Palermo published the first article in "The Onion Architecture" series on July 29. | |
2009 | Josh Smith's WPF MVVM article appeared in MSDN Magazine's February issue, introducing | |
2009 | Microsoft released ASP.NET MVC 1.0 at its MIX event. | |
2010 | Dino Esposito introduced MVP implementations for Web Forms and Windows Forms in MSDN Magazine. | |
2012 | Evan Czaplicki's thesis "Elm: Concurrent FRP for Functional GUIs", dated March 30, described | |
2012 | Robert C. Martin published "The Clean Architecture" on his blog on August 13. | |
2015 | The elm-architecture-tutorial README presented a program skeleton divided into model, update and view in January. | |
2015 | Redux 1.0.0 was released on August 14. | |
2016 | Elm 0.17 introduced subscriptions and replaced signals: "A Farewell to FRP", May 10. | |
2016 | The Elm 0.18 announcement introduced exporting and importing event histories in debug mode, on November 14. | |
2017 | Martin's Clean Architecture was published by Prentice Hall. | |
2020 | The .NET MAUI announcement mentioned C# MVU as a future feature on May 19. |
- Year
1978
- Event
Reenskaug conceived MVC while visiting Xerox PARC's LRG, from summer 1978 to summer 1979.
- Source
- Year
1979
- Event
The May 12 note "Thing-Model-View-Editor" explained Thing, Model, View and Editor through examples.
- Source
- Year
1979
- Event
The December 10 note "Models-Views-Controllers" settled on the names model, view and controller. The editor, which lets users modify a view's information, remained a supporting element.
- Source
- Year
1988
- Event
Krasner and Pope published their Smalltalk-80 MVC guide in JOOP's August/September issue.
- Source
- Year
1995
- Event
After building a widget-based UI framework, the Dolphin Smalltalk team began replacing it with MVC late that year, taking about two months.
- Source
- Year
1996
- Event
Mike Potel introduced Taligent's MVP in "MVP: Model-View-Presenter, The Taligent Programming Model for C++ and Java".
- Source
- Year
1999
- Event
Seshadri described the JSP Model 2 architecture as a server-side implementation of MVC.
- Source
- Year
2000
- Event
Andy Bower and Blair McGlashan described Dolphin Smalltalk's adoption of MVP in the ESUG 2000 tutorial paper "Twisting the Triad".
- Source
- Year
2002
- Event
Michael Feathers described a logic object pushing values to a dialog through a view interface in "The Humble Dialog Box".
- Source
- Year
2002
- Event
Fowler's Patterns of Enterprise Application Architecture was published. Dividing enterprise applications into layers is one of its main subjects.
- Source
- Year
2004
- Event
Martin Fowler published drafts of Model View Presenter and Presentation Model on July 19.
- Year
2005
- Event
Alistair Cockburn documented Ports and Adapters, also called hexagonal architecture. The article is version 0.9, dated September 4.
- Year
2005
- Event
John Gossman published an introduction to Model/View/ViewModel on his blog on October 8.
- Year
2005
- Event
Ruby on Rails 1.0 was released. The Rails guide describes Action Controller as the C in MVC.
- Source
- Year
2006
- Event
Gossman published a discussion of M-V-VM's advantages and disadvantages.
- Year
2006
- Event
Fowler retired the MVP entry after splitting it into Supervising Controller and Passive View on July 11. He then surveyed MVC and its variations in "GUI Architectures" on July 18.
- Year
2008
- Event
Jeffrey Palermo published the first article in "The Onion Architecture" series on July 29.
- Source
- Year
2009
- Event
Josh Smith's WPF MVVM article appeared in MSDN Magazine's February issue, introducing
RelayCommandandViewModelBase.- Source
- Year
2009
- Event
Microsoft released ASP.NET MVC 1.0 at its MIX event.
- Source
- Year
2010
- Event
Dino Esposito introduced MVP implementations for Web Forms and Windows Forms in MSDN Magazine.
- Source
- Year
2012
- Event
Evan Czaplicki's thesis "Elm: Concurrent FRP for Functional GUIs", dated March 30, described
foldpas "fold from the past".- Source
- Year
2012
- Event
Robert C. Martin published "The Clean Architecture" on his blog on August 13.
- Source
- Year
2015
- Event
The elm-architecture-tutorial README presented a program skeleton divided into model, update and view in January.
- Source
- Year
2015
- Event
Redux 1.0.0 was released on August 14.
- Source
- Year
2016
- Event
Elm 0.17 introduced subscriptions and replaced signals: "A Farewell to FRP", May 10.
- Source
- Year
2016
- Event
The Elm 0.18 announcement introduced exporting and importing event histories in debug mode, on November 14.
- Source
- Year
2017
- Event
Martin's Clean Architecture was published by Prentice Hall.
- Source
- Year
2020
- Event
The .NET MAUI announcement mentioned C# MVU as a future feature on May 19.
- Source
MVP and MVVM arose by adapting or specializing earlier patterns. Potel introduced MVP as a programming model that generalized Smalltalk MVC, and described the presenter as lifting the classical Smalltalk controller's responsibilities to the application level.7 The Dolphin Smalltalk team found that MVC connected an application model and its views only indirectly, while native Windows controls already supplied most controller behavior. The team adopted Taligent's MVP after a colleague introduced it.8 Fowler wrote that VisualWorks Smalltalk users knew Presentation Model as Application Model. In a later note, he said the pattern was increasingly known as MVVM.9 Gossman described MVVM as a variation of MVC for environments in which designers build views in declarative languages such as XAML,10 while Smith treated it as a specialization of Presentation Model for WPF and Silverlight.11 On the MVU side, the Redux documentation says Elm's updater has the same role as Redux's reducer,12 and the Elm guide notes that The Elm Architecture inspired projects such as Redux.6
Application structure patterns also refer to one another. Palermo wrote that hexagonal and onion architecture share the premise of moving infrastructure to the outside and using adapter code to avoid tight coupling to it.13 Martin's 2012 article lists hexagonal, onion and other architectures, explaining that although their details differ, they share the aim of separating concerns by dividing software into layers.1
Application structure patterns
The following four patterns divide an entire application, beyond a single screen. All ask whether business rules, or the domain, depend on external technologies such as databases, web frameworks and UI.
Moving total calculation out of the order screen's button handler makes it easier to test without a window. But if the extracted code must call a real database whenever it checks stock, that check still requires a database after the screen is separated. The scope now widens to how business rules connect to persistence technology. Instead of introducing more ordering code, the following sections compare where layers and interfaces sit and which parts reference which.
Layered architecture
Layered architecture divides a program into layers such as presentation (UI), domain logic and data access. In Fowler's account, dependencies generally flow downward: presentation depends on the domain, which depends on the data source. He identifies the main benefit as reducing the scope of attention, since these three subjects can be considered relatively separately. He adds that a variation placing a mapper between the domain and data source, so the domain does not depend on the source, is often called hexagonal architecture.14 His 2002 book Patterns of Enterprise Application Architecture also treats dividing enterprise applications into layers as a main subject.15
Hexagonal architecture (ports and adapters)
Alistair Cockburn's Ports and Adapters pattern, also called Hexagonal Architecture, aims to let users, other programs, automated tests and batch scripts drive an application in the same way, and to let development and testing proceed without real devices or databases. The application communicates with the outside through a port, an API defined around the purpose of the conversation. Each external device has an adapter that translates between this API and the device's signals. The application does not know the nature of its input device, and Cockburn requires code that belongs inside to stay inside. He described the pattern as a specific use of the Adapter pattern.16
Onion architecture
Jeffrey Palermo proposed Onion Architecture in a 2008 series. The domain model sits at the center, repository interfaces for storing and retrieving objects occupy the next layer (Repository pattern), and UI, infrastructure and tests sit at the outside. Code may depend only on layers farther inward, never on outer layers; all coupling points toward the center.13 Palermo used this direction to distinguish it from traditional layering, where each layer couples to the one below and to infrastructure. He identified inner layers defining interfaces and outer layers implementing them as a main principle.1317
Clean architecture
Robert C. Martin's 2012 article "The Clean Architecture" presented a diagram intended to combine hexagonal, onion and other architectures into one actionable idea. From the inside outward, its concentric circles contain entities, use cases, interface adapters, and frameworks and drivers. The Dependency Rule allows source-code dependencies to point only inward. When a use case must pass results to an outer presenter, it calls an interface, or output port, defined in an inner circle and implemented by the presenter, making the dependency point against the flow of control.1 A book with the same title was published by Prentice Hall in 2017.18
Choosing a pattern
The UI technology often guides the choice. Frameworks built around data binding, such as WPF, tend to provide tools that support MVVM,19 while Elm's standard browser-program API provides a structure connecting model, view and update.12 The table suggests which article to read first when a problem appears.
Problem | Pattern to read first |
|---|---|
Several screens must display the same model's state | |
The server builds a response screen for each request | MVC Pattern (MVC in a web framework) |
You want to test a form's presentation rules without a form, in a UI with no binding engine | MVP Pattern(Passive View) |
You want to test screen state and button-enabling conditions in a UI with binding, such as WPF or .NET MAUI | |
Several handlers change state, causing state and the screen to disagree | |
You want to reproduce an incorrect screen by replaying the messages it received | |
Business rules are scattered among HTTP handlers or SQL | Layered architecture |
UI, automated tests and batch scripts must call the same business operation | Hexagonal architecture |
Domain code directly references database-access code, preventing tests without a database | Onion architecture, clean architecture, Repository pattern |
External SDK calls spread throughout business code | Adapter pattern, hexagonal architecture |
- Problem
Several screens must display the same model's state
- Pattern to read first
- Problem
The server builds a response screen for each request
- Pattern to read first
MVC Pattern (MVC in a web framework)
- Problem
You want to test a form's presentation rules without a form, in a UI with no binding engine
- Pattern to read first
MVP Pattern(Passive View)
- Problem
You want to test screen state and button-enabling conditions in a UI with binding, such as WPF or .NET MAUI
- Pattern to read first
- Problem
Several handlers change state, causing state and the screen to disagree
- Pattern to read first
- Problem
You want to reproduce an incorrect screen by replaying the messages it received
- Pattern to read first
- Problem
Business rules are scattered among HTTP handlers or SQL
- Pattern to read first
Layered architecture
- Problem
UI, automated tests and batch scripts must call the same business operation
- Pattern to read first
Hexagonal architecture
- Problem
Domain code directly references database-access code, preventing tests without a database
- Pattern to read first
Onion architecture, clean architecture, Repository pattern
- Problem
External SDK calls spread throughout business code
- Pattern to read first
Adapter pattern, hexagonal architecture
Signs of overuse
Adding MVVM to a form with two input fields and creating a ViewModel, command classes and binding configuration for it. Gossman also wrote that MVVM may be excessive for simple UI.20
Creating a view interface, view implementation and presenter for every screen, even when there are few presentation rules. Esposito wrote that MVP increases application-code complexity.21
Splitting a screen with one input and one output into model, view and controller classes.
Creating message types and a runtime loop for a screen with almost no state.
Building all four layers of entities, use cases, interface adapters and frameworks for a program with a few CRUD screens. Palermo said onion architecture was not suitable for small websites,13 and Martin wrote that there need not be exactly four circles.1
Adding several layers of ports and adapters in front of persistence to support replacing a database that no one plans to replace. Fowler wrote that switching data-access mechanisms is often given as a reason to separate the data layer, but he rarely hears of it actually happening.14
See also
Footnotes
- Robert C. Martin. The Clean Architecture. The Clean Code Blog (August 13, 2012). ↩
- Microsoft Learn. Commanding Overview (WPF). Command Sources. ↩
- Glenn E. Krasner, Stephen T. Pope. "A Cookbook for Using the Model-View-Controller User Interface Paradigm in Smalltalk-80". Journal of Object-Oriented Programming, August/September 1988, pp. 26-49. PDF. ↩
- Microsoft Learn. INotifyPropertyChanged Interface. Remarks. ↩
- Martin Fowler. "Passive View". martinfowler.com (July 18, 2006). Original article. ↩
- Elm Guide. The Elm Architecture. ↩
- Mike Potel. "MVP: Model-View-Presenter, The Taligent Programming Model for C++ and Java". Taligent, Inc. (1996). PDF. Opening paragraph; Summary and Three User Interface Questions sections. ↩
- Andy Bower, Blair McGlashan. "Twisting the Triad: The evolution of the Dolphin Smalltalk MVP application framework". ESUG 2000 Tutorial Paper (2000). Internet Archive copy. Model-View-Controller and Twisting the triad sections. ↩
- Martin Fowler. Presentation Model (2004). Also Known as; the introductory Note. ↩
- John Gossman. Introduction to Model/View/ViewModel pattern for building WPF apps (2005). Full article. ↩
- Josh Smith. WPF Apps With The Model-View-ViewModel Design Pattern. MSDN Magazine, February 2009. The Evolution of Model-View-ViewModel. ↩
- Redux. Prior Art. Elm. ↩
- Jeffrey Palermo. The Onion Architecture : part 1 (July 29, 2008). ↩
- Martin Fowler. Presentation Domain Data Layering. martinfowler.com (August 26, 2015). ↩
- Martin Fowler. *Patterns of Enterprise Application Architecture*. Addison-Wesley Professional, 2002. The author's book page; publisher and publication date from InformIT. ↩
- Alistair Cockburn. Hexagonal (Ports & Adapters) Architecture. September 4, 2005 version 0.9. Intent and The Pattern sections; the Adapter entry under Related Patterns. ↩
- Jeffrey Palermo. The Onion Architecture : part 3 (August 4, 2008). Key tenets of Onion Architecture. ↩
- Robert C. Martin. Clean Architecture: A Craftsman's Guide to Software Structure and Design. Prentice Hall, 2017. Google Books. ↩
- Dino Esposito. "Cutting Edge: Better Web Forms with the MVP Pattern". MSDN Magazine 25(9) (September 2010). Microsoft Learn archive. MVP and MVVM section. ↩
- John Gossman. Advantages and disadvantages of M-V-VM (2006). Full article. ↩
- Dino Esposito. "Cutting Edge: Better Web Forms with the MVP Pattern". MSDN Magazine 25(9) (September 2010). Microsoft Learn archive. Postback section. ↩