slandau
slandau

Reputation: 24052

MVP - Model View Presenter

I have visited every Google'd site, every tutorial, everything I could find on MVP. Everything is too high level for me. I want something VERY basic. Most MVP things go right into, "Oh we solve this by creating an interface, etc". I want to know WHY those interfaces are being created. I want to see examples and the reasoning behind them, not just...here's how the MVP pattern works, use it...etc.

Any good sources for that, or could anyone explain it here?

Also, I really don't know how to implement Data Binding in WinForms the way these people say. What's so wrong with the user clicking on something, clicking save, and then calling a method that saves that data to the database, and comes back and reloads the screen. Is that not databinding? If so, how come I haven't seen something just explain things like that before for DataBinding in MVP.

Upvotes: 1

Views: 1596

Answers (2)

Berin Loritsch
Berin Loritsch

Reputation: 11463

A good overview of MVP can be found at Wikipedia:

http://en.wikipedia.org/wiki/Model-view-presenter

Basically, MVP is an evolution of the classic MVC, which essentially provides some rules to disambiguate by what is meant by "Controller" in MVC. Historically, there arose two types of controllers: business logic controllers, and view specific controllers (mouse-down, page-load, etc.).

MVP operates on the principle that your Model portion encapsulates all the business data and logic for the application. The View layer is responsible for all user interface events as well as how to display the data in the Model to the user. The Presenter layer takes the role of your server side controller logic--i.e. responding to the "submit post" request.

NOTE: MVP is probably a little closer to what the original intent was for the MVC pattern.

Also take a look at Jeremy Miller's post back in 2006 which helped introduce the MVP concept:

http://codebetter.com/blogs/jeremy.miller/archive/2006/02/01/137457.aspx

Since the MVP concept was introduced, the world evolved and Ruby on Rails taught the world how to create testable web applications and apply the MVC concepts reasonably well. Those lessons made it to MonoRail and ASP.NET MVC, and strongly influenced their design.

Upvotes: 1

Larry Hipp
Larry Hipp

Reputation: 6255

Have you read the Phil Haack post ASP.NET Supervising Controller (Model View Presenter) From Schematic To Unit Tests to Code? It's a very good article about the MVP pattern and how to use it.

For WinForms check out SO - Winforms - MVP examples

Upvotes: 0

Related Questions