next up previous
Next: TRAVERSALS Up: Preventive Program Maintenance in Previous: Keywords

INTRODUCTION

Adaptive Programming (AP) has been described in several papers, theses and a book [5]. The idea of AP is to write programs in terms of traversal strategies, and to customize into detailed traversals using specific class diagrams. The traversal strategies are simpler than the detailed traversals, leading to more flexible and simpler programs.

Demeter/Java is an implementation of AP for Java in the form of an efficiently executable design language. In Demeter/Java we add an innovation to AP: an improved form of the Visitor pattern from [2] is provided by the design language. The Visitor pattern allows one to express a traversal through objects defined by a class diagram and to reuse the traversal with several visitor objects. The visitor objects define the behavior which needs to be implemented on top of the traversal. The Visitor pattern has the disadvantage that the traversal code is spread out across the class diagram, and changes to the class diagram lead to many tedious updates of the traversals and visitors.

In Demeter/Java, the Visitor pattern is improved by not writing the traversals explicitly in an object-oriented language, but by using a traversal specification language. This leads to a separation of behaviors and interconnections between them. The visitor objects describe the important behavior, and traversal specifications approximately specify how visitors are connected. Finally, a UML (Unified Modeling Language) [1] class diagram provides all the details to customize a traversal specification into a detailed traversal expressed in an object-oriented language.



Karl Lieberherr
Fri Nov 15 14:30:41 EST 1996