0% found this document useful (0 votes)
14 views3 pages

Model View Controller

The document discusses the Model-View-Controller (MVC) architectural pattern used in software development, particularly for user interfaces. It outlines the roles of the model, view, and controller, their interactions, and the evolution of MVC in web applications. Additionally, it highlights the historical context of MVC's creation and its adoption across various programming languages and frameworks.

Uploaded by

lwangastowa354
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views3 pages

Model View Controller

The document discusses the Model-View-Controller (MVC) architectural pattern used in software development, particularly for user interfaces. It outlines the roles of the model, view, and controller, their interactions, and the evolution of MVC in web applications. Additionally, it highlights the historical context of MVC's creation and its adoption across various programming languages and frameworks.

Uploaded by

lwangastowa354
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Search Wikipedia Search Donate Create account Log in

1. How often would you like to donate?

The internet we were promised Once Monthly Annual


October 7: An important update for readers in France. Support Wikipedia year-round
You deserve an explanation, so please don't skip this 1-minute read. It's Tuesday, October 7, and our fundraiser won't last long. 2. Please select an amount (EUR)
The average donation in France is
If you've lost count of how many times you've visited Wikipedia this year, we hope that means it's given you at least €2.75 of around €8.
knowledge. Please join the 2% of readers who give what they can to help keep this valuable resource ad-free, up-to-date, and
€2.75 €15 €25
available for all.
€50 €100 €250
After nearly 25 years, Wikipedia is still the internet we were promised—an oasis of free and collaborative knowledge. By
visiting Wikipedia today, you're choosing a free and fair internet: a space where you can find facts you need without being €500 Other

distracted by ads or the agendas of wealthy owners. 3. Please select a payment method

Most readers don't donate, so your gift matters. If Wikipedia provides you with €2.75 of knowledge, please donate €2.75 right
now—or consider a monthly gift to help all year long. Thank you.
Direct
Debit
Proud host of Wikipedia and its sister sites (SEPA)

Problems donating? | Frequently asked questions | Other ways to give | I already donated
Continue
We never sell your information. By submitting, you are agreeing to our donor privacy policy and to sharing your information with the Wikimedia Foundation and its service providers in the USA
and elsewhere. Donations to the Wikimedia Foundation are likely not tax-deductible outside the USA. If you make a recurring donation, you will be debited by the Wikimedia Foundation until you
notify us to stop. We’ll send you an email which will include a link to easy cancellation instructions. Maybe later

Model–view–controller 44 languages

Contents hide Article Talk Read Edit View history Tools Appearance hide

(Top) From Wikipedia, the free encyclopedia Text

History
Model–view–controller (MVC) is a software architectural pattern[1] commonly used for developing Small
Components
user interfaces that divides the related program logic into three interconnected elements. These Standard
Model elements are:
Large
View
the model, the internal representations of information
Controller Width
the view, the interface that presents information to and accepts it from the user
Interactions
the controller, the software linking the two.[2][3] Standard
Motivation
Traditionally used for desktop graphical user interfaces (GUIs), this pattern became popular for Wide
Use in web applications
designing web applications.[4] Popular programming languages have MVC frameworks that facilitate
See also Color (beta)
the implementation of the pattern. Diagram of interactions in
References
MVC's Smalltalk-80 Automatic
Bibliography interpretation
History ​[ edit ] Light

Dark
One of the seminal insights in the early development of graphical user interfaces, MVC became one of the first approaches to
describe and implement software constructs in terms of their responsibilities.[5]

Trygve Reenskaug created MVC while working on Smalltalk-79 as a visiting scientist at the Xerox Palo Alto Research Center (PARC)
in the late 1970s.[6][7][8]: 330 He wanted a pattern that could be used to structure any program where users interact with a large,
convoluted data set. His design initially had four parts: Model, view, thing, and editor. After discussing it with the other Smalltalk
developers, he and the rest of the group settled on model, view, and controller instead.[6]

