Pub Sub
An entire software application usually consists of several parts, called modules. Consider, for example, a web browser, which has a Tabs module, an Address Bar module, a Bookmarks module, and a Webpage View module (see Figure 15.6). To keep the code clean and organized, the modules should not have direct references to each other (in programmer-speak, the modules should not know about each other), because if two modules directly reference each other, they might as well be one module. If all the modules directly reference all the other modules, you end up with one giant module that is hard to maintain and nearly impossible to understand. Yet the different modules need to be able to communicate in some way. For instance, when a tab is selected, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access