Summary

The MEDIATOR pattern promotes loose coupling, keeping related objects from referring to one another explicitly. MEDIATOR shows up most often in GUI application development, in which you don't want to manage the complexity of individual widgets' updating one another. The architecture of Swing guides you in this direction, encouraging you to define objects that register for GUI events. If you are developing with Swing, you are probably applying MEDIATOR.

Swing nudges you into using MEDIATOR, but Swing does not force you to move this mediation outside an application class. Doing so can simplify your code. You can let a mediator class concentrate on the interaction between objects and let an application class concentrate on component construction. ...

Get Design Patterns Java™ Workbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.