= Solution
The <observer pattern> connects one event-producing subject to a changing <set> of interested consumers. Consumers register through an observation interface; when a relevant change occurs, the producer notifies them through that interface rather than naming every concrete consumer. Consumers can be added or removed without rewriting the producer's core behaviour.
This is useful for keeping displays, controls or other derived views synchronized with changing state. \b[The design avoids tight coupling from the producer to all concrete dependants], which otherwise makes every new consumer require changes to the producer. Publishing after the producer's <representation invariant> has been restored also lets callbacks observe a coherent state. The pattern does not by itself prevent notification cycles or obsolete subscriptions; update policy and unregistration still matter.
Back to article page