Say you have multiple MVP triads in your application (WinForms .NET 2.0 app) and each triad looks after one area of responsibility. What is your preferred way of coordinating the communication between the MVP triads?
Option 1 A coordinator object that "has" each model and looks after the coordination through subscribing to the necessary events in each and then deciding what model methods to call in what scenarios.
Worry that this may be a "god" class.
Option 2 A Presenter "has" another presenter and when something of interest happens in the model, the presenter uses the other presenter to move communication along.
Worry that the presenters should not have a public interface (Presenter-first approach) and this breaks that.
I am just wondering what other people have done to solve this problem in a scalable OO fashion. What if I add another MVP triad? How hard will it be to fit that into my coordinator? There must be some good examples of how to manage multiple MVP triads in a WinForms app?
Not to be vague... but it depends. The two approaches I've used in the past:
events.Raise<MyEvent> ()
and PresenterB implements: IHandler<MyEvent>
and reacts accordingly in its public void Handle (MyEvent @event)
method.The interface:
public interface IFooSelection {
public event EventHandler Changed;
Foo Selected { get; set; }
}