Observer
Lets objects (observers) subscribe to and react to state changes in another object (the subject), without the subject knowing details about its observers.
Why we need this / what value this brings
Lets interested parties react to state changes without the subject needing to know who's listening or how many there are.
When to use this
Multiple parts of the code need to react to the same state change, and you don't want the source of that change to know about all of them directly.
How to use or implement this
Have the subject maintain a list of observers and call a notify method on each when its state changes; in a distributed system this becomes CommunicationPatterns/PubSub instead.
Research questions
- This is the OOP-level version of ArchitecturePatterns/EventDriven and CommunicationPatterns/PubSub — same idea, different altitude (in-process objects vs system-wide events).
Empty folder — drop notes, links, and findings here as you research.