Model View Controller As An Aggregate Design Pattern

Model-View-Controller is not a Design Pattern itself, but is made up of a number of smaller design patterns. The views form a tree using the CompositePattern. The relationship between views and models is the ObserverPattern. The controllers are strategies of the views. DocumentView is more popular now than true ModelViewController, and it consists of Composite and Observer, but not Strategy.

Although CompositePattern, ObserverPattern and StrategyPattern are the core of ModelViewController, it uses more patterns. The model is often a Mediator (The Smalltalk Browser is a good example). The tree of views often contains Decorators to add properties to views. A view often uses an Adaptor to convert the model to a standard interface that the view can use. Views create controllers using a Factory Method.

ModelViewController is hard to learn because it is complex. It is much easier to understand if you learn the patterns one at a time and then fit them together.

-RalphJohnson Aggregrate Design Patterns also known as CompoundPatterns (JohnVlissides) or CompositeDesignPatterns (DirkRiehle)


I find that I often apply ModelViewController recursively -- for example, the view component of a user interface builder has a ModelViewController within itself, such that the view component of the user interface builder is the model of a finer-grained ModelViewController that allows the user to manipulate it. ModelViewController seems to recur, for me, in each layer of each FourLayerArchitecture I work with. Is there a category for patterns that apply themselves recursively? It could also be an example of "If the only tool you have is a hammer, everything is a nail". --TomStambaugh

This has been discussed as RecursiveModelViewController


There have been articles in JavaWorld (http://www.javaworld.com) and in an English software magazine called ApplicationDevelopmentAdvisor? about this. It's called HierarchicalModelViewController. --AdewaleOshineye


See also: CompositePattern, ObserverPattern, StrategyPattern, MediatorPattern



EditText of this page (last edited May 27, 2010) or FindPage with title or text search