Tuesday, November 13, 2007

MODEL VIEW CONTROLLER
The model is responsible for maintaining the state of the application. Sometimes
this state is transient, lasting for just a couple of interactions with the
user. Sometimes the state is permanent and will be stored outside the application,
often in a database.

The view is responsible for generating a user interface, normally based on
data in the model. For example, an online store will have a list of products
to be displayed on a catalog screen. This list will be accessible via the model,
but it will be a view that accesses the list from the model and formats it for
the end user. Although the view may present the user with various ways of
inputting data, the view itself never handles incoming data. The view’s work
is done once the data is displayed. There may well be many views that access
the same model data, often for different purposes. In the online store, there’ll be a view that displays product information on a catalog page and another set
of views used by administrators to add and edit products.


Controllers orchestrate the application. Controllers receive events from the
outside world (normally user input), interact with the model, and display an
appropriate view to the user.

No comments: