A Case of Visitor versus Interpreter Pattern

Abstract

We compare the Visitor pattern with the Interpreter pattern, investigating a single case in point for the Java language. We have produced and compared two versions of an interpreter for a programming language. The first version makes use of the Visitor pattern. The second version was obtained by using an automated refactoring to transform uses of the Visitor pattern to uses of the Interpreter pattern. We compare these two nearly equivalent versions on their maintenance characteristics and execution efficiency. Using a tailored experimental research method we can highlight differences and the causes thereof. The contributions of this paper are that it isolates the choice between Visitor and Interpreter in a realistic software project and makes the difference experimentally observable.

Publication
Proceedings of the 49th International Conference on Objects, Models, Components, and Patterns (TOOLS 2011)
Mark Hills
Mark Hills
Associate Professor

My research interests include programming languages, program analysis, and software engineering.