gptkbp:instanceOf
|
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
|
ConcreteObserver
ConcreteSubject
Observer
Subject
|
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)
|
https://www.w3.org/2000/01/rdf-schema#label
|
Observer pattern
|
gptkbp:notableFor
|
gptkb:.NET_event_model
gptkb:JavaScript_event_listeners
gptkb:Java_Swing_event_model
|
gptkbp:pattern
|
Behavioral
|
gptkbp:patternParticipants
|
ConcreteObserver
ConcreteSubject
Observer
Subject
|
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)
gptkb:Mediator_pattern
gptkb:RxJS
|
gptkbp:bfsLayer
|
5
|