Question

For an upcoming project, I am looking into MVP as an option over MVC. I am highly familiar with and like MVC, and am merely trying to see if I will gain anything using MVP.

What I gather about MVP is that it uses the ASP.Net view engine/MVC# (which I don't particularly like) that uses the ViewState - adding a bunch of extra content to a rendered web page, and not built in routing functionality (can be written in separately into the Global.asax).

MVC/Razor on the other hand, renders very clean HTML.

Certain articles, such as this one seem to lean towards using MVP for multiple views, however in light of MVC3 with jQuery Mobile, there are some fantastic things that can be accomplished with this MVC.

How do these compare to what is currently available with MVP? What are some pros/cons or potential pitfalls of using MVP over MVC?

I am also considering using an existing MVP application to expedite development time.

I know you will cringe at the following, but looking for options: While this app offers all the required features, if implementing this solution, how difficult is it to tie in additional MVC applications (I know that looks ugly)? If this was something that we had to consider (combining both), would it be best to wrap the application in MVC (routing) and have the MVP app contained inside?

The reason for this is a staggered feature update process, where the requirement is to implement a new feature (which is built using the MVC framework; the rest of the system is not). Future plans are to completely change the current framework to either MVC or MVP.

Thanks.

Was it helpful?

Solution

You seem to be confusing patterns with frameworks here.

Both MVC and MVP are design patterns, ASP.net MVC and MVC# on the other hand are frameworks that implement the MVC/MVP design patterns.

There is a massive confusion and lots of conflicting information on the web about the difference between MVC and MVP patterns and infact Martin Fowler the guy who made MVP popular since "retired" the pattern in favour of 2 new ones. See here

Both patterns are there to aid separation of concerns that is for sure, but other than that there really isnt a lot of difference between them, the only thing I have found is that MVC has a controller per widget on the screen where as MVP is one per screen although even this rule is violated if you have a complex screen. I am still unsure and use the terms interchangeably myself.

The one thing I see over and over is that in MVP the view is responsible for creating the presenter, however this is not part of the original design. It appears to have arisen from the fact that older web frameworks such as asp.net webforms were page centric. You had no way of changing this and so it was the page (view) that created the presenter. Basically the framework is getting in the way of the pattern and so a hack was made to shoe horn it in. Unfortunately this seems to have become the defacto way of describing MVP.

Basically my wall of text above is trying to say that if you want to do MVC properly use a framework designed to do it, ASP.net MVC is a good choice, it is part of the MS stack, well supported (MVC# hasnt been updated since 2008) and if you are already happy with it the loss of productivity trying to learn something else isnt really worth it imo

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top