In their final design, a model represents some part of the program purely and intuitively. A view is a visual representation of a model,
retrieving data from the model to display to the user and passing requests back and forth between the user and the model. A
controller is an organizational part of the user interface that lays out and coordinates multiple Views on the screen, and which receives
user input and sends the appropriate messages to its underlying Views. This design also includes an Editor as a specialized kind of
controller used to modify a particular view, and which is created through that view.[6]

Smalltalk-80 supports a version of MVC that evolved from this one.[6] It provides abstract view and controller classes as well
as various concrete subclasses of each that represent different generic widgets. In this scheme, a View represents some way of
displaying information to the user, and a controller represents some way for the user to interact with a view . A view is also
coupled to a model object, but the structure of that object is left up to the application programmer. The Smalltalk-80 environment also
includes an "MVC Inspector", a development tool for viewing the structure of a given model, view, and controller side-by-side.[9]

In 1988, an article in The Journal of Object Technology (JOT) by two ex-PARC employees presented MVC as a general "programming
paradigm and methodology" for Smalltalk-80 developers. However, their scheme differed from both Reenskaug et al.'s and that
presented by the Smalltalk-80 reference books. They defined a view as covering any graphical concern, with a controller being a
more abstract, generally invisible object that receives user input and interacts with one or many views and only one model.[10]

The MVC pattern subsequently evolved,[11] giving rise to variants such as hierarchical model–view–controller (HMVC), model–view–
adapter (MVA), model–view–presenter (MVP), model–view–viewmodel (MVVM), and others that adapted MVC to different contexts.

The use of the MVC pattern in web applications grew after the introduction of NeXT's WebObjects in 1996, which was originally
written in Objective-C (that borrowed heavily from Smalltalk) and helped enforce MVC principles. Later, the MVC pattern became
popular with Java developers when WebObjects was ported to Java. Later frameworks for Java, such as Spring (released in October
2002), continued the strong bond between Java and MVC.

In 2003, Martin Fowler published Patterns of Enterprise Application Architecture, which presented MVC as a pattern where an "input
controller" receives a request, sends the appropriate messages to a model object, takes a response from the model object, and
passes the response to the appropriate view for display.[8]: 56 This is close to the approach taken by the Ruby on Rails web application
framework (August 2004), which has the client send requests to the server via an in-browser view, these requests are handled by a
controller on the server, and the controller communicates with the appropriate model objects.[12] The Django framework (July 2005,
for Python) put forward a similar "model-template-view" (MTV) take on the pattern, in which a view retrieves data from models and
passes it to templates for display.[13] Both Rails and Django debuted with a strong emphasis on rapid deployment, which increased
MVC's popularity outside the traditional enterprise environment in which it has long been popular.

Components ​[ edit ]

Model ​[ edit ]

See also: Data model

The central component of the pattern. It is the application's dynamic data structure, independent of the user interface.[14] It directly
manages the data, logic and rules of the application. In Smalltalk-80, the design of a model type is left entirely to the programmer.[15]
With WebObjects, Rails, and Django, a model type typically represents a table in the application's database.[16][17][18] The model is
essential for keeping the data organized and consistent. It ensures that the application's data behaves according to the defined rules
and logic.

View ​[ edit ]

Any representation of information such as a chart, diagram or table. Multiple views of the same information are possible, such as a
bar chart for management and a tabular view for accountants.

In Smalltalk-80, a view is just a visual representation of a model, and does not handle user input.[19] With WebObjects, a view
represents a complete user interface element such as a menu or button, and does receive input from the user.[20] In both Smalltalk-80
and WebObjects, however, views are meant to be general-purpose and composable.[21][22]

With Rails and Django, the role of the view is played by HTML templates, so in their scheme a view specifies an in-browser user
interface rather than representing a user interface widget directly.[23][24] (Django opts to call this kind of object a "template" in light of
this.[25]) This approach puts relatively less emphasis on small, composable views; a typical Rails view has a one-to-one relationship
with a controller action.[26]

