MVC Models

An MVC model encapsulates data that is rendered by viewports and manipulated by controllers. It serves as a computational approximation or abstraction of some real-world process or system. It captures not only the state of a process or system, but also how the system works. This makes it easy to use real-world modeling techniques in defining your models. For example, you might define a model that bridges a computational back-end with a GUI front-end. In this scenario, the model encapsulates the functionality of a computation engine or hardware system and acts as a liaison requesting the real services of the system it models.

All MVC models implement the ISubject interface so they can be observed by one or more viewports. Each type of model defines an interface for manipulating the data it encapsulates. Client code that interacts with the model, such as the controller, can either use the model’s interface directly or execute commands against the model. A command is an object that encapsulates an action to be performed against the model. Commands are the key to supporting undo and redo, which is a feature that can be easily added to MVC models.