Multiple choice technology architecture

The Observer pattern:

  1. Is a behavioral pattern that defines how a single class can be notified of a change

  2. Consider the objects displaying the data and the objects containing the data as a single entity.

  3. Is also known as the publish-subscribe model where an object can publish an event that has no subscribers

  4. None of the above

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

The Observer pattern (also called Publish-Subscribe) defines a one-to-many dependency between objects, so that when one object changes state, all its dependents are notified and updated automatically. Publishers (subjects) maintain a list of subscribers (observers) and notify them of state changes. Option C correctly identifies this as the publish-subscribe model and notes that events can have zero subscribers (publishing is independent of subscription). Option A incorrectly limits notification to a single class. Option B incorrectly suggests Observer merges data and display into one entity, when it actually separates them. Option D is incorrect since option C is valid.