Chapter 25. Interpreter

As with the COMMAND pattern, the INTERPRETER pattern produces an executable object. The patterns differ in that INTERPRETER involves the creation of a class hierarchy in which each class implements (or interprets) a common operation in a way that matches the class's name. In this regard, INTERPRETER is similar to the STATE and STRATEGY patterns. In INTERPRETER, STATE, and STRATEGY, a common operation appears throughout a collection of classes, with each class implementing the operation in a different way.

The INTERPRETER pattern is also similar to the COMPOSITE pattern that defines a common interface for individual items and groups of items. COMPOSITE does not require different, interesting ways of forming groups, although ...

Get Design Patterns in C# now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.