Main Page | See live article | Alphabetical index


Model-View-Controller (MVC) is a software architecture that separates an application's data model, user interface, and control logic into three distinct components so that modifications to the view component can be made with minimal impact to the model component. This is useful since models typically enjoy a fair degree of stability (owing to the stability of the domain being modeled), whereas user interface code usually undergoes frequent and sometimes dramatic change (owing to usability problems, the need to support growing classes of users, or simply the need to keep the application looking "fresh"). Separating the view from the model makes the model more robust, because the developer is less likely to "break" the model while reworking the view.

Though MVC comes in different flavors, control flow generally works as follows:

  1. user interacts with the user interface in some way (e.g., user presses a button)
  2. controller receives notification of the user action
  3. controller accesses the model, possibly updating it in a way appropriate to the user's action (e.g., controller updates user's shopping cart)
  4. controller delegates to the view for presentation
  5. view uses the model to generate an appropriate user interface (e.g., view produces a screen listing the shopping cart contents)
  6. user interface waits for further user interactions, which begin the cycle anew.

See also

External links