Way To MVP: MVC vs. MVP

As Darron Schall said,

Instead of a Controller, we now have a Presenter, but the basic idea remains the same – the model stores the data, the view is a representation of that data (not necessarily graphical), and the presenter coordinates the application.

Additionally, the View in MVP is responsible for handling the UI events (like mouseDown, keyDown, etc), which used to be the Controllers job, and the Model becomes strictly a Domain Model.

My thoughts: Presenter acts as a controller in MVC, kind of, but it’s loosely coupled to View. View can switch Presenter by coding. The UI can have multiple views to implement multiple presenters. In fact, it’s common each presenter is created to have its unique purpose which can make test easier, e.g. AddCustomerPresenter.cs, IEditCustomerView.cs and IListCustomersView.cs.

Both Presenter and Model can have methods, so does View. (In ROR, view is very static.) Apparently presenter is a connection between View and Model. RoR doesn’t have this middle layer.

Billy McCafferty ‘s article is good for dotnet dummies, I was very easy to follow. JP’s level is too high for me, currently.

About these ads