Broker scheme for trivial messages?
Is it good programming practice to use the mediator pattern for trivial messages (show an image viewport, etc.)?
Mediator.NotifyColleagues(Messages.DISPLAY_IMAGE, image);
instead of just using
frmImageViewer.Show(image);
I use mediation a lot in my program and I was wondering how much is too much.
Regards,
Seb
a source to share
It depends.
It should be used when you do not want to create a link between the component that displays the image frImageViewer
and the component that triggers the notification.
If you don't plan on adding a new window, or your application is simple enough not to care, you can opt out of the middleman.
When your application has more screens and you need to support new ones (like the preference dialog and the extended preference dialog), and you don't want them to know about your controller, the pick looks appropriate
a source to share