Summary
It is used to implement object state change notification mechanism
In practical it defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
Basic Observer structure
Basic Observer interaction
Overview Tutorials
When to Use
When one object need to notify multiple object about the change of state of it`s own
Examples
Event Handlers are best examples of that actually implement observer pattern
Related Patterns
Factory pattern - It's very likely to use the factory pattern to create the Observers so no changes will be required even in the main framework. The new observers can be added directly in the configuration files.
Template Method - The observer pattern can be used in conjunction with the Template Method Pattern to make sure that Subject state is self-consistent before notification
Mediator Pattern - The mediator pattern can be used when we have cases of complex cases of many subjects an many observers
Model View Controller (MVC) :Observer pattern is often mentioned in conjunction with MVC due to the need to keep the views and the associated model synchronized.
References