Identifying the Right Pattern
publish date: 2026/06/12 10:18:13.394056 UTC
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
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
