ACM Home Page
Please provide us with feedback. Feedback
The visitor pattern as a reusable, generic, type-safe component
Full text PdfPdf (286 KB)
Source
Conference on Object Oriented Programming Systems Languages and Applications archive
Proceedings of the 23rd ACM SIGPLAN conference on Object-oriented programming systems languages and applications table of contents
Nashville, TN, USA
SESSION: Type systems table of contents
Pages 439-456  
Year of Publication: 2008
ISBN:978-1-60558-215-3
Also published in ...
Authors
Bruno C.d.S. Oliveira  University of Oxford, Oxford, United Kingdom
Meng Wang  University of Oxford, Oxford, United Kingdom
Jeremy Gibbons  University of Oxford, Oxford, United Kingdom
Sponsors
SIGPLAN: ACM Special Interest Group on Programming Languages
ACM: Association for Computing Machinery
Publisher
ACM  New York, NY, USA
Bibliometrics
Downloads (6 Weeks): 24,   Downloads (12 Months): 242,   Citation Count: 0
Additional Information:

abstract   references   index terms   collaborative colleagues  

Tools and Actions: Request Permissions Request Permissions    Review this Article  
DOI Bookmark: Use this link to bookmark this Article: http://doi.acm.org/10.1145/1449764.1449799
What is a DOI?

ABSTRACT

The VISITOR design pattern shows how to separate the structure of an object hierarchy from the behaviour of traversals over that hierarchy. The pattern is very flexible; this very flexibility makes it difficult to capture the pattern as anything more formal than prose, pictures and prototypes.

We show how to capture the essence of the VISITOR pattern as a reusable software library, by using advanced type system features appearing in modern object-oriented languages such as Scala. We preserve type-safety statically and modularly: no reflection or similar mechanisms are used and modules can be independently compiled. The library is generic, in two senses: not only is it parametrised by both the return type and the shape of the object hierarchy, but also it allows a number of implementation choices (internal versus external control, imperative versus functional behaviour, orthogonal aspects such as tracing and memoisation) to be specified by parameters rather than fixed in early design decisions. Finally, we propose a generalised datatype-like notation,on top of our visitor library: this provides a convenient functional decomposition style in object-oriented languages.


REFERENCES

Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.

 
1
Jonathan Aldrich. Open modules: Modular reasoning about advice. In LNCS 3586: European Conference on Object-Oriented Programming, pages 144--168, 2005.
 
2
Karine Arnout. Pattern Componentization. PhD thesis, Swiss Institute of Technology, March 2004.
 
3
 
4
 
5
Corrado Bohm and Alesssandro Berarducci. Automatic synthesis of typed lambda-programs on term algebras. Theoretical Computer Science, 39(2-3):135--153, August 1985.
 
6
Peter Buchlovsky and Hayo Thielecke. A type-theoretic reconstruction of the Visitor pattern. Electronic Notes in Theoretical Computer Science, 155, 2005. Mathematical Foundations of Programming Semantics.
 
7
Bryan Chadwick and Karl Lieberherr. Functional Adaptive Programming with DemeterF. Technical Report NU-CCIS-08-March19, Northeastern University, Boston, March 2008.
 
8
Bryan Chadwick, Therapon Skotiniotis, and Karl Lieberherr. Functional Visitors Revisited. Technical Report NU-CCIS-06-03, Northeastern University, Boston, May 2006.
9
 
10
Alonzo Church. An unsolvable problem of elementary number theory. American Journal of Mathematics, 58:345--363, 1936.
11
 
12
Vincent Cremet and Philippe Altherr. Adding type constructor parameterization to Java. Journal of Object Technology, 7(5):25--65, June 2008. Special issue on ECOOP 2007 Workshop on Formal Techniques for Java-like Programs.
13
 
14
15
 
16
 
17
Jeremy Gibbons. Patterns in datatype-generic programming. In J. Striegnitz, editor, Declarative Programming in the Context of Object-Oriented Languages, Uppsala, 2003.
18
 
19
Jeremy Gibbons and Bruno Oliveira. The essence of the Iterator pattern. Journal of Functional Programming, 2008.
 
20
 
21
Christian Grothoff. Walkabout revisited: The Runabout. In LNCS 2743: European Conference on Object-Oriented Programming, pages 103--125, 2003.
 
22
Stephan Gudmundson and Gregor Kiczales. Addressing practical software development issues in AspectJ with a pointcut interface. In ECOOP 2001 Workshop on Advanced Separation of Concerns, 2001.
23
24
25
 
26
Gregor Kiczales, John Lamping, Anurag Menhdhekar, Chris Maeda, Cristina Lopes, Jean-Marc Loingtier, and John Irwin. Aspect-oriented programming. In Mehmet Aks 'it and Satoshi Matsuoka, editors, LNCS 1241: European Conference on Object-Oriented Programming, pages 220--242, 1997.
27
 
28
Doug McIlroy. Mass produced software components. In Naur and Randell (1969), pages 138--155.
 
29
Lambert Meertens. Paramorphisms. Formal Aspects of Computing, 4(5):413--425, 1992.
30
 
31
 
32
 
33
Donald Michie. Memo functions and machine learning. Nature, 218:19--22, 1968.
 
34
Adriaan Moors, Frank Piessens, and Martin Odersky. Towards equal rights for higher-kinded types. In 6th International Workshop on Multiparadigm Programming with Object-Oriented Languages, 2007.
 
35
Peter Naur and Brian Randell, editors. Software Engineering: Report of a Conference Sponsored by the NATO Science Committee, Garmisch, Germany, 7-11 Oct. 1968. 1969.
 
36
Peter Norvig. Design patterns in dynamic programming. In Object World 96, May 1996.
 
37
Martin Odersky. An Overview of the Scala programming language (second edition). Technical Report IC/2006/001, EPFL Lausanne, Switzerland, 2006.
 
38
Martin Odersky and Matthias Zenger. Independently extensible solutions to the expression problem. In Proceedings of Foundations of Object-Oriented Languages 12, January 2005a. http://homepages.inf.ed.ac.uk/wadler/fool.
39
 
40
Bruno C.d.S. Oliveira. Genericity, Extensibility and Type-Safety in the Visitor Pattern. PhD thesis, University of Oxford, 2007.
 
41
 
42
 
43
 
44
Simon Peyton Jones, editor. Haskell 98 Language and Libraries - The Revised Report. Cambridge University Press, Cambridge, England, 2003.
 
45
46
 
47
Clemens Szyperski. Independently extensible systems - software engineering potential and challenges. In 19th Australian Computer Science Conference, 1996.
48
 
49
Thomas VanDrunen and Jens Palsberg. Visitor-oriented programming. In Proceedings of FOOL-11, the 11th ACM SIGPLAN International Workshop on Foundations of Object-Oriented Languages, New York, NY, USA, January 2004. ACM Press.
50

Collaborative Colleagues:
Bruno C.d.S. Oliveira: colleagues
Meng Wang: colleagues
Jeremy Gibbons: colleagues