A one-to-many relationship lets one object notify multiple dependent objects when its state changes. The Observer pattern separates the publisher from subscribed consumers. section 12.1.3
A typical implementation provides:
- An Observer implements update and chooses how to respond to publisher data. section 12.1.3
Baseball reporting
BaseballReporter publishes hit events to LogReport, TableReport, GraphReport, and FanClubReport. Each report attaches itself, receives update calls, and processes the event independently.
Figure 12.4 This version of the application is modeled from the Observer Design Pattern. The content publisher BaseballReporter is a subclass of Subject, and the report generation classes each implement the interface Observer. The Subject superclass’s private instance variable _observers is a list of subscribed observers. The grayed-out portions of the diagram have not changed logically from figure 12.3.
Shows the publisher, Subject observer list, and multiple report observers in one design. section 12.1.3











