Chapter 6. Encapsulating Invocation: The Command Pattern
In this chapter, we take encapsulation to a whole new level: we’re going to encapsulate method invocation. That’s right—by encapsulating method invocation, we can crystallize pieces of computation so that the object invoking the computation doesn’t need to worry about how to do things, it just uses our crystallized method to get it done. We can also do some wickedly smart things with these encapsulated method invocations, like save them away for logging or reuse them to implement undo functionality in our code.
Home Automation or Bust, Inc.
Free hardware! Let’s check out the Remote Control...
Taking a look at the vendor classes
Let’s check out the vendor classes the CEO attached to his email. These should give you some idea of the interfaces of the objects we need to control from the remote.
It looks like we have quite a set of classes here, and not a lot of industry effort to come up with a set of common interfaces. Not only that, it sounds like we can expect more of these classes in the future. Designing a ...
Get Head First Design Patterns, 2nd Edition 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.