model-view-viewmodel-controller

The model-view-viewmodel-controller software architecture pattern answers the question how to work with modular programming in systems that use JIT dependency injection. This pattern is based upon model–view–viewmodel architecture while borrowing the “widgetization” concept from Hierarchical model–view–controller.

Table of Contents

  1. Overview
  2. Models
  3. Controlers
  4. View Models
  5. Views
  6. Structures

Overview

This document will describe:

Controllers

The role of a controller is to handle input from a view model or another controller. Controllers will manipulate and verify the data before passing it to a model.

Models

The role of a model is to manage a state.

View Models

The role of a view model is to handle input from the view or a controller.

Views

The view is the structure, layout, and appearance of what a user sees on the screen.

Structures

Basic Structure

The basic structure diagram showcases the hierarchy and flow of communication between a controller, its model, its view models, and their views. Note that view models do not require a parent controller and can be self instantiated.

A basic model-view-viewmodel-controller structure

Expanded Structure

The expanded structure diagram showcases the hierarchy and flow of communication between two controllers, where one controller has children. Note that view models can have child view models and that data only flows from the parent view model to the child view model. Any communication up the hierarchy is passed directly to the parent controller.

An expanded model-view-viewmodel-controller structure