Observer

E173618

Observer is a behavioral design pattern that defines a one-to-many dependency between objects so that when one object changes state, all its dependents are automatically notified and updated.

All labels observed (1)

Label Occurrences
Observer canonical 1

How this entity was disambiguated

Statements (48)

Predicate Object
instanceOf behavioral design pattern
design pattern
advantage facilitates reuse of subjects and observers independently
subject does not need to know concrete observer classes
supports dynamic registration and removal of observers
alternativeName Dependents pattern
NSNotificationCenter
surface form: Listener pattern

Publish–Subscribe pattern
appearsIn Design Patterns: Elements of Reusable Object-Oriented Software
belongsTo Gang of Four design pattern
surface form: Gang of Four design patterns
commonIn .NET event and delegate model
GUI frameworks
Java event model
reactive programming libraries
defines one-to-many dependency between objects
definesResponsibility Observer updates in response to notifications
Subject maintains list of observers
Subject notifies observers of state changes
describedBy Erich Gamma
John Vlissides
Ralph Johnson NERFINISHED
Richard Helm
disadvantage can cause cascading updates and performance issues
can lead to many spurious updates
notification order may be undefined
formalDefinition defines a one-to-many dependency so that when one object changes state, all its dependents are notified and updated automatically
involvesRole ConcreteObserver
ConcreteSubject
Observer
Subject
keyOperation attach observer
detach observer
notify observers
purpose to notify dependents automatically when subject state changes
relatedTo Mediator pattern
Model-View-Controller
surface form: Model–View–Controller architectural pattern

Singleton pattern
supports broadcast communication
event-driven programming
loose coupling between subject and observers
model–view separation
typicalImplementationDetail observers register via an interface
subject calls update method on observers
subject keeps a collection of observer references
usedFor implementing data binding
implementing event listeners in GUIs
implementing model–view–controller (MVC)
notification systems

How these facts were elicited

Referenced by (1)

Full triples — surface form annotated when it differs from this entity's canonical label.