Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVP - How many presenters

What is common practice, one presenter for View view and one for Edit view, or should it be all in one presenter.

like image 627
epitka Avatar asked Sep 18 '09 14:09

epitka


2 Answers

The rule of thumb which I follow is... - 1 Presenter 1 View

But for common controls you could share the presenter if the presentation logic is same... For eg... You have a Dialog control for "Confirmation dialog", "Operation Complete dialog!", and many other variants... For this I had this control realize from a common view interface and had one presenter serving the whole suite of dialog controls...

The reason is it helps to keep the pattern clean. Also, in terms of flexibility this has its own benefit..

Recently I had a task to migrate a windows application built on MVP to asp.net (1 view 1 presenter rule of thumb). The migration was seamless as I only had to worry about creating respective views rest of the things were taken care of by the design.

like image 118
rajesh pillai Avatar answered Nov 03 '22 08:11

rajesh pillai


I asked a similar question about WinForms, but I think the answer covers any form of MVP. The general consensus was that you should use 1 Presenter for each view.

like image 40
SwDevMan81 Avatar answered Nov 03 '22 07:11

SwDevMan81