Pages

Search This Blog

Sunday, February 19, 2012

Model/view/controller (MVC) is a software architecture,[1] currently considered an architectural pattern used in software engineering. The pattern isolates "domain logic" (the application logic for the user) from the user interface (input and presentation), permitting independent development, testing and maintenance of each (separation of concerns).
Use of the Model/View/Controller (MVC) pattern results in
applications that separate the different aspects of the application
(input logic, business logic, and UI logic), while providing a loose
coupling between these elements.

Concepts

The model manages the behavior and data of the application
domain, responds to requests for information about its state (usually
from the view), and responds to instructions to change state (usually
from the controller). In event-driven systems, the model notifies
observers (usually views) when the information changes so that they can
react.
The view renders the model into a form suitable for
interaction, typically a user interface element. Multiple views can
exist for a single model for different purposes. A view port typically
has a one to one correspondence with a display surface and knows how to
render to it.
The controller receives user input and initiates a response by
making calls on model objects. A controller accepts input from the user
and instructs the model and a view port to perform actions based on
that input.

An MVC application may be a collection of model/view/controller triads, each responsible for a different UI element. The Swing GUI system, for example, models almost all interface components as individual MVC systems.

MVC is often seen in web applications where the view is the HTML or
XHTML generated by the application. The controller receives GET or POST
input and decides what to do with it, handing over to domain objects
(i.e. the model) that contain the business rules
and know how to carry out specific tasks such as processing a new
subscription, and which hand control to (X)HTML-generating components
such as templating engines, XML pipelines, Ajax callbacks, etc.
The model is not necessarily merely a database; the 'model' in MVC is both
the data and the business/domain logic needed to manipulate the data in
the application. Many applications use a persistent storage mechanism
such as a database to store data. MVC does not specifically mention the
data access layer because it is understood to be underneath or
encapsulated by the model. Models are not data access objects; however, in very simple applications that have little domain logic there is no real distinction to be made. Active Record is an accepted design pattern that merges domain logic and data access code — a model which knows how to persist itself.

For More Details Please Visit: http://en.wikipedia.org/wiki/Model-view-controller