|
gptkbp:instanceOf
|
gptkb:Software_design_pattern
|
|
gptkbp:advantage
|
Can lead to memory leaks if observers are not properly removed
Can be inefficient with many observers
Notification order is not guaranteed
|
|
gptkbp:alternativeName
|
Publish-subscribe pattern
|
|
gptkbp:author
|
gptkb:Erich_Gamma
gptkb:John_Vlissides
gptkb:Richard_Helm
gptkb:Ralph_Johnson
|
|
gptkbp:benefit
|
Promotes loose coupling
|
|
gptkbp:category
|
Behavioral pattern
|
|
gptkbp:commonIn
|
Event-driven systems
GUI toolkits
|
|
gptkbp:component
|
gptkb:Subject
ConcreteObserver
ConcreteSubject
Observer
|
|
gptkbp:describedBy
|
gptkb:Design_Patterns:_Elements_of_Reusable_Object-Oriented_Software
|
|
gptkbp:example
|
gptkb:C#_events_and_delegates
gptkb:Model-View-Controller_(MVC)
Java's java.util.Observer
|
|
gptkbp:firstDescribed
|
gptkb:GoF_book_(1994)
|
|
gptkbp:notableFor
|
gptkb:.NET_event_model
gptkb:JavaScript_event_listeners
gptkb:Java_Swing_event_model
|
|
gptkbp:pattern
|
Behavioral
|
|
gptkbp:patternParticipants
|
gptkb:Subject
ConcreteObserver
ConcreteSubject
Observer
|
|
gptkbp:problemSolved
|
One-to-many dependency between objects
|
|
gptkbp:purpose
|
Decouple subject and observers
Define a one-to-many dependency so that when one object changes state, all its dependents are notified and updated automatically
|
|
gptkbp:relatedTo
|
gptkb:Mediator_pattern
Event listener
|
|
gptkbp:solvedBy
|
When one object changes state, all its dependents are notified and updated automatically
|
|
gptkbp:supportsLanguage
|
gptkb:Java
gptkb:JavaScript
gptkb:Python
gptkb:C#
gptkb:C++
|
|
gptkbp:UMLRepresentation
|
Class diagram with Subject and Observer interfaces
|
|
gptkbp:usedIn
|
Object-oriented programming
|
|
gptkbp:bfsParent
|
gptkb:MVC_(Model-View-Controller)
|
|
gptkbp:bfsLayer
|
5
|
|
https://www.w3.org/2000/01/rdf-schema#label
|
Observer pattern
|