MVP pattern
Hi all,
I'm using the MVP pattern in my application . I did many views and their presenters .
During the views building' I noticed that many fanctionalities are the same and common between the presenter.
It's right that this pattern did the separaton between the UI and mu BL but I still think how to smarter code for resusing the code.
I mean :
1. How I can make common code between the presenters ?
2. If I want to use the view in another palce, how can use it with it's presenter.
3. Is there any recommended patterns used with this pattern ?
4. Any links for tutorials ?
Thanks in advance...
[671 byte] By [
wasimf] at [2008-1-6]
The Smart Client Software Factory uses it as well. Presenters there are implemented as classes derived from a generic (as in Presenter<T>) presenter class. This way, a lot of common code is moved to the base class. The SCSF also uses other patterns, like the command pattern, Publisher-Subscriber and others to provide a common implementation for code that would otherwise end up in the presenter.
You should experiment with the factory that matches you project (Winforms or Web) and see how things are implemented there.
Wasim,
Ron Jacobs did a couple of casts on MVP at ARCast (and the different sorts of patterns within that space, as defined by Martin Fowler), Polymorphicpodcasts.com also have done some that I have listened to, and should address the issues that you are facing.
I'd have thought that googling this subject would give you a fairly large list of resources to read, as it's a fairly common pattern to use.
Cheers,
Martin.