volume_mute

Identifying the Right Pattern

publish date2026/06/12 10:18:13.394056 UTC

volume_mute

A data visualization dashboard displays the same dataset as both a pie chart and a bar chart. When the underlying data changes, both charts must automatically refresh. Which design pattern is most appropriate?

Correct Answer

Observer - to separate the data object from its multiple display representations and automatically notify all displays when state changes

Explanation

This scenario matches the Observer pattern exactly: multiple displays (pie chart, bar chart) of the same data (Subject), where changes to the data must automatically update all displays. The Observer pattern separates the display of state from the object itself and notifies all attached observers (displays) when the subject state changes. This is precisely the 'multiple displays of state information' problem the Observer was designed to solve.

Reference

Software Engineering, Ian Sommerville, 10th edition


Quizzes you can take where this question appears