Home  /  Questions  /  Question



50   50
Oct 21, 2011


difference between MVC and MVP

Hello 
          I am new to the forum .Can some on please explain me what is the difference between MVC and MVP.

Example will be highly appreciated 

Regards



1,364   100.0
Oct 28, 2011
Apart for the theoretical definition which you might easily get by googling, the following are some of the important points with respect to MVC and MVP

-  Both provide abstraction of presentation and presentation logic.
-  MVP is a bit more complex to implement than MVC also it has additional layer for view interfaces.  (but this can be blessing in disguise, if you are looking for sharing presentation logic across windows, web and other things..)
-  In MVC the request is received by the controller which in turn gets the required data and loads up the appropriate view
-  In MVP the request is always received by the View and delegated to the presenter which in turn gets the data does the processing
-  In MVC the controller logic can be unit tested (also you can unit test view if you are using Razor view engine.  ASPX viewengine are not that easily unit testable)
-  In MVP presentation and view logic an be unit tested as the view is loosely coupled.

For web programming I prefer MVC and for windows including WPF I prefer MVP as the flow naturally tend towards this pattern.