The Observer pattern:
-
Is a behavioral pattern that defines how a single class can be notified of a change
-
Consider the objects displaying the data and the objects containing the data as a single entity.
-
Is also known as the publish-subscribe model where an object can publish an event that has no subscribers
-
None of the above
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.