volume_mute

Observer Pattern - When to Use

publish date2026/06/13 06:39:43.551603 UTC

volume_mute

The Observer pattern is most appropriate in which of the following situations? Select ALL that apply.

Correct Answer

(1) When there are multiple ways to view and interact with data and the specific display formats are not known to the object maintaining the state
(2) When more than one display format for state information is required
(3) When it is not necessary for the object that maintains state to know about the specific display formats used
(4) When you need to tell several objects that the state of some other object has changed

Explanation

The Observer pattern is used when: multiple display formats are required for the same data; the object maintaining state should not need to know the display formats; you need to automatically notify multiple objects of a state change. It is NOT appropriate when a single fixed UI is tightly coupled to the data - in that case, the separation overhead is unnecessary.

Reference

Software Engineering, Ian Sommerville, 10th edition


Quizzes you can take where this question appears