Difference between revisions of "Model-view-controller"
Karl Jones (Talk | contribs) (→Ajax) |
Karl Jones (Talk | contribs) (→External links) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 47: | Line 47: | ||
== Ajax == | == Ajax == | ||
− | See also [[Ajax (programming)]] | + | See also [[Ajax (programming)]], which is commonly used with MVC-base [[Web application|web applications]]. |
== See also == | == See also == | ||
Line 60: | Line 60: | ||
* [[Observer pattern]] | * [[Observer pattern]] | ||
* [[Server (computing)]] | * [[Server (computing)]] | ||
+ | * [[Software design pattern]] | ||
* [[Software development]] | * [[Software development]] | ||
* [[Software development process]] | * [[Software development process]] | ||
* [[Web application]] | * [[Web application]] | ||
* [[Web application framework]] | * [[Web application framework]] | ||
+ | * [[Yii]] | ||
== External links == | == External links == | ||
* [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller Model–view–controller] @ Wikipedia | * [https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller Model–view–controller] @ Wikipedia | ||
+ | |||
+ | [[Category:Computer science]] | ||
+ | [[Category:Models]] | ||
+ | [[Category:Software design patterns]] | ||
+ | [[Category:Software development]] | ||
+ | [[Category:Structures]] | ||
+ | [[Category:Web design and development]] |
Latest revision as of 03:38, 21 April 2016
Model–view–controller (MVC) is a software architectural pattern for implementing user interfaces.
Contents
Description
MVC divides a given software application into three interconnected parts, so as to separate internal representations of information from the ways that information is presented to or accepted from the user.
As with other software patterns, MVC expresses the "core of the solution" to a problem while allowing it to be adapted for each system. Particular MVC architectures can vary significantly from the tradition model.
Components
The traditional MVC has three components:
- The model describes the behavior of the application in terms of its problem domain, independent of the user interface.
- The model directly manages the data, logic and rules of the application
- The view generates output for the user
- Multiple views of the same information are possible
- The controller accepts input and converts it to commands for the model or view.
Interactions
In addition to dividing the application into three kinds of components, the model–view–controller design defines the interactions between them.
A controller can send commands to the model to update the model's state (e.g., editing a document). It can also send commands to its associated view to change the view's presentation of the model (e.g., by scrolling through a document).
A model stores data that is retrieved by the controller and displayed in the view. Whenever there is a change to the data it is updated by the controller.
A view requests information from the model that it uses to generate an output representation to the user.
MVC in web applications
Although originally developed for desktop computing, model–view–controller has been widely adopted as an architecture for web applications in major programming languages.
Frameworks
Several commercial and noncommercial web application frameworks have been created that enforce the pattern.
These frameworks vary in their interpretations, mainly in the way that the MVC responsibilities are divided between the client and server.
History
Early web MVC frameworks took a thin client approach that placed almost the entire model, view and controller logic on the server.
In this approach, the client sends either hyperlink requests or form requests with user data to the controller, and then receives a complete and updated web page (or other document) from the view; the model exists entirely on the server.
As client-side technologies have matured, frameworks such as AngularJS, Ember.js, JavaScriptMVC and Backbone.js have been created that allow the MVC components to execute partly on the client.
Ajax
See also Ajax (programming), which is commonly used with MVC-base web applications.
See also
- Ajax (programming)
- AngularJS
- Architectural pattern
- Backbone.js
- Computer science
- Design pattern
- Model
- Observer pattern
- Server (computing)
- Software design pattern
- Software development
- Software development process
- Web application
- Web application framework
- Yii
External links
- Model–view–controller @ Wikipedia