Most of everyday's applications share a common fact: these are user-interaction-oriented. What does it mean? That is a computer program does things when a person (the user) does something like left-clicking mouse or writing a word in a form field.

Obviously, not every application does things when user interacts with it. Other operations are done when the program logic interacts itself being those understood as "doing things" too. Summarizing: sometimes user is a real-life person or there are cases in which this is the application.

_Model-View-Controller_ is a software meta-paradigm (it is not a software design pattern) which slides an application in three layers thinking on correctly-separating every part of a user interface-based application and, today, networked application and services (where the user can be human or a computer entity).

A three-layered paradigm

Why three?

Because every computing program has three problems to solve:
  • Access and modify a data store (commonly a database) or perform some kind of calculations, processing or evaluations: model
  • Show a user-friendly graphical interface and by-pass actions done by the user to the logic: view
  • Bidirectionally-coordinate the changes in the model and/or the view: controller.

Then, for every view there is a controller and a model which are managing it.

For example, imagine a web user registration form:
  • The model is the logic which registers users in the database.
  • The view is the XHTML page and client-side event handling.
  • The controller is the one which notifies the page about changes in the database and/or actions which may change it requested from the page (actually, web-programming paradigm is stateless, so no asynchronous notifications from the model to the view can be performed).

Last edited Apr 7, 2010 at 3:49 PM by MFidemraizer, version 3


No comments yet.