liveBook · Manning

Model-view-update

As explained in .NET MAUI in Action

MVU is a unidirectional UI architecture in which an immutable model is replaced by updates and the view renders the resulting state.

Model-View-Update (MVU), also called the Elm Architecture, is a unidirectional UI pattern. An immutable Model holds application state, the View renders it, and an Update function creates a new Model after user input. section 1.5

The MVU cycle follows three steps:

  • The Model represents the whole application state. section 1.5
  • The View displays the current Model and dispatches changes caused by user input. section 1.5
  • The Update function receives those changes and produces a new Model instead of mutating the existing one. section 1.5

In .NET MAUI, MVU is an alternative to MVVM and suits developers who prefer defining UI in C# rather than XAML. Support requires a library such as Comet for C# or Fabulous for F#; it was experimental at the stated time and lacked first-party tooling. section 1.5 section 9.3.5

Figure 1.10 In the MVU pattern, the Model represents the whole-application state. Changes in the Model are sent to the View, which changes what is displayed when the Model is updated. Changes in the View are dispatched to an Update function, which generates a new Model.

Trace the complete MVU loop from whole-application state through rendering and input dispatch to a newly generated Model. section 1.5

How .NET MAUI in Action covers it

How deep it goes
Defines immutable state and one-way flow, but stops short of implementation guidance.
Examples
Illustrates MVU with a state-flow diagram and names Comet and Fabulous as .NET MAUI implementations.
What it assumes
Assumes familiarity with .NET MAUI UI development and contrasts MVU with MVVM.
What you can do after
Evaluate MVU against MVVM when choosing a .NET MAUI UI architecture.
How it connects
Connects MVU with the Elm Architecture, MVVM, React, XAML, and .NET MAUI.

Also explained in

Compare how 2 books explain model-view-update →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of .NET MAUI in Action. The section links point to the parts of the book it draws on.