Andrew Stopford's Weblog

poobah

Sponsors

News

Articles

Family

Old Blogs

MVP & MVC simply put

This question seems to get asked a lot, this recent article on codeproject does a decent job of explanation as well as this article from Infragistics Guidisan Todd Snyder.

If I was sum it up very simply, the different is entry point into the pattern.

In MVC the entry point is the controller, if you look at the Microsoft MVC framework for example the controller class is where you bind your view and everything else (model) together.

In MVP mean while the entry point is the view, webforms lends it's self very well to this pattern as you can bind the aspx and your view and use the normal aspx entry point to get at the rest of your patttern (in fact winforms works well on this pattern as well).

Going a bit further

You can break down your view into two, a view and View-extender. The temptation in webforms land in a passive sense of the pattern is hold all sorts of view centric items on the presenter. If you have lots going on in your presenter for your view and you want to keep your view ultra light and passive then use a view extender as a layer between the presenter and view, remember keep your concerns focused and light.

In Presenter-First (a variant of MVP) you can take your first MVP pattern and extend it's presenter to multiple views that also follow the MVP pattern. If there is a degree of data transform needed between the language of the view and the model then this pattern can be useful.


Crazy thought of the day

I wonder if the Microsoft MVC view engine (or MonoRails for that matter) could be readapted to act as entry point. More likely you could redefine aspx files as your own http handler, writing a class to act as the aspx which then appends the view and obtains actions from it.

Comments

No Comments