Monday, November 7, 2011

MVC (Model–View–Controller)

Model-View-Controller (MVC) is a software architecture pattern which separates the representation of information from the user's interaction with it. The Model consists of application data, business rules, logic, and functions. A View can be any output representation of data, such as a chart or a diagram. Multiple views of the same data are possible, such as a bar chart for management and a tabular view for accountants. The controller mediates input, coverting it to commands for the Model or View.

In addition to dividing the application into three kinds of components, the Model-View-Controller (MVC) 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 notifies its associated Views and Controllers when there has been a change in its state. This notification allows the Views to produce updated output, and the Controllers to change the available set of commands. A passive implementation of MVC omits these notifications, because the application does not require them ot the software platform does not support them.
  • A View requests information from the Model that it needs for generating an output representation to the the user.

Quoted by Muhammad Idham Azhari from

No comments: