none
MVP and MVC patterns

    Question

  • Hi all ,

    I need your help to understand the difference between the two patterns MVP and MVC.

     

    I understand well the MVP one , but still need to understand the MVC. When do we use them , in each situations and what is the choise in my application to choose them.

     

    Thanks in advance... 

    Saturday, May 12, 2007 8:58 PM

All replies

  • The MVP is a variation of the MVC pattern. The Presenter and Controller classes have similar roles in both patterns with one difference. In MVP, the View has no direct access to the Model. In MVC, both the View and the Controller have access to the Model. MVP essentially hides the model from the View. MSDN has a nice and short description of the MVC pattern.
    Saturday, June 02, 2007 7:15 PM
  •  

    It’s incorrect to say that in ‘MVP’ the view has no direct access to the model, there are two flavors of MVP, ‘Passive View’ and ‘Supervising Controller’, in ‘Passive View’ the view is passive and has no link to the model just like you said, however, in ‘Supervising Controller’ the view has link to the model. You can read all about it here:

    http://aviadezra.blogspot.com/2008/10/model-view-presenter-design-pattern.html

    and here:

    http://aviadezra.blogspot.com/2007/07/twisting-mvp-triad-say-hello-to-mvpc.html

     

    In the same blog you can find series of articles about the usage of MVC/MVP/MVPC/MVVM in windows forms applications and web applications including detailed code samples. 

    BTW:

    Another common mistake is to say that in MVP the view has no direct access to the presenter, MVP imposes no restriction on the kind of coupling between the view and the presenter, this is for the developers to decide. Personally, I prefer that the view will hold reference the presenter instance so it can directly invoke the appropriate method when user input arrives. DEREK GREER wrote fantastic article about the subject, please refer to:

    http://www.ctrl-shift-b.com/2008/11/model-view-presenter-styles.html

     

    Saturday, August 04, 2007 8:36 PM
  • Here is a great web cast by Ron Jacobs which is of 3 parts:

    Here is part 1 you will find links to parts 2 and 3

    http://channel9.msdn.com/ShowPost.aspx?PostID=312315

     This is the best response I have found so far.

    Tuesday, August 07, 2007 2:09 PM
  • I would agree with livetocode...

     

    The ron jacobs casts are good for explaining the differences, similarities, and evolution into to types of MVP.

     

    Perhaps this area of patterns could really do with its own forum, there's so many different question about it, i think that it would be worth it?

     

    If you've ever used the old C++ development environments, that might help you to understand how MVC works (View and Document objects, etc), on the other hand it might just give you more questions!

     

    I hope this helps, but if it doesn't please ask again, exactly what you're interested in, or confused about?

     

    Martin.

     

    Tuesday, August 07, 2007 11:05 PM
  • Hi,

     

    The difference between those two is explained here as a part of the MVC# project. Hope it helps Smile

     

    Regards,

    --

    Oleg Zhukov

    Thursday, October 30, 2008 12:58 PM
  • Hi wasimf

     

    MVP is one of the many variations of MVC in design patterns for the user interface (now), MVC pattern is to based on where they left several others such as PAC  (Presentation-Abstraction-Control) pattern, the scope will depend on the context of your problem, for example an interesting alternative is to use WCF and MVP i use MVP is more Loosely Coupled Smile
     
    Benefits:
    Loose coupling (MVP use Interface (IS MORE LOOSELY COUPLED ) - MVC use Class and share views)
    Test
    Reuse  Code 
     Clear separation of concerns/responsibility

    Flexibility

     

    Here you can see more information

     
     
     
     
     
    Saludos!
     
     
    Monday, November 17, 2008 12:32 AM