Smalltalk-80 views communicate with both a model and a controller,[27] whereas with WebObjects, a view talks only to a controller,
which then talks to a model.[28] With Rails and Django, a view/template is used by a controller/view when preparing a response to the
client.[29][30]
Controller ​[ edit ]

Accepts input and converts it to commands for the model or view.[31]

A Smalltalk-80 controller handles user input events, such as button presses or mouse
movement.[32] At any given time, each controller has one associated view and model,
although one model object may hear from many different controllers. Only one controller, the
"active" controller, receives user input at any given time; a global window manager object is
responsible for setting the current active controller. If user input prompts a change in a model,
the controller will signal the model to change, but the model is then responsible for telling its
views to update.[33]

In WebObjects, the views handle user input, and the controller mediates between the views
and the models. There may be only one controller per application, or one controller per
window. Much of the application-specific logic is found in the controller.[34]

In Rails, requests arriving at the on-server application from the client are sent to a "router",
which maps the request to a specific method of a specific controller. Within that method, the
controller interacts with the request data and any relevant model objects and prepares a
response using a view. Conventionally, each view has an associated controller; for example, if
the application had a client view, it would typically have an associated Clients
controller as well. However, developers are free to make other kinds of controllers if they
wish.[35]
Django calls the object playing this role a "view" instead of a controller.[30] A Django view is a
function that receives a web request and returns a web response. It may use templates to
create the response.[36]

Interactions ​[ edit ]

In addition to dividing the application into a model, a view and a controller component, the
MVC design pattern defines the interactions between these three components :[37]

The model is responsible for managing the data of the application. It receives user input
from the controller.
The view renders presentation of the model in a particular format.
The controller responds to the user input and performs interactions on the data model
objects. The controller receives the input, optionally validates it and then passes the input
to the model.

As with other software patterns, MVC expresses the "core of the solution" to a problem while
allowing it to be adapted for each system.[38] Particular MVC designs can vary significantly
from the traditional description here.[39]

Motivation ​[ edit ]

As Alan Kay wrote in 2003, the original motivation behind the MVC was to allow creation of a
graphical interface for any object.[40] That was outlined in detail in Richard Pawson's book UML class diagram of an example
Naked Objects.[40] controller in MVC architecture

Trygve Reenskaug, originator of MVC at PARC, has written that "MVC was conceived as a
general solution to the problem of users controlling a large and complex data set."[6]

In their 1991 guide Inside Smalltalk, Carleton University computer science professors Wilf LaLonde and John Pugh described the
advantages of Smalltalk-80-style MVC as:

independence of presentation and data, e.g. multiple views on one model simultaneously,
composable presentation widgets, e.g. one view used as a subview of another,
switchable input modes, by swapping one controller out for another during runtime, and
independence of input and output processing, via the separate responsibilities of controllers and views.[41]

Use in web applications ​[ edit ]

Although originally developed for desktop computing, MVC has been widely adopted as a design for World Wide Web applications in
major programming languages. Several web frameworks have been created that enforce the pattern. These software frameworks
vary in their interpretations, mainly in the way that the MVC responsibilities are divided between the client and server.[42] Early MVC
frameworks took a thin client approach that placed almost the entire model, view and controller logic on the server. In this approach,
the client sends hyperlink requests or form submissions to the controller and then receives a complete and updated web page (or
other document) from the view; the model exists entirely on the server.[42] Later frameworks have allowed the MVC components to
execute partly on the client, using Ajax to synchronize data.

See also ​[ edit ]

Action–domain–responder Model–view–viewmodel
Bistro Framework Multitier architecture
Entity–control–boundary pattern Observer pattern
Hierarchical model–view–controller Presentation–abstraction–control
Model–view–adapter Separation of concerns
Model–view–presenter Strategy pattern

References ​[ edit ]

