

Model View Controller: History, theory and usage - saurabh
http://amix.dk/blog/post/19615#Model-View-Controller-History-theory-and-usage

======
pohl
I was hoping this article would resolve something that I have been curious
about. MVP (Model View Presenter) has been in vogue in the GWT world lately,
as a result of Ray Ryan's seminal Google I/O presentation in 2009 and all of
the open source projects spawned by it that attempt to reify the patterns
therein (one of which is MVP).

[http://www.google.com/events/io/2009/sessions/GoogleWebToolk...](http://www.google.com/events/io/2009/sessions/GoogleWebToolkitBestPractices.html)

As presented by Ray, the diagram of MVP shows that the view never speaks
directly with the model object, and always uses the presenter as an
intermediary.

I wonder, what is the difference between this idea and how MVC is practiced in
the Cocoa universe? The present article talks about how it (Cocoa) uses the
mediator pattern to accomplish the same thing.

Look, for example, at the diagrams in the fairly famous Stanford CS193P
lectures: (the Lecture 1 PDF at the top of the following page)

[http://www.stanford.edu/class/cs193p/cgi-
bin/drupal/download...](http://www.stanford.edu/class/cs193p/cgi-
bin/drupal/downloads-2010-fall)

If you go to page 38 in the slides, or therabouts, you see a fully dressed-out
diagram of how MVC is practiced in iOS, including all of the various
communication mechanisms that the view uses to get to the model via the
controller as a mediator. (Even the event bus, NSNotificationCenter, is used
as a channel between the model and the Controller - not between the model and
the view. Same with KVO.)

Incidentally, there is a Stack Overflow question discussing this very
conundrum, and I don't feel that any of the current answers are very
compelling.

[http://stackoverflow.com/questions/353646/design-patterns-
fo...](http://stackoverflow.com/questions/353646/design-patterns-for-apples-
cocoa-frameworks-mvc-mvp-passive-view-where-is)

To me, Cocoa MVC smells like MVP. The current Wikipedia entry on MVP isn't
very helpful. It seems to focus more on the pattern's history in .NET (and,
before that, Taligent).

<http://en.wikipedia.org/wiki/Model_View_Presenter>

Does anybody have any thoughts on this?

------
S_A_P
Having experience with winforms and Cocoa development, I have to vouch for the
slickness of Cocoa MVC vs what usually happens with Winforms and event driven
development.

~~~
kenjackson
Winforms is explicitly a drag and drop Win32ish API. A better comparison is
WPF MVVM vs Cocoa MVC.

~~~
S_A_P
That is true- and I really like WPF/MVVM. Im also pretty impressed with
ASP.NET MVC. However until recently there was not significant WPF traction for
desktop applications. I really feel that one of cocoas best features is its
simplicity. Its logical, powerful and easy to learn. I think WPF/MVVM may have
a slightly steeper learning curve.

~~~
kenjackson
_However until recently there was not significant WPF traction for desktop
applications._

I'd argue there still isn't much traction for WPF. And based on Win8 rumors it
sounds like MS is going to go all in on Silverlight. My bet is that WPF is
their interop framework (because it works much better with legacy native apps)
and Silverlight is where you do everything else.

WPF does have a decently steep learning curve, but it pays you back with
interest.

------
nubela
was introduced to MVC by Django, and today it is by far one of my favourite
pattern to use in every app/framework that i write ground up. if used
correctly, it decouples dependency beautifully, and allow domain experts to
work on their area of expertise.

some people might disagree with my belief that domain experts should be
focused on their task at hand given the uproar and hype about scrum which i
seriously disagree with: of which everyone shares everyone else's code
responsibility.

but i'm rambling. mvc ftw!!11

------
Tycho
So this original Smalltalk MVC he's talking about, is that basically the same
as the Javascript console you get on Developer Mode in Webkit browsers?

