Model–View–Controller (MVC) is a type of computer user interface that separates the representation of information from the user's interaction with it. The model consists of application data and business rules, and the controller mediates input, converting it to commands for the model or view. 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 pie chart for
management and a tabular view for accountants.
Models. Model objects are the parts of the application
that implement the logic for the application s data domain. Often, model
objects retrieve and store model state in a database. For example, a
Product object might retrieve information from a database, operate on
it, and then write updated information back to a Products table in Database.
Views. Views are the components that display the
application s user interface (UI). Typically, this UI is created from
the model data. An example would be an edit view of a Products table
that displays text boxes, drop-down lists, and check boxes based on the
current state of a Products object.
Controllers. Controllers are the components that handle
user interaction, work with the model, and ultimately select a view to
render that displays UI. In an MVC application, the view only displays
information; the controller handles and responds to user input and
interaction. For example, the controller handles query-string values,
and passes these values to the model, which in turn queries the database
by using the values.