This chapter covers the Visitor pattern.
GoF Definition
It represents an operation to be performed on the elements of an object structure. The Visitor pattern lets you define a new operation without changing the classes of the elements on which it operates.
Concept
This pattern can be used in many different scenarios. Using this pattern, you often add new operations to an object without modifying its class definition. To achieve this, you separate an algorithm from the object structure. This may sound surprising to you, but ...