Home  /  Questions  /  Question



129   96.7
Feb 07, 2010


MVC versus MVP for a WinForms app

I am starting up a relatively small project using WinForms. I have been reading up on patterns and MVC versus MVP.  I see that MVC is widely used and very popular in Web development (hence the new ASP.NET MVC platform). However, for a WinForms app, I believe there are advantages to using MVP. Can someone confirm this and explain why?  Thanks.



50   50
Mar 30, 2010
It is hard to say which ones are better, but from the separation of concerns principle it is preffered MVC over of MVP. It is important how you think your architecture and especially what your application does.

130   96.8
Mar 10, 2010
Nirajan Singh has given a pretty decent reply, so rather than adding anything I will just present my viewpoint.

For WinForm app MVP is a better choice, especially considering testability.

Well as far as intelligent view is concerned, I will partially agree, as it's an open debate that where to put most of the logic. And considering testability, I think heavy use of the Presenter would be a better choice, but again, that's my opinion.


75   96.1
Feb 15, 2010

Both in MVC and MVP the presentation layer consists of view objects, and application logic consists of controller\presenter objects. For each view object a corresponding controller\presenter exists and vice versa. And although MVC and MVP are based on a common 3-tier principle: views process only presentation needs and controllers\presenters handle application logic, these patterns have two major differences:

  1. In MVC controllers receive and process user input, but in MVP views receive user input and then merely delegate processing to the corresponding presenters. That is why MVP pattern better fits modern UI environments (Windows/Web forms) where view classes themselves handle user gestures.
  2. In MVC controllers affect their views by changing the intermediate presentation model, which the views are subscribed to (by observer pattern). This makes views pure observers without direct access to them. MVP on the other hand violates this "pure observer" rule by providing a direct link from a presenter to its view. This makes MVP more handy as compared to MVC.

50   50
Feb 12, 2010
I am struggling with this a bit myself. From what I've read (not tried it yet) the impetus behind MVP was to "smarten up" the view. I believe in a pure MVC patten, we wouldn't want to take advantage of things on the client side like Data Binding or any type of data entry validation. With MVP, you get to use more of the richness provided by the platform.

I'd love to hear how you end up tackling this issue. I did find one website (don't have the link handy) that talked about using MVC / MVP in a WinForms world.