Design Patterns Java™ Workbook

(Michael S) #1
Chapter 25. Interpreter

composition rule determines how the class implements, or interprets, an operation that you
distribute throughout the hierarchy.


The operation in an interpreter is often named execute() or evaluate(). The operation
name is necessarily vague, becoming meaningful only when combined with the name of the
class that implements it. Like STATE, STRATEGY, and COMMAND, the INTERPRETER pattern
fixes the name of an operation and uses various classes to implement the operation.
INTERPRETER applies this idea to let you compose executable objects according to a set of
composition rules that you define.

Free download pdf