1. ^ "The Principles of Clean Architecture by Uncle Bob Martin" . 21. ^ LaLonde, Wilf R.; Pugh, John R. (1991). Inside Smalltalk .
YouTube. 15 December 2015. U.S.A.: Prentice-Hall Inc. p. 8. ISBN 0-13-467309-3. "[MVC]
2. ^ Reenskaug, Trygve; Coplien, James O. (20 March 2009). "The permits views to be used as parts for assembly into larger units;
DCI Architecture: A New Vision of Object-Oriented new kinds of views can be constructed using existing views as
Programming" . Artima Developer. Archived from the original subviews."
on 23 March 2009. Retrieved 3 August 2019. "More deeply, the 22. ^ WebObjects System Overview (PDF). Cupertino, CA: Apple
framework exists to separate the representation of information Computer, Inc. May 2001. p. 28. "View objects tend to be very
from user interaction." reusable and so provide consistency between applications."
3. ^ Burbeck (1992): "... the user input, the modeling of the external 23. ^ "Action View Overview" . Rails Guides. Retrieved October 27,
world, and the visual feedback to the user are explicitly separated 2022. "Action View templates are written using embedded Ruby
and handled by three types of object." in tags mingled with HTML."
4. ^ Davis, Ian. "What Are The Benefits of MVC?" . Internet 24. ^ "Templates" . Django Documentation. Retrieved October 27,
Alchemy. Retrieved 2016-11-29. 2022. "A template contains the static parts of the desired HTML
5. ^ Model–View–Controller History . C2.com (2012-05-11). output as well as some special syntax describing how dynamic
Retrieved on 2013-12-09. content will be inserted."
6. ^ a b c d e Notes and Historical documents from Trygve 25. ^ "Django FAQ: Django appears to be a MVC framework, but you
Reenskaug, inventor of MVC. call the Controller the "view", and the View the "template". How
7. ^ "A note on DynaBook requirements", Trygve Reenskaug, 22 come you don't use the standard names?" . Retrieved
March 1979, SysReq.pdf . October 27, 2022.
8. ^ a b Fowler, Martin (2003). Patterns of Enterprise Application 26. ^ "Action View Overview" . Rails Guides. Retrieved October 27,
Architecture. Pearson Education, Inc. ISBN 0-321-12742-0. 2022. "Typically, the views share their name with the associated
9. ^ Goldberg, Adele (1984). Smalltalk-80: The Interactive controller action..."
Programming Environment. Addison-Wesley. ISBN 0-201-11372- 27. ^ LaLonde, Wilf R.; Pugh, John R. (1991). Inside Smalltalk .
4. U.S.A.: Prentice-Hall Inc. p. 9. ISBN 0-13-467309-3. "...the view
10. ^ Krasner, Glenn E.; Pope, Stephen T. (Aug–Sep 1988). "A knows explicitly about the model and the controller."
cookbook for using the model–view controller user interface 28. ^ WebObjects System Overview (PDF). Cupertino, CA: Apple
paradigm in Smalltalk-80" . The Journal of Object Technology. 1 Computer, Inc. May 2001. p. 28. "Acting as a mediator between
(3). SIGS Publications: 26–49. Also published as "A Description Model objects and View objects in an application is a Controller
of the Model–View–Controller User Interface Paradigm in the object."
Smalltalk-80 System " (Report), ParcPlace Systems; Retrieved 29. ^ "Action View Overview" . Rails Guides. Retrieved October 27,
2012-06-05. 2022. "In Rails, web requests are handled by action controller and
11. ^ The evolution of MVC and other UI architectures from Martin action view. Typically, action controller is concerned with
Fowler. communicating with the database and performing CRUD actions
12. ^ "Ruby on Rails Guides" . Retrieved March 19, 2022. where necessary. Action View is then responsible for compiling
13. ^ "Django FAQ: Django appears to be a MVC framework, but you the response.

call the Controller the "view", and the View the "template". How 30. ^ a b "Django FAQ: Django appears to be a MVC framework, but
come you don't use the standard names?" . Retrieved March 19, you call the Controller the "view", and the View the "template".
2022. How come you don't use the standard names?" . Retrieved

