1

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.

slandau
  • 23,528
  • 42
  • 122
  • 184

2 Answers2

1

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.

Berin Loritsch
  • 11,400
  • 4
  • 30
  • 57
  • Basically, I wanted to structure my code so I had all my views (the forms). Then behind that just the code to build those forms. This code would basically call the "controller" in it's onLoad and pass in the current state of the form and the controller would then pass back all the data back to fill the form with. The controller would call the DataLayer classes and work with the models. What problems would I run into? – slandau Dec 13 '10 at 20:51
0

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

Community
  • 1
  • 1
Larry Hipp
  • 6,205
  • 3
  • 26
  • 31