Model-view-controller (MVC) is an architectural pattern, which at the same time is also a Multitier architecture, used in software engineering. In complex computer applications that present a large amount of data to the user, a developer often wishes to separate data (model) and user interface (view) concerns, so that changes to the user interface will not affect data handling, and that the data can be reorganized without changing the user interface. The model-view-controller solves this problem by decoupling data access and business logic from data presentation and user interaction, by introducing an intermediate component: the controller.
The pattern was first described in 19791 by Trygve Reenskaug, then working on Smalltalk at Xerox research labs. The original implementation is described in depth in the influential paper Applications Programming in Smalltalk-80(TM):How to use Model-View-Controller.
ActionScript Implementations
- ARP Usable with AIR, Flex, and Flash
- Cairngorm Usable with AIR, and Flex
- PureMVC Suitable for use with AIR, Flex, Flash, and any platform running AS3 (no non-native class dependencies)
- VEGAS Usage with AIR, Flex, Flash CS3 (see the VEGAS MVC example in the SVN repository of the project)
Pattern Description
It is common to split an application into separate layers: presentation (UI), domain logic, and data access. In MVC the presentation layer is further separated into view and controller. MVC encompasses more of the architecture of an application than is typical for a design pattern.
- Model
- The domain-specific representation of the information on which the application operates. Domain logic adds meaning to raw data (e.g., calculating whether today is the user's birthday, or the totals, taxes, and shipping charges for shopping cart items). Many applications use a persistent storage mechanism (such as a database) to store data. MVC does not specifically mention the data access layer because it is understood to be underneath or encapsulated by the Model.
- View
- Renders the model into a form suitable for interaction, typically a user interface element. Multiple views can exist for a single model for different purposes.
- Controller
- Processes and responds to events, typically user actions, and may invoke changes on the model.
MVC is often seen in web applications, where the view is the actual HTML page, and the controller is the code that gathers dynamic data and generates the content within the HTML. Finally, the model is represented by the actual content, usually stored in a database or XML files.
Though MVC comes in different flavors, control flow generally works as follows:
- The user interacts with the user interface in some way (e.g., presses a button).
- A controller handles the input event from the user interface, often via a registered handler or callback.
- The controller accesses the model, possibly updating it in a way appropriate to the user's action (e.g., controller updates user's Shopping cart).
- A view uses the model (indirectly) to generate an appropriate user interface (e.g., the view produces a screen listing the shopping cart contents). The view gets its own data from the model. The model has no direct knowledge of the view.
- The user interface waits for further user interactions, which begins the cycle a new.
By decoupling models and views, MVC helps to reduce the complexity in architectural design, and to increase flexibility and reuse.





