12 The Observer Design Pattern
This chapter covers
- The Observer Design Pattern
In this chapter, we continue with the theme of sports reports generated by a college athletics department. The Observer Design Pattern supports the publisher–subscriber model, where one component creates data objects that subscriber components process individually, each in its own way. The publisher component doesn’t know how the subscriber components are implemented nor does it care what the subscribers do with the data.
Our example application monitors the progress of a baseball game. It prints game statistics both while the game is in progress and after it is over.
NOTE Be sure to read the introduction to part 4 for important information about design patterns ...
Get Object-Oriented Software Design in C++ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.