🎴 Flashcard Mode
Java Constructors and Design Patterns Quiz
Card1 / 20
Mastered0
Review0
QuestionClick to flip
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?
AnswerClick to flip back
A
Observer pattern
💡 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.