Talk:Model–view–controller/Archive 1
![]() | This is an archive of past discussions. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current talk page. |
Archive 1 | Archive 2 |
Image
The image http://upload.wikimedia.org/wikipedia/en/1/15/Mvc.gif is not exactly correct, the model doesnt not really update the view, it just publishes the events, the view or the controller takes care of actually updating the view (because its subscribed to the evenmodel of the model) . With the current text associated with the model image one could assume that the model has knowledge of the views, which it has not. Thats why there is such a high level of decoupling.
I'd go further and say that the controller also cannot update the view. What I mean is that the controller may issue an instruction telling the view to update itself but should not pass a model to a view. The view gets its own data: that's what MVC is all about ie finessing the standard presentation/domain separation with a further split in the presentation layer between controller and view.
Shouldn't we therefore say that the point about the Controller is that it can be exchanged. For example, the same view could display the data of an object using a Controller that responds to very few events, but it could be used as an editor using a conroller that converts keystroke events into changes to the model. --gschadow 19 Dec 2005
I've edited the page recently and either I messed up my submission or it's been edited. If there has been some editorial intervention can you mention it here: I don't want to appear to be spamming.
All this talk about "the model must not update the view" or "the controller must not pass the model to the view" is utter rubbish. The MVC design pattern merely identifies the responsibilities of each of the three modules, it does not specify how they are to be implemented, or how each module communicates with another, or how changes in the model make their way to the view. These are all implementation issues, and as such are not cast in stone but are entirely fluid, limited only by the skill of the programmer and the language beng used.
Provided that the implementation contains three distinct modules, each with the relevant responsibilities, then it is MVC, period. The fact that someone else's implementation may be different from yours does not make your implementation right and the other implementation wrong. They may be different, but they are both right.
Tony Marston 10:50, 19 June 2006 (UTC)
The key point about MVC is that view and controller are separate layers. If the controller were to pass model data to the view you would have to edit the controller every time you change the set of data displayed in view. Quite clearly the controller and view would not be separate and therefore it's not MVC.
Actually both the Controller and the View should have a reference to the model.
The View uses its reference to the model to extract data that is needs to display. The Controller uses its reference to the model to initiate updates based on the events it is processing.
In the Smalltalk implementation, the View is actually in charge of creating a pointer to the controller, telling the controller to point back to it, and registering itself with the model.
In some implentations, the controller actually updates the View using the Model. In others, the View automatically updates itself. An example of the latter is bound controls in ASP.Net. The controller calls the DataBind command on the view, which in turn updates itself using the model.
The only requirement is that the model doesn't know about the view or controller. It may expose generic event hooks, but that's about it. Otherwise the model cannot be used in other MVC triads.
-- J. Allen 20 July 2006
List of Frameworks
I'd like to suggest that the list of frameworks is not good content for this article, and that it would be more appropriate to link only to those frameworks which already merit their own article on Wikipedia. For the rest, a pointer to an external listing of software might be better. Szarka 15:02, 16 May 2006 (UTC)
Also, some of these aren't even MVC. I'm from a php background and, in this language at least, MVC is very poorly understood. People seem to get the presentation/domain split reasonably well but stop there. That's not MVC though. MVC goes further, breaking the presentation layer down into separate View & Controller layers.
Removed the paragraph about some PHP frameworks not being MVC -- better to remove the non-MVC ones from the list than to write a bad paragraph about it.
I agree on szarka´s note´s, today while i surfed the internet on freshmeat.net there was a new software project announced smutty [1] maybe someone of the moderators can add that to the article
--I think it is important to note how, or even if, the msjor frameworks support MVC. How is especially importent to me because the original MVC pattern was specific to a SmallTalk GUI toolkit. From what I've read, you literally could not violate the MVC pattern.
As for "separate View & Controller layers", that is not entirely correct. In the original MVC pattern they were implmented as seperate objects, but they were very tightly coupled. Each controller worked with one and only one view. Grauenwolf 17:15, 29 October 2006 (UTC)
AVC, the Application View Controller an alternative to MVC
Recently (Jan 2007), I developed a python module that makes the job of MVC in a fully automatic and transparent way. The connections between the controlled variables and the widgets are autogenerated by looking for matching names between widget names and variable names.
The application is completely unaware of the presence of the connected variables, it reads and writes them as normal variables. Only if the application requires to be immediately notified when a connected variable changes value, a notify handler must be added to the application.
For more info see the AVC home page [2].
Fabrizio Pollastri --Pollastri 09:09, 2 February 2007 (UTC)
Regarding .Net
ASP.NET does not strictly require a model. The developer has the option to create a model class, but may choose to forget it and have the event handlers in the controller perform any calculations and data persistence. That said, using a model to encapsulate business rules and database access is both possible and preferable.
To me this sounds inaccurate. First no language enforces the use of models, MVC frameworks usually do, therefore comparing .Net Runtimes versus Ruby on Rails seems like comparing Apples to oranges. Secondly .Net does support a model, it's called DataSets. To create custom models you create a Typed Dataset. It's actually done very well in .Net and is fully persisted and serializable.
If nobody has a compelling reason against this, then I will correct this section. —The preceding unsigned comment was added by Kibbled bits (talk • contribs).
I don't understand the implementation emphasis in the .net entries. MVC is a *logical* solution to a problem which the developer has to decide is correct or not. The implementation in various language can be demonstrated given an example, but to expect a platform to enforce design consideration on the developer is wishful. Harecourt 20:58, 8 May 2007 (UTC)
Can anyone make model part of the pattern description more understandable?
I can't! But I can tell you why it is hard to understand ... maybe that will help someone re-write it.
It says that the model layer shouldn't be confused with the domain layer, but doesn't explain what the domain layer is. It would be helpful if someone could tell us what the domain layer is (I have had a look but can't find anything on it). The next sentence talks about domain logic, saying that domain logic adds meaning to raw data, and then gives an example OK, but given that it is domain logic, and the domain layer shouldn't be confused with the model, is this something that the model should or shouldn't do? I would guess not. But to me it sounds like something the model should do, otherwise why give an example in this section? Confused? I am!
Leave this to the programmers. This article is already one ugly soup. Don't make it worse.
OK - hope that helps someone make this section less confusing. I would love to have a rock steady definition, in a topic where understanding the boundaries for these three terms is crucial + very hard. :-) Michaelmcandrew 23:24, 9 July 2007 (UTC)
- I agree the pattern description needs rewriting to make it more understandable. It also needs to explain how the Observer, Composite and Strategic Patterns are incorporated in the MVC-pattern. (As stated in the Gang of Four's "Design Patterns - Elements of Reusable Object-Oriented Software").
A nice real world example can be found here http://csis.pace.edu/~bergin/mvc/mvcgui.html 213.93.217.159 16:12, 14 July 2007 (UTC)
-- It is very confusing. The model is the domain layer (the term comes from "domain model"). Some people seem to think of data access is part of the model too but everyone will agree that this is where domain logic happens. —Preceding unsigned comment added by 212.159.44.241 (talk) 18:10, August 30, 2007 (UTC)
Perl MVC -- Maypole? Catalyst needs editing.
Howdy. I'm not an expert on whether Maypole is a popular enough distribution to include in the list of Perl MVC suites, but am enough of an advocate to think that the languge needs as wide an array of distribution options as other languages in the list (PHP, Python and even -Ruby- have multiples).
Additionally, what's written there for Catalyst is mighty Advert. I would hope at the least the package mentions would point to CPAN for reference. As an example: The difference between DBIx::Class and Class::DBI is not immediately apparent even to those familiar with the language (or at least myself) and reference would clarify.Ogre lawless 07:47, 25 July 2007 (UTC)
View vs Controller in web applications
The part in bold does not make sense to me as this is invoking change by calling on the model. When the data is gathered it is outputted into HTML which is then rendered by the browser. Would this not be considered the job of the controller?
"View: Renders the model into a form suitable for interaction, typically a user interface element. MVC is often seen in web applications, where the view is the HTML page and the code which gathers dynamic data for the page. "
"Controller: Responds to events, typically user actions, and invokes changes on the model and perhaps the view."
Wikvin 18:25, 13 July 2006 (UTC)
Views are read-only. They would not manipulate model state. As you say, that's the job of the controller.
-Noel Darlow
I think this is a huge area of confusion for many people. I would suggest including some specific comparisons between m/v/c, as Noel did in his response, which was very helpful. the current comparison/definition section is confusing, especially with the high repitition of 'domain' without much explanation. it makes me think that 'domain' is some buzzword i should know about if I am truly understanding the article. I am scared to edit the page myself, but I hope this reaction helps! -red daly (atgmail.com if need be)
The long list of frameworks for web applications poses the question - Why do we need that many of them? Don't they provide the help for constructing the same type of the application? How they are different? What are the advantages of using one framework comparing to others? Which one is the champion?
David Rozenberg
David Rozenberg question is what made me read this far. With any framework, "the devil's in the details" which is something you don't find out without significant study AND experience. It takes so long to plumb the depths of the frameworks available that no-one can learn the details of them all. If anyone knows where to find people who want to discuss these differences knowledgeably and politely without getting zealous about any one solution, let me know. --GlenPeterson 17:27, 8 November 2007 (UTC)
MVC2
The DragonPHP uses MVC2, but what is that? They just link (back) to wikipedia (to this article). And regarding PHP I don't think that there's a need for versioning. AFAIK, Java has MVC1 and MVC2 due to the JSP and Servlet difference. PAStheLoD (talk) 21:22, 14 February 2008 (UTC)
Problems with the article?
See this article:
- I don't think the wikipedia page is a particularly strong reference for learnign anything much about this topic, since it focuses on examples (many of which, arguably, aren't MVC at all) and stumbles on the various ways to define MVC. My personal feeling is that if you want to get an understanding of the complexities and layers behind the terminology, the ModelViewController page at c2.com and following the links from there is a good motivator. Note that many of the people writing on those latter pages were actively involved in the historical usage and development of the pattern, or worked with people who were directly involved.
Then a good idea would be to let them write this article. Laypersons should not approach this article as has evidently happened.
Can anyone see the issues? - Tbsdy lives (formerly Ta bu shi da yu) talk 21:20, 2 December 2008 (UTC)
Joomla as a MVC application
I recently added Joomla version 1.5 to the list under PHP, but the change was undone by Yarzar110. So before I readded it I wanted to discuss it. From what I have messed with the source of Joomla 1.5 it follows the model discribed in the article. Can somebody confirm or deny this? MarkRomero (talk) 23:14, 26 April 2008 (UTC)
It might be, that Joomla is a MVC application. But so are thousands of applications. What is listed here, are MVC libraries/frameworks you can build with. However Joomla probably contains such a library as a fundamental component. From my point of view the interesting question is, if you could use that component independent of the whole joomla product and how this component is called in special. --79.196.208.123 (talk) 11:21, 27 April 2008 (UTC)
The reason why I added it was because phpXCore was on the list and its description is a content management framework. As far as I know the library could be used independently, but since it is relatively new there have not been any derivative works based on the library. MarkRomero (talk) 13:50, 27 April 2008 (UTC)
Almost all apps today are MVC. Adding Joomla to a list constitutes advertising in that context. —Preceding unsigned comment added by 86.221.27.112 (talk) 11:21, 28 December 2008 (UTC)
new diagram
Another version of the diagram here: commons:file:MVC.png
needs 3 sections
One for Model, One for View, and one for Controller. Needs 1 paragraph on each part. This article needs work. —Preceding unsigned comment added by 71.131.1.140 (talk) 18:42, 15 August 2009 (UTC)
web cycle + mvc + simple example
Is it correct? (using a pseudo code)
// page.html?value=something
// controller if value="something" then // model object.information=value object.save message="saved" else // model object.information="empty" message="" end if // view render(<html><body><form><input name="value" type="text" value={value} /> {message}<input type=submit /></form></body></html>)
--200.83.2.4 (talk) 19:24, 22 October 2009 (UTC)--200.83.2.4 (talk) 19:24, 22 October 2009 (UTC)
No tie-together?
Model–View–Controller presents the Model, the View and the Controller, what they approximately do, but then? What ties them together? Is it just a modular approach in program development, such as we have separate models, views and controller testing scripts, or does it build up separate processes for the respective modules that are then communicating by a FIFO, such as termios, a HTTP-protocol, a pipe or a socket? What protocol is generally used in real life? If so the modules have to speak a language comprehended by sender and receiver module, such as (mentioned) XML, HTML, Volapük, whatever. What language is generally used in real life? Do those comm protocols/languages go under a certain term when adhering to the MVC pattern? In a way the MVC pattern is a philosophy of program design, and the philosophy of program design must provide a complete terminology for all topics that arise under the program development, improvement, and maintenance. ... said: Rursus (mbork³) 09:47, 15 December 2009 (UTC)
Java Platform (the 'example'): Terrible article, indeed
This subsection (under Selected frameworks) is pretty bad...
Without unrelated information (knowing the Java platform), it is almost unreadable.
Quoting this section (the 2nd MVC list, as if the first wasn't bad enough), here's what I mean:
- (Model) The model is commonly represented by entity beans, although the model can be created by a servlet using a business object framework such as Spring.
- Not knowing what an entity bean, a servlet, or spring is, this sentence contributes no information.
- (View) The view in a Java EE application may be represented by a JavaServer Page, which may be currently implemented using JavaServer Faces Technology (JSF). Alternatively, the code to generate the view may be part of a servlet.
- Translated, this to me means:
- The view in Blah may be represented by a Blah, which may be currently implemented using Blah. Alternatively, the code to generate the view may be part of the Blah
- Translated, this to me means:
- (Controller) The controller in a Java EE application may be represented by a servlet, which may be currently implemented using JavaServer Faces (JSF).
- So what?
... All unhelpful JSP-specific jargon. And even if I had a better idea of what it meant, what is written in that section does nothing to help define MVC. If I already knew the details about the platform, this section would still contribute nothing and would be a waste of time to read, I think.
The problem is made worse because it seems to serve as the primary example.
Maybe this article would be helped with some more general (maybe even user-written) pseudo-code.
Shame that it's such an important concept and that Wikipedia's rendering is so deficient.
Drupal is NOT MVC
http://www.articlesnatch.com/Article/Drupal-And-Object-Oriented-Programming-/332433 "Drupal is split into relatively independent layers the similar to the way MVC apps are split into layers. There is nothing inherently magical or special about MVC - there are plenty of other design patterns that acheive the same benefits." http://drupal.org/node/116677 —Preceding unsigned comment added by 87.211.99.74 (talk) 12:17, 19 January 2010 (UTC)
Odin Assemble
The projects looks dead. The website isn't available, and the dev blog found via google has the last entries 2006. —Preceding unsigned comment added by 85.179.23.76 (talk) 20:29, 5 November 2010 (UTC)
Terminology : View/Viewport
Even in the abstract, the words View and Viewport become hazy. I think that if the word viewport is going to be used, it should either be explicitly noted that it is a synonym with "View" (in which case it ought to be eliminated), or the difference must be noted!
New Image(s) Requested
I was reading today on Multitier architecture and saw the picture on that page illustrating an example of the steps used to process an user request using the principles laid out in that article. I would LOVE to see picture(s!) like that on this page. I first came to this page (MVC) to learn (about) MVC, but wound up being very confused for a week or two. Even now, I've rather given up thinking, "Well, this is something about a SmallTalk paper that I've never read, so I'm never going to get it fully." I think that new pictures in the fashion stated above would be tremendously helpful.
A MORE DESCRIPTIVE IMAGE PLEASE
Hi, I think this (http://ruby.railstutorial.org/images/figures/mvc_schematic.png) is a much more descriptive image of what MVC is and how it works than the current one.
It belongs to a free online book about Ruby On Rails written by Michael Hartl found here (http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#sec:mvc)
I don't know if you can use that picture in wikipedia, but it wouldn't be very dificult to replicate that image from scratch using tools like Microsoft Paint. I don't know how to even upload an image, so if anybody has some time please replicate that image and upload it to the article because a picture worth a thousand words :) — Preceding unsigned comment added by BlueSky23 (talk • contribs) 15:05, 9 October 2011 (UTC)
Dancer/Sinatra - MVC?
These micro-frameworks demonstrate separation of concerns but I don't think they qualify as examples of MVC/Model 2. — Preceding unsigned comment added by 193.1.228.155 (talk) 10:03, 1 December 2011 (UTC)
Origins of MVC
Many of the changes I am making are to make the article more in line with the concepts back in the 1987 Smalltalk paper. Specifically...
- The controller is the event processing mechanism. You don't just write event handlers in the View that just immediately call the controller. The controller exists, at least in spirit, with the event handlers.
- Views and controllers are tightly coupled for a reason. If you have two different views with different buttons, text boxes, etc., they cannot share the same controller. Why? Because they don't have the same events.
- The model is not just a dumb data storage object. This is where all your business rules live. If you are using the controller to process business rules, than you are not following the pattern correctly. Rather, you are writing in the VB's (crappy) "everything in the form" pattern.
- You had me until this one. Just because an application relies on MVC does not mean that everything must be shoe-horned into MVC. In order to acheive the level of decoupling that ultimately is the promise of MVC, the model can indeed be "just dumb data", or at least an ephemeral collection of values (values which might be objects upon which method calls can be made -- therefore not "just dumb data"), probably retrieved from a fine-grained service layer, albeit via a coarse-grained "facade" interface (business delegate), that the controller references. Jemptymethod 10:32, 20 August 2007 (UTC)
- Wikipedia is not about "having you" (or not). He is talking about the MVC pattern as described in the smalltalk paper. 217.226.55.80 (talk) —Preceding undated comment added 17:39, 7 January 2011 (UTC).
- Rather, you are writing in the VB's (crappy) "everything in the form" pattern. Well, maybe you're just used to Smalltalk's crappy "no rules in the controller" pattern. ;-) — Preceding unsigned comment added by 159.247.123.7 (talk) 18:22, 13 December 2011 (UTC)
- In order to understand the MVC pattern, people need to see how it applies to real frameworks. While you may argue that some technologies (e.g. WinForms) doesn't support the true MVC pattern, it is important that people see it and understand how it differs.
Things that are needed...
- Each component needs more than just a bullet point. We should use the Xerox and Smalltalk documents to give a more indepth description of each.
- The openning needs to clearly state that the MVC pattern was specifically designed for graphical user interfaces.
- We need an entire section on how web applications differ from the GUI applications that MVC was originally designed for. Specifically the bit about how it has two triads, one on the server and one on the browser.
-J. Allen
Re tight coupling: I'd argue that controllers and views are orthogonal rather than tightly coupled. The logic of a domain manipulation is quite different to that of the view. What is to be displayed anyway? A simple boolean success/fail message? A 12 page debugging report? Which bits of data from which bits of the object graph are to be collected for viewing? Are you observing object state or messages passed between objects or both? How is all this data being interpreted into a meaningful human-readable display? This is all view logic which doesn't really belong in a controller layer. The same UI interaction can result in different views - say verbose or shortened versions of a report or different content dependng on admin / ordinary user privileges. Views and controllers can have different rates of change but tight coupling means they are not free to vary independently. Actually tight coupling means they don't exist at all in any meaningful sense. V & C have been merged and instead of MVC you simply have presentation & domain layers.
- Noel Darlow
"Actually tight coupling means they don't exist at all in any meaningful sense. "
You may disagree with it, but that is the one and only definition of MVC as presented in the smalltalk paper. You are free to criticise MVC by pointing that out, but to change its definition is wrong. Grauenwolf 17:19, 29 October 2006 (UTC)
I'm not sure if I am changing the definition or if we are required to use the original smalltalk definition. Concepts often evolve and improve over time - and it's been a while. In my defence I would cite Martin Fowler in Patterns of Enterprise Architecture who makes the comment that many original smalltalk implementations did not in fact separate V and C. Also, from his web page about gui architectures: "I've lost count of the times I've seen something described as MVC which turned out to be nothing like it".
Noel Darlow
I am pretty sure that the MVC concept is of much wider use than for creating user interfaces. From my personal experience (1978-1991), it can be and was used for creating easily extandable software systems (not just one application as most of the frameworks mentioned suggest). If necessary, the respective references can be provided.
David Rozenberg
I believe that Trygve Reenskaug did not publish his original work just because he understood that the MVC concept is much wider and natural to us (human beings). I would serously question any declarations that started in some blogs that there is no need for this pattern or concept. I also think that the interpretation of it made by some people involved with Smalltalk-80 did not add any good, but confused many software developers.
David Rozenberg —Preceding unsigned comment added by 71.224.122.75 (talk) 16:39, 31 December 2007 (UTC)
I think that it is wrong to put model-view-controller on the same line as model-view-presenter and others as it is done in the Architectural pattern article. The problem is probably the lack of understanding that MVC as it was invented 30 years ago by Trygve Reenskaug is just a reflection of a much wider pattern on creating the user interfaces. Do not take this as an attempt to diminish the role of the MVC invention. It was the necessary step in our understanding of how software should be designed and implemented. MVC is not just that for guis. It is the intrincinct part of our lives. We cannot communicate with each other without creating or using abstractions (data model), analyzing inputs (from different views produced by our sensors), and reacting on them (controller actions). Our languages are based on the MVC concept (intuitively). It is also bad to think of MVC as the means of creating efficient guis in the OO software. At the same time as MVC was invented for Smalltalk-80 an approach similar to MVC and independently was used for designing and developing frameworks and the presentation layers for non-object oriented software. This work may not be known to the western researchers just because it was done in Russia and the language barrier prevented the information exchange at that time —Preceding unsigned comment added by Drozenbe (talk • contribs) 12:50, 4 October 2009 (UTC)
MVC Non-UI Applications
This entire article ignores applications of MVC to non-UI domains; even goes to so far as to assert that MVC only applies to user interfaces. The Pragmatic Programmer has an excellent discussion of using MVC without a UI. Specifically, the "view" component produces an interpretation of the model. (e.g. generating on-the-fly information from data such as stock volatility from historical price information).
[Edit: It also only focuses on the web part of MVC, ignoring non-web based applications.] — Preceding unsigned comment added by 46.11.122.169 (talk) 12:00, 4 January 2012 (UTC)
The original idea
Not sure if this has been mentioned as yet, but Trygve's original concept had the View being a more transitory construct that would be created from the model and managed by the controller. I dont know of any current "MVC" claiming frameworks that work in this way, the closest I've seen is perhaps the naked objects framework in Java. I'm not saying the modern concepts of MVC are invalid, but I think its worth noting what the original ideas were especially since the article does properly attribute the concept to Trygve. — Preceding unsigned comment added by Greywire (talk • contribs) 05:17, 8 February 2012 (UTC)
Really think the whole concept has been misused/gone to the dogs by now. Its a completely impractical way of constructing a complex site, though it does give undergrads a place to start (a wrong place, but anything is better than nothing). The years I have spent debugging MVC based systems were money-lucrative but utterly time-wasting. It is not maintainable as an implementation. Keeping it as an abstract, which I think matches what the writer above says, was always the way to go with it (if you needed MVC at all in the first place which I dispute). 118.209.89.119 (talk) 03:56, 7 November 2012 (UTC)
Express JS
Is Express (the Node.js framework) really MVC? The words "mvc", "model" and "controller" don't appear anywhere in its documentation. Its official summary on Github is "Sinatra inspired web development framework for node.js" – and Sinatra definitely isn't MVC. Can anyone verify this? Denbosch (talk) 11:48, 15 February 2012 (UTC)
disputed-section: Java Example wrong?
From this article's current version:
- the JSPs (i.e. the View) do not have to communicate with the model because the Servlet (i.e. the Controller) provides them with the information—they can concentrate on creating output.
This statement is odd: following the initial definition of MVC laid out in the overview section of this article, in a typical implementation of MVC, the View does access the Model. It more seems this is an example of a three-tier architecture. --Abdull (talk) 12:45, 27 June 2011 (UTC)
- I've added an appropriate source and removed the tag. aprock (talk) 05:04, 1 April 2012 (UTC)
Huh?
Sorry, but I still don't really get it. Can we please explain this in a way that someone, who doesn't already know what it is, can understand it? --Uncle Ed (talk) 18:01, 6 June 2012 (UTC)
- I don't mean to edit war, but I've been delivering software for 25 years and it's how I make my money. Please explain this to me and to our other readers in a way that makes sense.
- What is the "model"? Is that where the business rules and data live?
- What does the controller do, then? Is that what tells the model to change state? In response to what? User input, maybe?
- What is the view? When, how and why does the model give it information? Does the controller function to separate the model from the view? Does the controller ask the model for info, or does the model tell the controller that its state has changed and then notify the controller, which then in turn tells the view to change?
- Without answers to these questions, a longer article is worse than a stub. --Uncle Ed (talk) 01:32, 7 June 2012 (UTC)
- MVC is a design pattern, and as such it has to be adapted to the system at hand. So the essence of the pattern does not lie in details of how one component manages to communicate with another, but in the fact that there are separate components and they communicate in certain loosely specified ways. That said,
- the model: yes, it has data. Always. It might have business rules, or those might instead be captured by the controller, in terms of the control operations it supports.
- the controller: it mediates input. Simple example: You have text in the edit box and want to copy it. To do that you press the mouse button and move it around until have text highlighted. Then you release the button, hold Control and tap C. That whole sequence of actions produces one command: "Put this in the clipboard." Something has to do that translation.
- the view: It's the part that generates output representing the data.
- How does the model give it information? By whatever means are convenient for the system. Procedure calls, requests over a network, message queuing, etc. Those details are not essential.
- Does the controller ask the model for info? It might. That's what happens in Java EE. In Smalltalk, every view registers with the model to be notified, and then requests information directly from the model.
- But how does it help in the end for me to answer these questions? I can't be cited as a source. That's why I've focused on carefully paraphrasing people with some authority. This isn't Wikiquote, after all. 24.22.217.162 (talk) 04:28, 7 June 2012 (UTC)
- Thanks for this edit. What you wrote was clearer and more accurate than my attempt. --Uncle Ed (talk) 13:45, 8 June 2012 (UTC)
Component interactions: Huh?
So now I find myself in Ed's position with regard to recent edits. The "component interactions" section was created to describe communications between the MVC components, working closely from what published sources say on the subject. The recent changes to the section have added descriptions of each component per se. The new text uses vague or metaphorical terms like "glue", "things", "operation", "something", all cited to a blog posting. I don't mean to own the article, but if someone wants to elaborate on the definitions of the components, then those definitions belong outside the "interactions" section, and they should be reliably sourced, and they should be in specific language. 24.22.217.162 (talk) 23:46, 18 July 2012 (UTC)
Diagram?
There was an interaction diagram a few weeks ago, but has been removed as part of the cleanup. Was the diagram wrong? Jay (talk) 10:31, 24 July 2012 (UTC)
Shouldn't it
Shouldn't it be called model-controller-view?
. It is a loop, so no order is more appropriate than any other. MVC has been used for decades now, too late to change. --RBS —Preceding unsigned comment added by Randallbsmith (talk • contribs) 19:47, 28 November 2008 (UTC)
Perhaps. But this is an article about what it is. Not what it should be (or especially what you think it should be!).
205.200.230.112 (talk) 21:28, 18 May 2010 (UTC)
I would tend to agree that the term "model-controller-view" would serve well to emphasize the controller as a mediator between the model and the view. It seems plausible to me that the perfect MCV construction would totally isolate the model from the view via the controller. What is the Controller controlling if not access between the model and the view. If I have an editable text field in my view and the user provides some text, that text needs to be potentially validated and then placed into the model. If the model is stored on disk and reloaded the view needs to be repopulated with this same text again via the controller. One of the stated purposes for the Model Controller View (or Model View Controller) architecture is to separate concerns. The model is concerned with persistence to disk and business logic, the controller's concerns would center around validation and mitigating access between views and models, and the view is concerned with presentation of 'controlled' data and collecting inputs. There my 2cents. 132.45.121.6 (talk) 17:24, 25 July 2012 (UTC)
If the infernally silly idea were to be given a name at all, it should really be M-VC, as it is impossible to separate the View and the Controller in real life (web site forms are a good example, so are exceptions that generate 404s). Which really doesn't leave you with much. 118.209.89.119 (talk) 03:58, 7 November 2012 (UTC)
MVC is what ?
The introduction is wrong to me : "Model–View–Controller (MVC) is a type of computer user interface ". MVC is definitely not a type of UI. But I can't find a term or expression that could classified MVC. (it's not a design pattern, more a architectural pattern ...) Kyro (talk) 19:31, 20 August 2012 (UTC) edit:Btw the article became really shitty after the lasts modifications. Kyro (talk) 20:21, 20 August 2012 (UTC)
Changed it to a pattern. The statement "... (MVC) is a type of computer user interface" is, as Kyro states, definitely wrong. The finer points of "design pattern" can be discussed but at least it is in the ballpark.MartinRinehart (talk) 18:19, 6 September 2012 (UTC)
Forgive the impudence, but you could just call it "A load of pseudo-academic rubbish designed to sell books and create ridiculously overcomplicated and inefficient software." Since thats what it is. 118.209.89.119 (talk) 04:03, 7 November 2012 (UTC)
History: Re-discovered by Zend? Really?
The history section seems completely wrong. How could MVC be re-discovered via Zend Corp, when MVC papers were published by the author in the late 1970s?! From the author's own homepage: http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html
MVC is mentioned in the Design Patterns text, published 1995, and many other sources prior to that. I don't have the books referenced here, but it seems like a ridiculous statement to make. Perhaps the only truth in it is if MVC was locked under NDA, but if so, it must have only been for a year or two. Not two decades!
--Mahemoff 11:34, 29 November 2012 (UTC)
Zend?????
"The pattern was rediscovered by an anonymous programmer and given to Zeev Suraski of Zend under the stipulation that it was given away for free in what later became the Zend Framework."
Ummmm no! I can only guess this was inserted by Zend marketing. A simple Usenet search shows that MVC was being discussed years before Zend or PHP or the web ever even existed. — Preceding unsigned comment added by 173.72.22.148 (talk) 01:28, 1 December 2012 (UTC)
Platform Independence
here I'd just like to outline my view of' MVC' with regards to the platform-independance/C++ etc stuff in the article.
My view is that both the Model and Controller are written in a platform-independant language. The Model is tied to the View through a very loose notifier/listener (or 'observer') mechanism. So the Model knows to a certain extent that a View exists, but only very loosely. The Controller however has even less knowledge of a View, and simply implements an interface that allows the model to be changed according to the application logic. So the controller might implement a "Load File" method which the View calls when the user selects "File->Load"... or something along those lines.
So when porting to a new OS, only the View code is rewritten, along with the code to call the appropriate methods on the Controller and to respond to updates from the Model.
Does anybody else have any views on this?
- MVC does not make a program language independent. MVC is just a way to model an application, a set of rules how program parts should interact. MVC is language independent in the sense that you can create a MVC application in C++, in Java or Cocoa. But a MVC program written in Java is not easier to port to C++ than another program. The reusable aspect of MVC leis therein that the parts act indepently - parts call each other with messages, they do not have to know each other by name or specific method - and can be replaced or extended.
- One single program is too small to take advantage of reusability of MVC. The real benefit comes from a MVC framework, that a single program can use and extend.
- I agree with the above comment that the platform independence benefits of MVC are largely imagined, or at least unsubstantiated. In my experience, models are typically tied very closely to a document/persistence framework which impedes reusability in the same way that close ties from a GUI framework impedes reusability of an application's view classes.
- Expanding on my earlier comments: MVC does not give you platform independence, but can help make code easier to port from one platform to another. This is particularly true when GUI APIs are the most tightly-coupled of the platform-dependent APIs used by an application. In this case all (?) of the the GUI API calls are confined to a set of view/controller classes. But the point is that you are still dependent on the underlying GUI API.
- As currently stated, the benefits of MVC are conflated with the benefits of using a cross-platform language. I think language issues are irrelevant here. It is possible to obtain benefit from MVC using a platform-dependent language. Similarly, using a cross-platform language with MVC does not automatically grant platform-indpendence. For example, an application written in python to the Cocoa bindings (using PyObjC for example) is still platform-dependent even though it is written in cross-platform language. Hence I propose removing the language issues from this discussion.
- I have specific disagreements with the current content. For one: "Since the model and controller generally have no knowledge of the view, the programmer is free to implement both in a cross-platform language such as C or C++." The implication here seems to be that view classes necessarily require a language that is not cross-platform. Which is frankly wrong; as noted above, the language is irrelevant here. Platform dependence can arise through the use of platform-specific APIs, not just from choice of language.
- Also the statement that "Theoretically, an application written entirely under the Cocoa framework for Macintosh could easily be ported to Windows under the .NET framework, as long as the model/controller is written only in C++." is incorrect. For starters, Cocoa is Objective C, which to my knowledge is not supported under .NET. Secondly, Cocoa explicitly incorporates Model and Controller APIs, which means that the application is coupled to the underlying API in more than just the view classes.
- So I agree that there are some benefits to using MVC in cross-platform development, but the current description of these benefits is not accurate. --AlastairR 4 July 2005 01:22 (UTC)
- A simple Example is HTML5/JS Framework MVC versus Smartphone, e.g. Cocoa MVC, while both can support JSON Models in HTML5 the View is represented as DOM and may need to be generated by the Controller, in Cocoa the Views are subclasses of UIView created graphically with InterfaceBulider and are filled by the Controller with Data. Due to security concerns client-models are mostly dumb data representations. In most MVC's Controller and View could be merged into one single object and nothing would change, only if one controller handles multiple views of the same data (e.g. list, filtered list and detail-views) there is some advantage of the pattern. However this incarnation of MVC almost never is enforceable by any framework. In effect, the promise of platform independence of the Gang of Five did not hold IMO. — Preceding unsigned comment added by Katzlbt (talk • contribs) 12:05, 14 December 2012 (UTC)
About the Advantages/Disadvantages section: The disadvantages are a bit unclear to me. The second paragraph gives a disadvantage, but it's more a generic disadvantage (don't freeze the ui too soon), and it's resolved by the MVC, as explained as the advantage: A flexible view for a static model. There's also the (not MVC-specific) problem that they're programming without understanding the model. No architecture is going to save you in that area, and it's not a MVC-specific problem.
(Above was unsigned, not written by me, the below is by me). Well I'll give you a pretty big disadvantage straight off. Its almost un-debuggable. As in it makes life very difficult for programmers trying to work changes in a system. Sometimes give-up-impossibly difficult. This is why I avoid it and tell my students to avoid it (and, incidentally, to take the entire GoF book as a purely academic excercise to be digested with a bag of salt). 118.209.89.119 (talk) 04:01, 7 November 2012 (UTC)
Patterns
I read on another WIKI that the Model-View-Controller is made from three patterns: Composite, Observer and Strategy. Does anyone know if this is correct? - Daniel Lewis
- I think it's fair to say that these patterns are useful in creating an MVC architecture, but are not required. In other words it is possible to build an MVC-compliant architecture without using these patterns. --AlastairR 4 July 2005 01:22 (UTC)
- I disagree with AlastairR. As stated in the Gang of Four's "Design Patterns - Elements of Reusable Object-Oriented Software" (the bible for design patterns), the main relationships in MVC are given by the Observer, Composite, and Strategy design patterns. 213.93.217.159 14:59, 14 July 2007 (UTC)
- This is a funny discussion :-), bibles are for believers, believe what you want. Less than 10% of the MVC's that I have seen so far in many frameworks use the observer pattern. Probably that is because observers are hard to implement and most times not worth the effort. A single MVC can do without observer if the controller loads and saves the mostly dumb model. — Preceding unsigned comment added by Katzlbt (talk • contribs) 12:23, 14 December 2012 (UTC)
I would say that MVC is decomposable into just two patterns: Observer and Strategy: the View is an Observer on the Model and the Controller is a Strategy for the View. --gschadow 19 Dec 2005
MVC predates the GoF design patterns, so it may be more accurate to say that the Observer and Strategy are based on the MVC design pattern. - J. Allen 20 July 2006
view sees the user?
That's why I get from the diagram. — Preceding unsigned comment added by 68.183.23.57 (talk) 18:51, 17 January 2013 (UTC)
Maybe this article should just admit ...
The article (and much of this talk) follows the Smalltalk idea of MVC, notably that the View is read-only and the Controller accepts the user inputs. There is a newer pattern, where the View handles both input and output and the Controller primarily exists to connect View and Model. One very clear image and description of that idea is at [Apple's Objective-C tutorial]. There are some spots in the main page citing MVC use of systems that follow the newer pattern (e.g., Swing and EE), yet describing them as if they follow the Smalltalk definition, which they do not.
I'm not attempting to argue the relative merits of the two models, here, but this disjunction has become so large, yet so unacknowledged, in the industry as a whole that I think maybe the Wikipedia article really ought to describe both (or at least, to admit to their dual existence). Jackrepenning (talk) 17:56, 10 March 2008 (UTC)
Maybe you should just admit... This discussion of yours is essentially semantics and no more. It's obvious you're not a programmer. As the next to last commenter on this page suggests, perhaps it's best if laypersons stay away.
- Maybe you should not scold others for a lack of knowledge in an area you seem to not know any more about, Unsigned. Yes, semantics. That's exactly what he is on about. What exactly gave you the impression that Jackrepenning is a "layperson", not a programmer? The inconsistency that has emerged in the definitions of what a Controller's job in an MVC is supposed to be is pretty well-known, I would go so far as to contradict his assessment that it is "unacknowledged in the industry". There are a lot of discussions about it. See for example the discussion on C2—or are the people over there just laypersons, too? 84.227.127.202 (talk) 01:11, 28 January 2013 (UTC)
Evolution of controller definition
See here some good issue for this article, about the MVC-controller:
- old (Smalltalk) definition: The module that deals with input, similarly to how the view deals with output.
- new (modern OS context) definition: an intermediary section of code that communicates between the Model and View, tying them together.
As explained by Bart, the controller definition was changing with the changes of Operating systems and frameworks, "In modern days, the OS takes most of the burden of figuring out what to do with a key press and the application only gets to know about it through the view components when the user confirms their data entry. This means that the controller of old has no place any more in a modern application, because its role is taken up by a combination of the view and the OS".
So, we can add something about "history" or "concept evolution" in the article?
MVC and MVP?
How is this different than MVP? Why isn't there an article on MVP (Model View Presenter) on Wikipedia? 129.120.86.169 22:48, 23 October 2007 (UTC)
My guess is it's akin to what MS did with CUA - rechristened their version CUI.
http://www.codeproject.com/Articles/288928/Differences-between-MVC-and-MVP-for-Beginners — Preceding unsigned comment added by 183.82.24.89 (talk) 04:42, 10 May 2013 (UTC)
Something wrong with first sentence formatting?
The article starts with this:
- ≈———————Model–view–controller (MVC)...
What is that long line for? I'm confused @_@??+ZeniffMartineau (talk) 10:39, 7 January 2014 (UTC)
This Article is Terrible
This has got to be one of the worst technology articles on Wikipedia. Seems to have been written by a bunch of computer science people who don't have any real-world, hands-on coding. A piece of advice to all would-be editors of this article: If you are not a paid full-time program in at least two languages and have not actually coded within a MVC framework for at least a year, DON'T ILLUSTRATE YOUR IGNORANCE BY TOUCHING THIS ARTICLE!!! —Preceding unsigned comment added by 24.227.114.197 (talk) 22:11, 18 December 2008 (UTC)
Sounds good. I would point out one thing. This article abuses the word 'pattern' when referring to MVC. AFAIK this is generally unheard of. And the original article referenced in this 'article' (by Steve Burbeck) doesn't use the word 'pattern' a single time.
Burbeck (and the rest of us) refer to MVC as a paradigm. But see above.
PS. As someone often working with document development and having innumerable colleagues across the globe I know it's common knowledge that it takes far more work to remedy a bad article than to write one correctly from scratch. Far more work and a lot more time. So those of you referred to by the above commenter: please feel singled out. For you are perhaps the chief cause Wikipedia is not of generally acceptable quality in academic circles today. Your cooperation is appreciated.--unsigned
If the article is so bad, then why not help make it better? Obviously if the people who are knowledgeable in the area don't step up and contribute, then the people who don't have such a strong understanding of the subject will end up being the ones writing the article. That said, however, I don't actually believe this is the case here. Other than squabbling over petty semantics, neither of you have listed any specific problems with the article, nor offered any suggestions on how to improve it. So perhaps neither of you are the programming or MVC experts you purport to be and more likely whiny teenagers with over-inflated egos. And don't criticize other people's contributions when you haven't even picked up basic Wikipedia etiquette, such as signing your talk comments.--Subversive Sound (talk) 02:39, 12 February 2010 (UTC)
Needs rewrite?
The lower sections are in particular need. I tried fixing but may have worsened them—I think an article rewrite is warranted.
The organization is poor. The explanations contain jargon (which frightens the unfamiliar) and useless padding (which annoys the familiar). I doubt Java Swing is a good example because A) it requires explanation of Java-specific jargon and B) its implementation of MVC is obscured to those not familiar with it. Although I'm not familiar with it, I think the Servlet–JSP–XHTML example is good in concept—but needs serious improvement. Also, "Implementations of MVC as web-based frameworks" should be merged if not removed.
I think the most severe issue is unwarranted interchange of semi-synonymous/not synonymous terms. Maybe this article can make it through. Any other thoughts? dmyersturnbull ⇒ talk 08:17, 28 January 2009 (UTC)
Pattern is possibly misunderstood
To my knowledge the Model and View do not speak to each other at all, yet the diagram has three-way communication. The Controller should be the gateway between the Model and View, querying the Model and updating the View. The View has generic ways to inform the Controller what the User wants to do, and the Model has generic ways to inform the Controller that it has changed. This YouTube video has a good explanation of MVC in the iOS world: http://www.youtube.com/watch?v=6EcjhVwH0Dw — Preceding unsigned comment added by 81.133.224.254 (talk) 17:39, 29 January 2014 (UTC)
-- No, wrong, that is the Model-View-Presenter pattern. MVC is a cycle where:
- The view listens to the model for change events. Whenever it gets one it updates itself to display the latest model data
- The view fires an event to all registered listeners when the user performs an action
- The controller listens to the view for action events. Whenever it gets one it changes the model state accordingly.
- The model does not listen to anything. Whenever its state is changed, it fires a change event to all registered listeners.
model -> view -> controller -> model -> view -> controller -> etc...
Views updating models is not MVC Controllers updating views is not MVC Controllers listening to models is not MVC Models listening to anything else is not MVC
Unfortunately so much misinformation about MVC has spread throughout the internet that there seems to be no majority opinion on which pattern it is, but I can tell you that it was much clearer years ago.
MVP is a non-cycle where the presenter is the gateway between the model and the view. When it gets an event from the model, it updates the view. When it gets an event from the view, it updates the model.
MVC graphic
The MVC graphic used on the page is confusing. I think it should have the dashed lines removed (the observer paradigm has its own page) and the direction of the arrows should be explained. -- cmh 04:55, 13 May 2006 (UTC)
It also uses transparency which breaks where alpha channels are not available (such as printing).
- this image http://de.wikipedia.org/w/index.php?title=Bild:ModelViewControllerDiagram.svg should be used, because it is vector graphics
- transparency should be used, where should it break exactly? -- someone else —Preceding unsigned comment added by 78.53.194.237 (talk) 17:58, 24 June 2008 (UTC)
- The image file has this talk, which I copy here to centralise the discussion:
- The diagram here is wrong. The whole point of MVC is to prevent the model knowing about/interacting directly with the model, and vice versa. Thus the solid lines between the view and model are incorrect - everything should go through the controller. In addition, the view can indirectly observe the model (so a dashed line would be allowable). 60.229.72.31 (talk) 11:43, 24 October 2008 (UTC)
- Copied -DePiep (talk) 16:39, 27 April 2009 (UTC)
- The image file has this talk, which I copy here to centralise the discussion:
The graphic is not just confusing, it's plain wrong. There should be no connection between the model and the view, that's what the controller's job is...to receive updates from the view and model and inform them of changes. The graphic needs replacing with something that's actually correct. — Preceding unsigned comment added by 81.133.224.254 (talk) 11:52, 25 February 2014 (UTC)
- I'm afraid you're the one who misunderstands. The Smalltalk-80 MVC paper [3] very clearly shows interactions between the M and V, which include those shown in the article graphic. 50.136.204.132 (talk) 00:46, 19 April 2014 (UTC)
a typo?
Hi, this sentence seems wrong to me:
A view is told by the controller all the information it needs for generating an output representation to the user
It sould be "A view is told by the model", right? Lexoyo (talk) 09:46, 11 April 2014 (UTC)
- Right. Fixed. 50.136.204.132 (talk) 19:34, 19 April 2014 (UTC)
Model DOES NOT update the view
There as a comment from middle of January 2014 (four months long), mad be 81.133.224.254 user. It points out, that key diagram to the article is incorrect. It is, of course, true: model does not update the view. Model is a separate, self-existing entity, that does not "see" neither view nor controller. The true fact is that: the controller is responsible for fetching model (data) and updating (rendering) view with it. Can someone do care for drawing a new, correct diagram for this article? — Preceding unsigned comment added by Trejder (talk • contribs) 07:21, 15 May 2014 (UTC)
- First, the article does not say that "the model updates the view." It says that the model notifies the view of state changes, and the view then requests information from the model. Second (and more importantly) the article's presentation of MVC is backed by diverse published sources, including several by people who participated directly in the original development of MVC. The diagram is consistent with those sources. The comments you're referring to (written by you??) are backed by sources that deal exclusively with the Cocoa interpretation of MVC. Whatever the advantages of that interpretation may be, it is not universal and must not be presented as such here. 50.185.134.48 (talk) 10:35, 17 May 2014 (UTC)
Diagram: Arrow direction between User and View
In the diagram, there is an arrow called "sees" between the View and the user. This is correct in general, but I think the arrow points into the wrong direction. The user sees the view, but the arrow points from the view to the user, which would mean that the view sees the user. That seems wrong to me, so the arrow should be on the other side or the text should be changed to "seen by" or "shown to". --193.134.254.26 (talk) 15:37, 4 June 2014 (UTC)
view - model relations
This article contains the following line: 'A view requests information from the model that it needs for generating an output representation to the user.' right here. I believe the view is not supposed to communicate with the model, so perhaps the intention was to write 'A view requests information from the controller...'?
I would edit the article, but I am not academically educated and would like someone who is to confirm (or deny) this first. — Preceding unsigned comment added by 93.172.154.133 (talk) 12:53, 24 June 2014 (UTC)
- Your belief is misinformed and this has been addressed multiple times above. Regarding the image: The view-model interaction has been simplified to fit in limited space. If someone can modify the diagram to show that "the model notifies the view that it should gather new information from the model and update its own output" in the space available, please do so. 50.185.134.48 (talk) 03:15, 1 July 2014 (UTC)
Too much controversy in this article, unable to fix it
This article insists in focusing on the Smalltalk original implementation of MVC, which was designed to handle UI components and should not be applied application wide. The text and the MVC diagram reflect that. As the meaning of MVC commonly understood today is different, this article becomes quite confusing.
imho original implementation should be mentioned briefly and the article should focus instead on presenting the more useful and current definition of MVC as an abstraction to split UI and application logic in an application and the most common implementations in this context.
This was mentioned in several previous topics, but the article has not changed yet. I tried to improve this in http://en.wikipedia.org/w/index.php?title=Model%E2%80%93view%E2%80%93controller&diff=639124433&oldid=637271896 , but someone reverted my changes with the argument there were no sources and I digressed from subject. I believe that other people probably tried to fix this article before me, but had the same unpleasant and frustrating surprise. — Preceding unsigned comment added by 201.82.188.172 (talk) 18:14, 9 January 2015 (UTC)
- You must expect such a surprise if you make major revisions to an article without sources, and especially if you remove sourced text in the process. Also if you cause the article to sprawl into subjects for which there are already separate articles, such as MVVM, MVP. The article could be more descriptive than it is now, but you must bring published sources and you should integrate them in a way that does not result in an endless parade of examples without any explanation of concepts. The concepts were first developed in the Smalltalk environment, so the article refers to that. 167.107.191.217 (talk) 19:07, 24 February 2015 (UTC)
Capitalization
Just letting you know that Model View ViewModel is capitalized.--DixtosaBOT (talk) 13:58, 25 March 2015 (UTC)
True MVC vs. "crippled" MVC on/for the Web
The article is not clear enough about interactions between M, V and C. Their functions are also described somewhat insufficiently. This is probably common for any recent description of the pattern and has resulted in claims that traditional web applications (completely) implement (full) MVC. They can't. For that they would require Server push.
Rich Internet Application and AJAX are changing this picture slightly (the requirement still stands, but if unavailable there are compromises).
--Aleksandar Šušnjar 21:03, 18 January 2006 (UTC)
- The MVC doesnt require server push. The application of the Observer pattern to allow the model to send notifcations to a view is a common and elegant enhancement to the MVC. It is not a core part of the core MVC pattern.
- You are talking about an active model as described in the Smalltalk-80 description. Yes, this would require server push for a web application which is not possible (but may badly be simulated with for instance an AJAX timer on the client side polling for state change on the server). However, passive models are possible in web applications. 81.235.236.122 (talk) 17:09, 24 March 2008 (UTC)
---
Actually messages from the Model to the View are part of the original Smalltalk MVC design. The idea was that multiple MVC triads could share the same instance of a model object. When the model is updated by any triad, it sends a "changed:" message to all views registered with it. Note that with this design the model has no concept of a "View" aside from the fact that it listens to events the model sends.
Sounds like the observer pattern to me.
- J. Allen 20, July 2006
---
The article really needs a kind of clarification. Separation of Model and View is not sufficient for a library or Framework to implement MVC. Every library or framework for interactive applications presents (View) data (Model) to the user and handles user interactions (Controller), but that does not mean that every such library or framework implements MVC.
For instance: "In the case of WinForms, the View and Controller are compiled into the same class.", means that WinForms are not MVC implementation (view and controller are not separated). And next: "The duties of the controller are split between three places."(!)... only justifies this view (the controller is not centralized). The same applies to MFC and many other listings.
The need for another kind of clarification is rather tricky. A part, that is by itself MVC does not automatically make the whole MVC. Here is the example: XForms document is Model (instance document in the head section) - View (layout in the body section) - Controller (DOM Event model). But that does not mean, that any web application which uses XForms as View implements MVC. Such clarification is needed to avoid misconceptions like Model (Frame level) and Model (Control level) in Swing section.
The article should focus more on MVC itself, its parts, their responsibilities, and their relationship. The list of libraries (frameworks) which does (not) implement MVC is unnecessary and confusing.
--Maroš Ivančo 16:40, 10 February 2007 (UTC)
A controller does not have to be centralized. If a collection of things listen to view events and update models, then they constitute proper MVC control logic. — Preceding unsigned comment added by 70.115.144.3 (talk) 04:18, 18 April 2015 (UTC)
Components, View sees User?
Shouldn't the Arrow point the other way, so that the User sees the View and not the View Sees the User? 11:58, 18 December 2015 (UTC)
MVC Diagram
I believe the arrow from "User" to "View" in the MVC diagram is reversed. — Preceding unsigned comment added by MarsBay (talk • contribs) 21:50, 23 March 2016 (UTC)
- The arrow is fine because it shows the direction of information flow. The verb is wrong. 50.185.134.48 (talk) 06:00, 2 April 2016 (UTC)
Confusing inaccurate and badly written article
What makes the article confusing I think is that it doesn't define the M, V and C in a clear and concise way. Basic on the diagram it implies that user interaction goes from the User to the Controller directly which isn't the case. Whatever you'd like to call it, perhaps "the glue", the User interacts with a GUI and whatever actions they perform don't automatically delegate to a Controller - the glue makes it happen. Now, if the controller is responsible for setting up the glue, then it also must know completely how the V is constructed - Some framework implementations seem to tightly knit their M, V and C (Microsoft MVC being an example), however it is very possible to losely couple the V (so for example you can have different implementations for different devices).
— Preceding unsigned comment added by 85.218.245.68 (talk) 07:52, 27 May 2016 (UTC)
--ZhuLien (talk) 1:46, 21 October 2013 (UTC) — Preceding unsigned comment added by 27.32.141.11 (talk)
People Ignoring other Concerns
Although the MVC pattern is promoting the separation of the three concerns Model, View, Controller - many developers ignore the separation of the other concerns such as Technology (of the Model, View or Controller), Vendor (of the View). MVC doesn't imply that all other concerns should be ignored - but some solutions do seem to make it as hard as possible to address some of the other concerns that are important to be separate. — Preceding unsigned comment added by 116.240.194.132 (talk) 02:49, 2 June 2016 (UTC)
Very Ambiguous Sentence
A model stores data that is retrieved according to commands from the controller and displayed in the view.
This has several possible meanings:
1. a. - A model stores data that is retrieved according to commands from the controller 1. b. - A model stores data that is displayed in the view.
2. a. - A model stores data that is BOTH, retrieved according to commands from the controller, AND displayed in the view.
3. a. - A model stores data that is retrieved according to commands from the controller. 3. b. - A model stores data that is retrieved according to commands displayed in the view.
4. a. A model displays data in the view; data retrieved according to commands from the controller.
5. etc.
Fawby (talk) 11:39, 23 October 2016 (UTC)
- honestly, you are turning words. Just use your common sense, and the context of the article. For example, have a look at the diagram located right next to the allegedly puzzling sentence. It is a closed circle, and the data and interactions flow from controller to the model to the view and to the controller and so on. And, in the given context, it is outright nonsensical to display commands in the view, since the whole purpose is to display and manipulate the data in the model. 93.104.7.42 (talk) 02:31, 19 November 2016 (UTC)
Confusing and Wrong
The first image that describes the MVC is very wrong. My understanding of MVC is that the Controller handles the program flow. For example: The user's response is accepted by the Controller. The Controller passes the info to the Model. the Model accesses Data and applies Business rules and the Model then passes back to the Controller. The Controller passes to the View. The View renders to an HTML page which is passed back to the Controller. The Controller passes or transmits the page back to the user.
So the Controller is central, and the various functions (Model, View, etc.) talk to the Controller.
However, the image shows the View passing back to the user. This is wrong and false.
I will leave it up to the editors of the page to correct this error. thanks — Preceding unsigned comment added by 167.102.133.216 (talk) 21:22, 21 November 2016 (UTC)
Wrong picture?
I think the diagram on top of the article (https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller#/media/File:MVC-Process.svg) has an error: the direction of the arrow labeled "SEES" implies that it is the view that sees the user, rather than the user that sees the view... 5.23.32.98 (talk) 17:49, 13 January 2017 (UTC)
JJ Express
JJ Express High Way Bus — Preceding unsigned comment added by 103.52.12.100 (talk) 05:44, 4 February 2017 (UTC)
Lead Section Update and Overall Article Changes
We would like to make the following changes to the lead section for this article:
Old Lead Section
Model–view–controller (MVC) is a software design pattern for implementing user interfaces on computers. It divides a given software application into three interconnected parts, so as to separate internal representations of information from the ways that information is presented to or accepted from the user.[1][2]
Traditionally used for desktop graphical user interfaces (GUIs), this architecture has become popular for designing web applications and even mobile, desktop and other clients.[3]
New Lead Section
Model–view–controller (MVC) is a software design pattern for implementing user interfaces on computers. It divides a given software application into three interconnected parts in order to separate internal representations of information from the ways that information is presented to and interacted with by the user.[4][5] The MVC design pattern decouples these major components allowing for efficient code reuse and parallel development.
Traditionally used for desktop graphical user interfaces (GUIs), this architecture has become popular for designing web applications and even mobile, desktop and other clients.[6] Popular programming languages like Java, C#, Ruby, PHP and others have popular MVC frameworks that are currently being used in web application development straight out of the box.
Overall Article Updates
We are also planning to update the article to include the following information
- Goals of MVC (why it came about)
- Create sections for advantages and disadvantages or a section “advantages vs. disadvantages”
- Provide more examples of MVC frameworks used in Java, .NET, Ruby and PHP
Feedback is appreciated.
Bradford Ingersoll and Mohammed H. Hassan (talk) 04:34, 7 February 2017 (UTC)
Resolved
What's up with that comment about GOTO's and globals? Who's implementation of MVC is that messed up? — Preceding unsigned comment added by 162.119.64.114 (talk) 23:00, 28 April 2004 (UTC)
The article only explains the benefits of the Model-View division. Not its extension to model-view-controller. — Preceding unsigned comment added by 212.99.193.74 (talk) 20:45, 14 February 2005 (UTC)
I have completed the merge from Model view controller triad. Also made some other changes:
- Added brief intro: is it a design pattern?
- Created benefits and liabilities section, moved platform independence discussion into subsection there
- New liability: breaks encapsulation (ref Alan Holub's article)
- Reorged SmallTalk refs into Implementation section
- Added reference to Buschmann, et al.
— Preceding unsigned comment added by AlastairR (talk • contribs) 01:22, 4 July 2005 (UTC)
jQuery?
why is jQuery used as an example? can be done correctly in current javascript. since javascript is a known standard, using it as a basis seems common sense right. jQuery exists primarily because of the past nature of immature and conflicting implementations. seems to me that, with HTML5 coming into being, there should be no enforced reliance on jQuery, esp for purposes of illustration, when correct javascript will do. — Preceding unsigned comment added by Bangkokmaco (talk • contribs) 07:53, 26 November 2011 (UTC)
Three tiers, three layers and MVC
What about following associations?
- Presentation layer = View
- Business layer (application logic) = Controller
- Data layer = Model
— Preceding unsigned comment added by LuMo (talk • contribs) 07:52, 8 July 2016 (UTC)
Batch processing and MVC
Extend MVC to batch processing?
In applications that interact with users, with MVC or three tiers or three layers, the user sees the View and send instructions to the Controller through user events. It is possible to follow the same pattern for batch applications, even if these do normally not allow a user to participate. For example: a reporting program in batch:
- Model: the data in files or in database, from which a report has to be extracted.
- Controller: the reporting engine
- View: the resulting report
We can extend report here towards an output file. The conversion of some input data to an output file can also be considered as a reporting or extraction process.
- Model: the input data
- Controller: the exporting, mapping and / or extracting engine
- View: the output result
In the case of batch processes, there are normally no user events, and it is not user-event-driven. It is however possible that the database, file system or printer raise events or interrupts, based on the View (report, output data or output file), towards the Controller.
So in fact we could say:
- Controller: manipulates the Model
- Model: updates the View
- View: presented to the user or output device = the addressee
- addressee (user or output device): uses the Controller through events or interrupts
In fact, we could say MVCA, to include the addressee in the loop. But the A (addressee) is not part of the software. — Preceding unsigned comment added by LuMo (talk • contribs) 07:52, 8 July 2016 (UTC)
Advantages and disadvantages
The only advantage listed is that MVC is more robust with respect to view instability than is having NO architectural separation of UI and business logic. And no disadvantages are listed, despite the section's name -- probably because nothing besides MVC is even mentioned. This section sorely needs some meat, I wish I had the knowledge to contribute it. — Preceding unsigned comment added by an unknown user 15 May 2006 12.111.164.21
- That's Interesting! How is it you know enough to attack the original article but you can't write-up improvements/corrections??? Loon. — Preceding unsigned comment added by 50.37.105.71 (talk) 20:19, 31 July 2016 (UTC)
- Because people are quick to criticize and slow to be understanding. Sam Tomato (talk) 20:52, 28 October 2017 (UTC)
I Agreed, most likely that this wiki is controlled by fans. — 200.73.30.108 13:27, 28 November 2006 — continues after insertion below
- So does this mean that you are now some how moral arbiters since you don't like MVC?? You wiki people are every bit as nuts as the media says you are. What a worthless pile of dung this has become. — Preceding unsigned comment added by 50.37.105.71 (talk) 20:19, 31 July 2016 (UTC)
There are (not exclusive) three "kind" of pattern idelogy, 3-tier, MVC and 3-layer and since different projects can have different trouble/needs, you must choice the best kind of model, not lets the model choose the workflow for you.
This models have their advantage and disadvantage, there was not a pattern that work for everything and MVC is not the exception. The real trouble with MVC is the lack of clarity with the concept, for example in some projects Model and Controller can be the same or view can be a blurry part of the model. — Preceding unsigned comment added by 200.73.30.108 (talk) 13:27, 28 November 2006 (UTC)
- NO, the real problem is just like REST, people with weak experience start telling other people what something is without really knowing themselves. — Preceding unsigned comment added by 50.37.105.71 (talk) 20:19, 31 July 2016 (UTC)
Pure MVC (where data flows from model -> view -> controller -> model) has the following advantages:
- Application behavior can be changed by modifying or swapping out the controller, without changing the model or how it gets rendered (view).
- A single model can be displayed to the user in different ways/places by different view types.
For instance, given a model that contains a list of e-mails, one view can display a list of the e-mails and their actual subjects, another view can just display the number of unread e-mails. When a controller makes changes to this one model, BAM both views are updated - If you need to change all of the data a view is displaying, you just hot-swap its model.
For instance if you have an e-mail content view showing the contents of an e-mail selected in a list view, whenever the list model says the selected e-mail has changed, view logic simply swaps out the content view's e-mail model, replacing it with the new e-mail model.
— Preceding unsigned comment added by 70.115.144.3 (talk) 04:15, 18 April 2015 (UTC)
History
It is frustrating when people assume things. Young people assume that old techniques can't be as good as anything new.
The history (currently) says that "MVC became one of the first approaches to describe and implement software constructs in terms of their responsibilities". Based on the description here of MVC, Microsoft's MFC Document\View Architecture qualifies. It has documents and views at least. I doubt that MVC was truly the first to do what it does, the writer is just assuming it was. It is often difficult to prove a negative but is there anything authoritive saying that there was little or nothing before MVC that does what MVC does? Sam Tomato (talk) 21:01, 28 October 2017 (UTC)
- MVC was introduced in 1979 and its inventor is approaching 90 years old. MFC was introduced in 1992 so I fail to see the relevance. 167.107.191.217 (talk) 18:14, 14 November 2017 (UTC)
- Yes, you are failing to see the relevance. I believe what Sam Tomato was ultimately saying (and if not, I'll say it now) was that the very notion that MVC was one of the first approaches to describe software constructs in terms of their responsibilities is completely unsupported as it stood, and IMO unsupportable. The fact that there was *some* concept of MVC back in Xerox PARC days in the 70's is interesting, but to believe that this was somehow the start of responsibility-defined "software constructs" is to ignore nearly every operating system and every embedded system written prior. It's yet another case of wikipedia authors attempting to invent concepts out of supposition.
- Keep in mind that the only cited reference on that was a set of opinions written on c2.com! Hardly a citable source, unless you believe that wiki from wiki information formation is sensible.
- It's his specifi and initial point that the tone of that statement implies that there was a longevity to the concept as a whole. When you mention something as "one of the first" of anything, you better be specific as to what you're mentioning. And MVC is (and always as been) specific to UIs (and almost entirely GUI's. NOT "software constructs" as a whole.Tgm1024 (talk) 19:29, 21 August 2018 (UTC)
In the MVC graph, is the edge connecting the View and User nodes misdirected?
As I read the graph, it seems to me that the edge connecting the View node to the User node is misdirected. That is, as I read it, "the View sees the User" because the edge is directed from View to User. If the direction were reversed, it would read "the User sees the View". 166.123.216.45 (talk) 18:54, 11 December 2017 (UTC) Charles Knell
Agreed with Charles. (173.35.211.169 (talk) 22:12, 25 December 2017 (UTC))
The arrow is correct because it points in the direction of processing. The label is wrong; it should be "informs," "renders" or something similar. People keep pointing this out, but no one ever does anything about it. 167.107.191.217 (talk) 17:13, 16 February 2018 (UTC)
Shouldn't the controller interact with both the view and the model? This image doesn't make sense to me because it implies that the model directly updates the view and the user directly interacts with the controller. The user only sees the view. The controller should be the interface between the view and the model. — Preceding unsigned comment added by 128.62.24.176 (talk) 16:43, 26 March 2018 (UTC)
I think the image is intentionally simplistic to aid in understanding of the main flow of information. The Controller would need information from the View in order to interpret the information from the User within the context of the View. The Controller could also provide information to the View to manipulate the View without updating anything in the Model. Would an adding two more arrows make the figure easier to understand, or might it be more confusing? — Preceding unsigned comment added by 165.156.39.28 (talk) 20:14, 30 May 2018 (UTC)
It's only the wrong phrasing. The verb sees implies an action based upon the source side of the arrow, plain and simple. I've never entered an image before in wikipedia, but can we please change "SEES" to "PRESENTS TO"?Tgm1024 (talk) 19:32, 21 August 2018 (UTC)
- As previously stated above, this is a good idea and someone with the capability should do it, without asking further questions. 67.180.143.210 (talk) 03:21, 8 March 2019 (UTC)
Diagram Fetish
Anyone else bothered by the direction of the arrow for `Sees' on the diagram ? :) — Preceding unsigned comment added by 137.82.113.126 (talk) 17:34, 22 August 2019 (UTC)
Web frameworks architecture
There are some additional thing which can be found when using such frameworks, which are common among all of them. They basically have the same things. I think it all started with RoR. Here's a diagram I found which describes the architecture used on these frameworks. The question is whether it can be used here, or a mock of it has to be created due to copyrights. Galzigler (talk) 12:08, 24 August 2019 (UTC)
"Something's wrong with one of the diagram arrows!"
Many, many users have come to this page to ask about the arrow from the view to the user, which seems to say "the view sees the user." The problem is that the verb does not match the subject/object relationship implied by the arrow. Either the verb or the arrow could be changed, but if the arrow is reversed then it will no longer show the flow of information through the pattern. The verb can be changed instead to "informs" or something similar. If you have diagramming software to make a good-looking image, please do so, upload it with a different filename from the current diagram, and add it to the article. No one has disputed that the problem exists, but no one has done anything about it, either. 73.71.251.64 (talk) 02:45, 4 November 2020 (UTC)
Is the DOM a model or a view?
Given that MVC is popular for web frameworks, it would be helpful to clarify whether the browser's DOM is a model or a view. Despite standing for Document Object Model, it violates the following description of the model:
It is the application's dynamic data structure, independent of the user interface.
The DOM is not independent of the user interface. In fact, from a web application's perspective, the DOM is very much the interface between the user and the application.
- Adding a date for the archive bot: 73.71.251.64 (talk) 02:43, 2 January 2021 (UTC)
MVC pattern
Not correct that MVC is a Design Pattern. MVC is an Architecture Pattern. MVC deals with the design of the architecture of the program and not the inside logic and design of the program.
- Adding a date for the archive bot: 73.71.251.64 (talk) 02:43, 2 January 2021 (UTC)
- The cited source for this is a lecture by Robert C. Martin (Uncle Bob). Within the space of a minute: he says MVC "not an architecture"; then he says it is a "design pattern"; then he calls it "an architecture". I think of it (or certain ways of implementing it) as a pattern of patterns; this is not original, but I don't have a citation on hand. Perhaps adding "or architecture".
- ^ "More deeply, the framework exists to separate the representation of information from user interaction." The DCI Architecture: A New Vision of Object-Oriented Programming - Trygve Reenskaug and James Coplien - March 20, 2009.
- ^ Burbeck (1992): "... the user input, the modeling of the external world, and the visual feedback to the user are explicitly separated and handled by three types of object."
- ^ Davis, Ian. "What Are The Benefits of MVC?". Internet Alchemy. Retrieved 2016-11-29.
- ^ "More deeply, the framework exists to separate the representation of information from user interaction." The DCI Architecture: A New Vision of Object-Oriented Programming - Trygve Reenskaug and James Coplien - March 20, 2009.
- ^ Burbeck (1992): "... the user input, the modeling of the external world, and the visual feedback to the user are explicitly separated and handled by three types of object."
- ^ Davis, Ian. "What Are The Benefits of MVC?". Internet Alchemy. Retrieved 2016-11-29.