4 ms·
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 re
by pohl 16y ago
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/GoogleWebToolkitBestPractices.html http://www.google.com/events/io/2009/sessions/GoogleWebToolk...
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/downloads-2010-fall http://www.stanford.edu/class/cs193p/cgi-bin/drupal/download...
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-for-apples-cocoa-frameworks-mvc-mvp-passive-view-where-is http://stackoverflow.com/questions/353646/design-patterns-fo...
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 http://en.wikipedia.org/wiki/Model_View_Presenter
Does anybody have any thoughts on this?