14. ^ Burbeck, Steve (1992) Applications Programming in Smalltalk- October 27, 2022. "In Django, a 'view' describes which data is

80:How to use Model–View–Controller (MVC) presented, but a view normally delegates to a template, which
describes how the data is presented."
15. ^ LaLonde, Wilf R.; Pugh, John R. (1991). Inside Smalltalk .
U.S.A.: Prentice-Hall Inc. p. 8. ISBN 0-13-467309-3. "The model 31. ^ Simple Example of MVC (Model–View–Controller) Architectural

can be any object without restriction." Pattern for Abstraction

16. ^ WebObjects System Overview (PDF). Cupertino, CA: Apple 32. ^ LaLonde, Wilf R.; Pugh, John R. (1991). Inside Smalltalk .

Computer, Inc. May 2001. p. 28. "In WebObjects, a model U.S.A.: Prentice-Hall Inc. p. 8. ISBN 0-13-467309-3. "The

establishes and maintains a correspondence between an controller is responsible for interfacing between the user and the

enterprise object class and data stored in a relational database." model/view. It interprets keyboard characters along with mouse
movements and clicking."
17. ^ "Active Record Basics" . Rails Guides. Retrieved October 27,
2022. "This will create a Product model, mapped to a products 33. ^ LaLonde, Wilf R.; Pugh, John R. (1991). Inside Smalltalk .

table at the database." U.S.A.: Prentice-Hall Inc. p. 11. ISBN 0-13-467309-3.

18. ^ "Models" . Django Documentation. Retrieved October 27, 34. ^ WebObjects System Overview (PDF). Cupertino, CA: Apple

2022. "Generally, each model maps to a single database table." Computer, Inc. May 2001. p. 28.

19. ^ LaLonde, Wilf R.; Pugh, John R. (1991). Inside Smalltalk . 35. ^ "Action View Overview" . Rails Guides. Retrieved October 27,

U.S.A.: Prentice-Hall Inc. p. 8. ISBN 0-13-467309-3. "The view is 2022. "Typically, the views share their name with the associated

responsible for providing a visual representation of the object." controller action..."

20. ^ WebObjects System Overview (PDF). Cupertino, CA: Apple


36. ^ "Writing views" . Django Documentation. Retrieved

Computer, Inc. May 2001. p. 28. "View objects represent things October 27, 2022.

visible on the user interface (windows, for example, or buttons)." 37. ^ Buschmann, Frank (1996) Pattern-Oriented Software
Architecture.

38. ^ Gamma, Erich et al. (1994) Design Patterns 41. ^ LaLonde, Wilf R.; Pugh, John R. (1991). Inside Smalltalk .
39. ^ Moore, Dana et al. (2007) Professional Rich Internet Vol. 2. U.S.A.: Prentice-Hall Inc. pp. 8–9. ISBN 0-13-467309-3.
Applications: Ajax and Beyond: "Since the origin of MVC, there 42. ^ a b Leff, Avraham; Rayfield, James T. (September 2001). Web-
have been many interpretations of the pattern. The concept has Application Development Using the Model/View/Controller Design
been adapted and applied in very different ways to a wide variety Pattern. IEEE Enterprise Distributed Object Computing
of systems and architectures." Conference. pp. 118–127.
40. ^ ab Alan Kay (23 May 2003). "is squeak really object
oriented ?" . Squeak Foundation mailing list. Retrieved
26 October 2021.

Bibliography ​[ edit ]

Wikibooks has a book on


the topic of: Computer
Science Design
Patterns/Model–view–
controller

v·t·e Software design patterns [show]

v·t·e Smalltalk programming language [show]

Categories: Architectural pattern (computer science) Software design patterns

This page was last edited on 26 July 2025, at 08:56 (UTC).

Text is available under the Creative Commons Attribution-ShareAlike 4.0 License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.

Privacy policy About Wikipedia Disclaimers Contact Wikipedia Code of Conduct Developers Statistics Cookie statement Mobile view

You might also like