Home

MVC

Model-View-Controller (MVC) is a software architectural pattern that organizes an application into three interconnected components: the Model, the View, and the Controller. The Model represents the data and the business rules associated with that data. The View renders the user interface and presents data from the Model. The Controller handles user input, coordinates updates to the Model, and selects the appropriate View for response.

In typical MVC use, the View reads data from the Model to display to the user, often

MVC originated in the 1970s with Trygve Reenskaug at Xerox PARC and was popularized by Smalltalk environments.

Advantages of MVC include improved modularity, testability, and parallel development, as well as easier maintenance by

observing
the
Model
for
changes.
The
Controller
receives
input
such
as
user
actions
or
requests,
updates
the
Model
accordingly,
and
may
switch
the
View
to
reflect
the
new
state.
The
pattern
encourages
separation
of
concerns
by
isolating
data
and
logic
from
the
presentation
layer.
It
has
influenced
many
web
and
application
frameworks,
including
Ruby
on
Rails,
ASP.NET
MVC,
and
Django's
MTV
variant.
Variants
and
related
patterns
exist,
such
as
Model-View-Presenter
(MVP)
and
Model-View-ViewModel
(MVVM),
which
adjust
the
direction
of
interaction
between
components.
isolating
concerns.
Drawbacks
can
include
added
complexity
for
small
or
simple
interfaces,
potential
for
controllers
to
become
large
or
“fat”,
and
inconsistent
interpretations
of
the
pattern
across
frameworks.
Migrating
legacy
code
to
MVC
can
also
be
challenging
if
the
original
design
did
not
separate
concerns
clearly.