Variations On The Visitor Pattern

A paper written by Martin E. Nordberg III of Quintessoft Engineering on July 22, 1996. The paper can be downloaded in Post Script format from (as of 20050913):

From the abstract: Two variations on the Visitor Pattern are presented.

A Default Visitor Pattern provides default handlers for cases where the polymorphism of the hierarchy of elements can reduce the cost of code maintenance.

An Extrinsic Visitor Pattern implements double dispatch with run time type information instead of Accept( ) methods. With the same machinery it is possible to test the feasibility of a particular visit before performing its operation. The extrinsic visitor pattern provides several benefits in ease of software development in trade for poorer run time performance.

Interesting design tradeoffs between efficiency and maintainability determine the choice of the standard, default, or extrinsic visitor pattern in an application.



See original on c2.com