|
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
|
Curtis Clifton , Gary T. Leavens , Craig Chambers , Todd Millstein, MultiJava: modular open classes and symmetric multiple dispatch for Java, Proceedings of the 15th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, p.130-145, October 2000, Minneapolis, Minnesota, United States
|
| |
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
|
Antonio Cunei , Jan Vitek, PolyD: a flexible dispatching framework, Proceedings of the 20th annual ACM SIGPLAN conference on Object oriented programming, systems, languages, and applications, October 16-20, 2005, San Diego, CA, USA
|
| |
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
|
Xavier Leroy, Manifest types, modules, and separate compilation, Proceedings of the 21st ACM SIGPLAN-SIGACT symposium on Principles of programming languages, p.109-122, January 16-19, 1994, Portland, Oregon, United States
[doi> 10.1145/174675.176926]
|
| |
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
|
Martin Odersky , Matthias Zenger, Scalable component abstractions, Proceedings of the 20th annual ACM SIGPLAN conference on Object oriented programming, systems, languages, and applications, October 16-20, 2005, San Diego, CA, USA
|
| |
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
|
Peri Tarr , Harold Ossher , William Harrison , Stanley M. Sutton, Jr., N degrees of separation: multi-dimensional separation of concerns, Proceedings of the 21st international conference on Software engineering, p.107-119, May 16-22, 1999, Los Angeles, California, United States
[doi> 10.1145/302405.302457]
|
| |
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
|
Joost Visser, Visitor combination and traversal control, Proceedings of the 16th ACM SIGPLAN conference on Object oriented programming, systems, languages, and applications, p.270-282, October 14-18, 2001, Tampa Bay, FL, USA
|
|