Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

It is almost and instantaneous whenever I talk to developers about Model View Controller (MVC) they say you make a request to a url the server builds a entity (MODEL) and provides you with visual representation of that model.

  • So does this mean MVC is only for the web or have I been meeting people who are just developers who employ MVC for writing web applications?

  • Are there usages for MVC on desktop style applications?

  • I for one am new to paradigm and would like to know of any super-set to MVC

share|improve this question
    
did you check Programmers.SE or Stack Overflow tag wikis for 'mvc'? –  gnat Mar 21 '12 at 9:02
2  
@gnat yes I did –  Deeptechtons Mar 21 '12 at 9:09
5  
well then you probably already know the answer to your question don't you? –  gnat Mar 21 '12 at 9:11
2  
@gnat seriously NO, i am totally new to MVC (as stated) and have never used or heard(some ears I got) about MVC being applied to windows applications or used a application that sports a MVC badge on downloads page. Sorry if the question was foolish but for me it does puzzle –  Deeptechtons Mar 21 '12 at 9:21
    
There are plenty of good resources for learning the history of MVC but I see this misconception a lot, so I wrote a nice summary on my blog blog.kutulu.org/2012/01/mvc-mvp-mvvm-mvpvm-lmnop-wtf.html –  Michael Edenfield Mar 21 '12 at 16:58

7 Answers 7

No, development for OS X and iOS uses Model View Controller pattern.

share|improve this answer
2  
Finally, an answer to the first and second points without the commentary. –  JeffO Mar 21 '12 at 13:10

MVC is a pattern. Patterns apply across all programming. MVC just happens to work very well in a web context.

As gnat points out just have a look at the mvc tag and you will see multiple examples of it being implemented.

share|improve this answer
5  
This is key. MVC works really well in web applications, and indeed is a large part of the reason why modern MVC-based frameworks (like Rails, Django, and ASP.NET MVC) are so popular. It works in other contexts (like desktop apps) too, but it is harder to keep a clean seperation of view and controller, so variants that remove the view-controller seperation like Model-delegator (used by Swing) or change where the split occurs like Model-View-ViewModel (used mostly by .Net WPF apps) are more common in Desktop Applications. –  Kevin Cathcart Mar 21 '12 at 15:46
    
If you look at the original Smalltalk description of what a controller does -- translate user input into messages for the model -- Windows itself is basically one big controller; that's why MVC as a pattern doesn't mesh very well with Windows UI applications. Its used a lot more in UI Frameworks for non-Windows systems. –  Michael Edenfield Mar 25 '12 at 3:38

Considering that MVC is from 1977, and the web was only invented in 1991, it should be pretty obvious that MVC is not only for the web.

share|improve this answer
26  
This is a nice start of answer, but has a bitter taste in mouth. –  Nicolas C. Mar 21 '12 at 12:06
    
-1 'correct'... but too snarky for me –  Michael Durrant Mar 21 '12 at 20:25
    
Correct and snarky. Great stuff! –  Tom Hawtin - tackline Mar 22 '12 at 0:22
1  
"In 1982 the Internet Protocol Suite (TCP/IP) was standardized and the concept of a world-wide network of fully interconnected TCP/IP networks called the Internet was introduced." wiki. If you mean netscape, then ok... but "the web" existed before that. –  jmq Mar 22 '12 at 4:24
    
@Jorg W Mittag it would help if you could add up answers to Question 2 and 3. You nailed the first one –  Deeptechtons Mar 22 '12 at 8:42

Ask the question in a Microsoft environment and many people will assume you mean Asp.Net MVC which is an MVC implementation specifically for the web.

Unfortunately there are many people who do not realise that this is an implementation of the MVC pattern and think they are interchangeable terms, which leads to an assumption of "web only".

share|improve this answer
3  
+1 this is the problem with naming a platform after a methodology. When people are introduced to the platform first they fail to see the distinction. –  MattDavey Mar 21 '12 at 10:35
    
@Ozz this did explain why other developers always use to say about web when MVC is the topic –  Deeptechtons Mar 21 '12 at 10:42

No, it applies even for standalone applications. Example Java Swing follows MVC.

share|improve this answer
1  
Why the downvote the let person live! –  Deeptechtons Mar 22 '12 at 8:44

At least as far as I know, the first implementation of MVC was in Smalltalk. It was definitely present in Smalltalk-80. Though I don't have any documentation handy to prove it, I believe it (or something quite similar anyway) had been in Smalltalk for a few years by then.

Most OO GUI frameworks have included at least some variant of MVC. I'm not sure, however, exactly what "superset" would mean in this case. It's a little hard to say whether any given variant is a superset, subset, or peer of MVC, but I'd tend to consider most of them peers.

In any case, many (most?) of these have been used for desktop development, not web development. Thanks to some old AT&T patents, most windowing systems require programs to be able to re-generate views on demand. This (almost) forces at least some degree of separation between code that maintains the current state (the model) and code that displays that state (the view). That still leaves a lot of room for variation in 1) the degree to which the controller functionality is isolated, and 2) the exact details of where to draw the lines between each of the major pieces.

share|improve this answer

So there is a lot of different design patterns in this area.

  • Model View Presenter (mvp)
  • Model View View Presenter (mvvp)
  • Model View Controller
  • Model 2

and so on. Over the years these have been intertwined, mashed together, changed and applied in a wide variety of contexts. The important bit here, is that the MVC design pattern from 1977 has changed quite a lot, and is no longer the design pattern used by serverside web frameworks. As an example in the original smalltalk implementation the Model would observe the view for changes, which is no longer the case as the serverside simply can't observe html elements in the users browser. Instead if the view changes, the view will send a request to the controller which will then update the view. Again the original MVC implementation is not followed, as an update to the model would imply that all views dependent on the model would be updated.

The modern web frameworks follows a simple three tier architecture also known as a Model 2 architecture.

There are of course examples of real MVC architectures on the web, but these are often client side only, connected to a server which follows the Model 2 architecture, as the views are xml and json, and not observed for changes. Examples of client side pure mvc architectures are Sencha Touch and Sproutcore.

If you have MVC in the browser, mvc like on the server, and mvc like as the data layer, you have a hierarchial mvc implementation.

Note. I've only talked about web frameworks, other implementations of MVC such as java swing and Flex has other implementation differences.

share|improve this answer
    
Certainly doesn't make sense why people down vote others, if something is wrong please do tell them & give a chance to correct their view. If they don't have knowledge on the subject a good teacher would direct them to right source not beat him until he learns it right!! –  Deeptechtons Mar 22 '12 at 16:51
    
the question assumes that mvc and web work well togather and pleads for non web mvc, so when you only give examples of mvc in a web context: -1 –  hildred Nov 27 '13 at 20:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.