Observer Pattern
Context
- An object, called the subject, is source of events
- One or more observer objects want to be notified when such an
event occurs.
Solution
- Define an observer interface type. All concrete observers
implement it.
- The subject maintains a collection of observers.
- The subject supplies methods for attaching and detaching
observers.
- Whenever an event occurs, the subject notifies all observers.