A Case of Visitor versus Interpreter Pattern

  • Mark Hills
  • Paul Klint
  • Tijs van der Storm
  • Jurgen Vinju
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6705)


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.


Virtual Machine Design Pattern Atomic Action Composite Pattern Runtime Performance 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Benbasat, I., Goldstein, D.K., Mead, M.: The case research strategy in studies of information systems. MIS Q. 11, 369–386 (1987)CrossRefGoogle Scholar
  2. 2.
    Chatzigeorgiou, A., Tsantalis, N., Deligiannis, I.S.: An empirical study on students’ ability to comprehend design patterns. Computers & Education 51(3), 1007–1016 (2008)CrossRefGoogle Scholar
  3. 3.
    Coleman, D., Ash, D., Lowther, B., Oman, P.: Using metrics to evaluate software system maintainability. Computer 27, 44–49 (1994)CrossRefGoogle Scholar
  4. 4.
    Cook, W.R.: On understanding data abstraction, revisited. In: Proceedings of OOPSLA 2009, pp. 557–572. ACM Press, New York (2009)Google Scholar
  5. 5.
    Eden, A., Mens, T.: Measuring Software Flexibility. IEE Proceedings—Software 153(3), 113–125 (2006)Google Scholar
  6. 6.
    Fleming, S.D., Kraemer, E., Stirewalt, R.E.K., Dillon, L.K., Xie, S.: Refining Existing Theories of Program Comprehension During Maintenance for Concurrent Software. In: Proceedings of ICPC 2008, pp. 23–32. IEEE, Los Alamitos (2008)Google Scholar
  7. 7.
    Gamma, E., Helm, R., Johnson, R.E., Vlissides, J.: Design Patterns. Elements of Reusable Object-Oriented Software. Addison-Wesley, Reading (1995)zbMATHGoogle Scholar
  8. 8.
    Hannemann, J., Kiczales, G.: Design pattern implementation in Java and AspectJ. In: Proceedings of OOPSLA 2002, pp. 161–173. ACM Press, New York (2002)Google Scholar
  9. 9.
    Heitlager, I., Kuipers, T., Visser, J.: A practical model for measuring maintainability. In: Proceedings of QUATIC 2007, pp. 30–39. IEEE, Los Alamitos (2007)Google Scholar
  10. 10.
    Henderson-Sellers, B.: Object-oriented metrics: measures of complexity. Prentice-Hall, Englewood Cliffs (1996)Google Scholar
  11. 11.
    Hills, M.: Rascal Visitor to Interpreter (V2I) Transformation,
  12. 12.
    International Standard, I.: - ISO/IEC 14764 IEEE Std 14764-2006. ISO/IEC 14764:2006 (E) IEEE Std 14764-2006 Revision of IEEE Std 1219-1998), pp. 1–46 (2006)Google Scholar
  13. 13.
    Klint, P., van der Storm, T., Vinju, J.: EASY meta-programming with rascal. In: Fernandes, J.M., Lämmel, R., Visser, J., Saraiva, J. (eds.) Generative and Transformational Techniques in Software Engineering III. LNCS, vol. 6491, pp. 222–289. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  14. 14.
    Littman, D.C., Pinto, J., Letovsky, S., Soloway, E.: Mental models and software maintenance. In: Proceedings of the First Workshop on Empirical Studies of Programmers, pp. 80–98. Ablex Publishing Corp. (1986)Google Scholar
  15. 15.
    Mens, T., Eden, A.H.: On the Evolution Complexity of Design Patterns. In: Proceedings of SETra 2004. ENTCS, vol. 127, pp. 147–163 (2004)Google Scholar
  16. 16.
    Oman, P., Hagemeister, J.: Construction and testing of polynomials predicting software maintainability. J. Syst. Softw. 24, 251–266 (1994)CrossRefGoogle Scholar
  17. 17.
    Prechelt, L., Unger, B., Tichy, W.F., Brössler, P., Votta, L.G.: A Controlled Experiment in Maintenance Comparing Design Patterns to Simpler Solutions. IEEE Transactions on Software Engineering 27(12), 1134–1144 (2001)CrossRefGoogle Scholar
  18. 18.
    Wadler, P.: The expression problem (November 1998), (accessed January 2011)
  19. 19.
    Wender, K.F., Schmalhofer, F., Böcker, H.-D. (eds.): Cognition and computer programming. Ablex Publishing Corp. (1995)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2011

Authors and Affiliations

  • Mark Hills
    • 1
    • 2
  • Paul Klint
    • 1
    • 2
  • Tijs van der Storm
    • 1
  • Jurgen Vinju
    • 1
    • 2
  1. 1.Centrum Wiskunde & InformaticaAmsterdamThe Netherlands
  2. 2.INRIA Lille Nord EuropeFrance

Personalised recommendations