5.7. Document-View

The Document-View pattern is also known as the Document-View architecture. In this section we’ll discuss a refined version of the Document-View pattern that allows for an event notification mechanism. This refined version is sometimes called the Observable-Observer pattern, or the Publisher-Subscriber pattern.

The problem arises when you have a number of different representations of the same data. How do we keep the representations in synch with each other?

The solution, as shown in Figure 5.9, is to have one Document (or Publisher ) class that holds the core data, and to have a range of View (or Subscriber ) classes that display the data. To smooth out our exposition, we’ll write ‘document’ or ‘view’ to mean, respectively, ...

Get Software Engineering and Computer Games now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.