Traversals of object structures
Specification and efficient implementation
Article Ecrit par: Lieberherr, K. ; Orleans, D. ; Patt-Shamir, B. ;
Résumé: Separation of concerns and loose coupling of concerns are important issues in software engineering. In this paper we show how to separate traversal-related concerns from other concerns, how to loosely couple traversal-related concerns to the structural concern, and how to efficiently implement traversal-related concerns. The stress is on the detailed description of our algorithms and the traversal specifications they operate on. Traversal of object structures is a ubiquitous routine in most types of information processing. Ad hoc implementations of traversals lead to scattered and tangled code and in this paper we present a new approach, called traversal strategies, to succinctly modularize traversals. In our approach traversals are defined using a high-level directed graph description, which is compiled into a dynamic road map to assist run-time traversals. The complexity of the compilation algorithm is polynomial in the size of the traversal strategy graph and the class of graph of the given application. Prototypes of the system have been developed and are being successfully used to implement traversals for Java and Aspect J <degree>Kiczales et al. 2001<pilcrow> and for generating adapters for software components. Our previous approach, called traversal specifications <degree>Lieberherr 1992; Palsberg et al. 1995<pilcrow>, was less general and less succinct, and its compilation algorithm was of exponential complexity in some cases. In an additional result we show that this bad behavior is inherent to the static traversal code generated by previous implementations, where traversals are carried out by invoking methods without parameters.
Langue:
Anglais