Saltar apartados

Model - View - Controller

If you wish more information on the Model-Sight-Controller can visit the following pages:

The information that show to continuation has extraido of are pages.

Model Seen Controller (MVC) is a style of architecture of software that separates the data of an application, the interface of user, and the logic of control in three distinct components.

Treat of a very mature model and that has showed his validity along the years in all type of applications, and on crowd of languages and platforms of development.

  • The Model that contains a representation of the data that handles the system, his logic of business, and his mechanisms of persistence.
  • The Sight, or interface of user, that composes the information that send to the client and the mechanisms interaction with this.
  • The Controller, that acts like intermediary between the Model and the Sight, gestionando the flow of information between them and the transformations to adapt the data to the needs of each one.

  1. The model is the manager of:
  • Access to the layer of storage of data. The ideal is that the model are independent of the system of storage.
  • It defines the rules of business (the functionality of the system). An example of rule can be: "If the commodity asked is not in the warehouse, consult the time of standard delivery of the provider".
  • It carries a register of the sights and controllers of the system.
  • If we are in front of an active model, will notify to the sights the changes that in the data can produce an external agent (for example, a file by batches that updates the data, a timer that unchains an insertion, etc.).

  1. The controller is responsible of:
  • It receives the events of entrance (a click, a change in a field of text, etc.).
  • It contains rules of management of events, of the type "IF Event Z, then Action W". These actions can suppose requests to the model or to the sights. One of these requests to the sights can be a call to the method "Update()". A request to the model can be "Obtain_time_of_delivery ( new_order_of_sale )".

  1. The sights are responsible of:
  • Receive data of the model and the sample to the user.
  • They have a register of his controller associated (usually because besides it instance).
  • They can give the service of "Update()", so that it was invoked by the controller or by the model (when it is an active model that informs of the changes in the data produced by other agents).

The flow that follows the control generally is the following:

Esquema del flujo de una aplicación MVC

  1. The user interactúa with the interface of user of some form (for example, the user presses a button, link, etc.)
  2. The controller receives (by part of the objects of the interface-sight) the notification of the action requested by the user. The controller gestiona the event that arrives, frequently through an agent of events (handler) or callback.
  3. The controller accesses to the model, updating it, possibly modifying it of suitable form to the action requested by the user (for example, the controller updates the car of the purchase of the user). The complex controllers are often structured using a pattern of commando that encapsula the actions and simplifies his extension.
  4. The controller delegates to the objects of the sight the task to deploy the interface of user. The sight obtains his data of the model to generate the appropriate interface for the user where reflects the changes in the model (for example, produces a listing of the content of the car of the purchase). The model does not have to have direct knowledge on the sight. However, could use the Observant pattern to cater some indirección between the model and the sight, allowing to the model notify to the interested of any change. An object seen can register with the model and expect to the changes, but even so the model in himself same follows without knowing at all of the sight. The controller does not happen objects of command (the model) in sight although it can give the order in sight so that it update . Note: In some implementations the sight does not have direct access to the model, leaving that the controller send the data of the model in sight.
  5. The interface of user expects new interactions of the user, beginning the cycle again.

Computing service ASP.NET MVC 2 Framework


Universidad de Alicante
Carretera de San Vicente del Raspeig s/n
03690 San Vicente del Raspeig
Alicante (Spain)

Tel: (+34) 96 590 3400

Fax: (+34) 96 590 3464

For further information: informacio@ua.es, and for enquiries on this web server: webmaster@ua.es

Carretera San Vicente del Raspeig s/n - 03690 San Vicente del Raspeig - Alicante - Tel. 96 590 3400 - Fax 96 590 3464