Multiple choice technology programming languages

You have been reading the Gang of Four pattern book again and you suddenly notice a similarity between a design pattern and publish-subscribe messaging. What design pattern is similar to publish-subscribe messaging?

  1. Publisher pattern

  2. Flyweight pattern

  3. Observer pattern

  4. Chain of Responsibility pattern

  5. Subscribe pattern

  6. Proxy pattern.

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Observer defines one-to-many dependency: when subject changes, all dependents are notified automatically. This IS publish-subscribe: publishers (subjects) broadcast to subscribers (observers) without knowing who they are. The pattern decouples event generation from event handling.