Beyond Ordinary Operations
Different classes can implement an operation in different ways. In other words, Java supports polymorphism. The power of this seemingly simple idea appears in several design patterns.
| If you intend to
| Apply the pattern
|
Implement an algorithm in a method, deferring the definition of some steps of the algorithm so that subclasses can redefine them Distribute an operation so that each class represents a different state Encapsulate an operation, making implementations interchangeable Encapsulate a method call in an object Distribute an operation so that each implementation applies to a different type of composition
| Template Method (Chapter 21)
State (Chapter 22)
Strategy (Chapter 23)
Command (Chapter 24)
Interpreter (Chapter ... |