Chapter 20

Managing the System

In This Chapter

  • Processing commands
  • Managing multiple views

When I was working on my first object-oriented project as part of a team, our consultant told us that if we identified an object with the name “something manager,” we should beware. The problem is that manager objects can start to take on more and more responsibility, making the objects that are managed very lightweight — and preventing a clean object-oriented design.

But creating objects that will “manage” other objects helps when the other objects to be managed are similar and perform the application's real work. In the two design patterns in this chapter, the collections of objects are commands and views.

images

Keep your manager objects simple and their responsibilities truly managerial. Let the objects that they manage do the actual work.

This chapter describes two patterns that you can use to manage different situations. Command Processor, the first pattern, helps when you're implementing an application that has user commands. The second pattern, View Handler, aids your application when it has different displays to handle — like the Model-View-Controller (MVC) and Presentation-Abstraction-Controller (PAC) architectures (see Chapters 13 and 14, respectively).

Get Pattern-Oriented Software Architecture For Dummies 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.