Summary
The OBSERVER pattern appears most frequently in GUI applications and is a fundamental aspect of Java's Swing architecture. With Swing, you never have to change or subclass a component class just to communicate its events to an interested object. For small applications, a common practice is to register a single object to receive all the events in a GUI. Doing so has no inherent problem, but you should recognize that it reverses the distribution of responsibility that OBSERVER intends. For a large GUI, consider letting each interested object register for events rather than introducing a mediator.
OBSERVER lets you delineate the responsibility between business objects and a GUI, which allows you to establish an MVC design. MVC lets you create ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access