Observer Pattern
The Observer Pattern establishes a one-to-many relationship where a subject publishes state changes or events and observers react to them. It is common in GUI event handling, domain events and reactive systems. In distributed systems, the same conceptual idea appears in Pub/Sub messaging, although a message broker introduces additional concerns such as delivery semantics, retries and durability.
Subject publishes events to registered observers.
Observers can be added without changing the subject's core behavior.
Common in UI events and in-process domain events.
Distributed Pub/Sub extends the concept across processes or services.
Important concerns include observer lifecycle, ordering, failures and memory leaks.