Why Asp.net MVC and not Asp.net MVP

Go To StackoverFlow.com


As far as theory goes it seems that Asp.net MVC framework could better be described as an MVP software pattern... Why not?

Because as it seems to me I see Asp.net MVC as a framework that has functional views (scripts running) that invoke controller actions. So it seems views are masters.

2012-04-04 07:11
by Robert Koritnik
I think you are absolutely right - Simon Linder 2012-04-04 07:16
@SimonLinder: FYI. I've found some more info that tells the main difference... in MVP the view is the manager that then talks to presenter, but in MVC the controller is the manager and views are merely peasants instantiated by their managers. So the main difference is the role of the view - Robert Koritnik 2012-04-04 12:37


There are two distinct differences (taken from source):

Passive View:

The View is as dumb as possible and contains almost zero logic. The Presenter is a middle man that talks to the View and the Model. The View and Model are completely shielded from one another. The Model may raise events, but the Presenter subscribes to them for updating the View. In Passive View there is no direct data binding, instead the View exposes setter properties which the Presenter uses to set the data. All state is managed in the Presenter and not the View.

Pro: maximum testability surface; clean separation of the View and Model

Con: more work (for example all the setter properties) as you are doing all the data binding yourself.

Supervising Controller:

The Presenter handles user gestures. The View binds to the Model directly through data binding. In this case it's the Presenter's job to pass off the Model to the View so that it can bind to it. The Presenter will also contain logic for gestures like pressing a button, navigation, etc.

Pro: by leveraging databinding the amount of code is reduced.

Con: there's less testable surface (because of data binding), and there's less encapsulation in the View since it talks directly to the Model.

See this question: What are MVP and MVC and what is the difference?

2012-04-04 07:28
by mattytommo