Definition:
The intent of Observer pattern is to define a one-to-many dependency between objects so that one object changes state, all its dependents are notified so that they can react to the change.
What is:
Observer pattern
Example:
1. Bob Tarr’s observer pattern
2. Enhance design patterns with AspectJ, Part 2
3. Observer and Observable-An introduction to the Observer interface and Observable class using the Model/View/Controller architecture as a guide
4. The Observer Pattern RevisitedĀ
Summary:
For smallĀ application, a common practices is to register a single object to receive all events in a GUI. There is no inherent problem with this, but you should recognize that it reverses the distribution of responsibility that OBSERVER intends.
For a large GUI, consider moving to an MVC design, letting each interested object register for events rather than introducing a mediating central object. MVC also lets you create loosely coupled layers that can change independently and that may execute on different machines.






No comments yet
Comments feed for this article