\documentstyle[twocolumn,icse97]{article}


\begin{document}

\title{Evolution of Software Via Adaptive Programming}

\author{
        \parbox{3.5in} {\begin{center}
	{\authornamefont Karl J. Lieberherr}\\
	Northeastern University, College of Computer Science, 161 Cullinane Hall \\
	Boston, MA 02115-9959 USA \\
	(617) 373 2077 Fax: (617) 373 5121 \\
	lieberherr@ccs.neu.edu \\
	Demeter home page: http://www.ccs.neu.edu/research/demeter\\
	\end{center} }
}


\maketitle
%\copyrightspace

\section{ABSTRACT}
The objective of this project is to improve
the productivity of software developers by an order of
magnitude through tools and a
theory of adaptive programming. To make our results practically useful,
we want to leverage existing commercial
technology such as Java and the
Unified Modeling Language (UML).


Our recent work has focussed on rethinking our Demeter/C++ tools and
corresponding theory and to implement the new results in Demeter/Java.
Demeter/Java is an implementation of Adaptive Programming (AP) for
Java. Demeter/Java programs consist of Java code together with
programs in a small language to express traversals, visitor methods,
and class diagrams.  
Demeter/Java programs are typically written in a
preventive maintenance style using traversal strategies for expressing
traversals. The resulting programs are very robust under changes
to the class diagrams and visitors. 
This preventive maintenance style also leads to
simpler programs, making both software development and maintenance
easier.

\subsection{Keywords}
software evolution, aspect-oriented programming

\section{INTRODUCTION}

%what is AP?
Adaptive Programming (AP) has been described in several papers, theses
and a book (see Demeter home page and \cite{karl:demeter}). 
The idea of AP is
to consider structure and navigation through structures as 
separate aspects \cite{sdcr:aop,sdcr:acm}.
Adaptive programs are written
in terms of traversal strategies, and then customized
into detailed traversals using specific class diagrams.  The traversal
strategies are simpler than the detailed traversals, leading to more
flexible and simpler programs.

\section{RECENT WORK}
In the following we highlight recent developments.

\subsection{Demeter/Java}

%what is new in Demeter/Java: improving the Visitor 
Demeter/Java \cite{cse:preventive}
is an implementation of AP for Java in the form of an
efficiently executable design language.  In Demeter/Java 
we add several
innovations to AP including an improved form of the Visitor pattern from
\cite{gang-of-4} is provided by the design language. 
Fig. \ref{p1} summarizes the impact of AP on the 
coupling between aspects. The grammar aspect includes class diagrams.
The table holds for both Java and C++.
For example, without AP, traversals and visitors are highly coupled:
The visitor must have a method for each class in the traversal scope.
With AP, the coupling between traversals and visitors is low:
since both traversal strategies and visitors mention only the
``interesting'' classes.

\begin{figure}[htb]


\begin{verbatim}
Aspects    |  Coupling to other aspects
---------------------------------------------
           |             with AP   without AP
           |             --------------------
grammar    |  visitors   low       moderate
---------------------------------------------      
traversals |  grammar    low       high    
           |  visitors   low       high
---------------------------------------------      
object     |  grammar    low       high
description|
\end{verbatim} 

\caption{Aspects of AP}\label{p1}
\end{figure}

Demeter/Java is much closer to Java than Demeter/C++ is to C++.
Much of the syntax for propagation and transportation patterns
could be eliminated from the core of the system. The most
important generalization is probably the use of visitors
instead of wrappers.

While Demeter/C++ uses a home-grown generic parser, Demeter/Java 
uses a commercial parser/scanner generator, namely the
Java Compiler Compiler (JavaCC). JavaCC is used to create objects from robust
object descriptions and an annotated UML class diagram
which represents an LL(1) grammar.
Demeter uses an improved form of the
Interpreter design pattern \cite{gang-of-4}: class definition and grammar
definition are integrated.
Doug Orleans is the lead designer and implementor of Demeter/Java.

While in Demeter/C++ propagation patterns play a central role,
in Demeter/Java they are only syntactic sugar to express certain
commonly occurring traversals and visitors. The insight we gained 
was that propagation patterns were too big of an abstraction which 
is better decomposed into traversals and visitors with an
attachment mechanism of visitors to traversals
\cite{spl:context-conf}.

While in Demeter/C++ traversals are static, in Demeter/Java
with the TAO (traversal as objects) extension, traversals may be computed at
run-time. (Johan Ovlinger)

While in Demeter/C++ generic behavior for copying, printing, etc.
was hardcoded for entire objects, in Demeter/Java you can selectively
copy, print, etc. partial objects. This is accomplished by
providing a CopyVisitor, PrintVisitor, etc. which is attached
to a traversal selecting the subobjects of interest. (Geoff Hulten)

While in Demeter/C++ conditional traversals were expressed
in an unpleasing way, Demeter/Java supports around methods. 
They provide for easier composition and provide also the
foundation for dealing with exceptions in an aspect-oriented
way. (Lars Hansen)


\subsection{AP Studio}

Adaptive programming is a visual programming technique and therefore
we add a graphical user interface  to Demeter/Java.
AP Studio currently allows to visualize class dictionnaries and
to create them graphically. AP Studio allows
to visually design traversal strategies with immediate visual feedback
regarding the selected paths. The plan is to extend AP Studio into
a tool for developing adaptive programs.
(Kedar Patankar and Binoy Samuel)

\subsection{Traversal Strategies}

One of the improvements of the Visitor design patterns 
is the use of traversal strategies. In earlier papers
we called traversal strategies propagation directives or 
traversal specifications. Traversal strategies improve on
traversal specifications by a better, more general model and a better 
compilation algorithm. (Boaz Patt-Shamir)




\section{USE AND AVAILABILITY}
% sales pitch
Several companies see the benefit of both simpler and more
maintainable programs as very important and have adopted AP for C++.
Some use our tools and others
(for example, Hewlett Packard)
use the ideas in a conventional C++ environment.
Demeter/Java makes AP available to the Java community.
Demeter/Java is implemented in Demeter/Java and is 
freely distributed in Java source form 
from the Demeter home page where further information on use
is available. The software is copyrighted but freely redistributable.
%It runs on any platform where Java is available. 
%It is also a convenient
%tool to teach effective object-oriented design techniques.
Demeter/Java is a successful 
teaching tool combined with \cite{karl:demeter}.
It is used in software design and development classes using Java.

\section{RELATED WORK}

Numerous references to related work are in \cite{karl:demeter} and
the Demeter home page.
Recently, aspect-oriented programming from Xerox PARC has emerged as
an area related to AP \cite{sdcr:aop,sdcr:acm}. 
See also http://www.parc.xerox.com/aop.  
The Demeter/Java visitors are inspired by
the context objects in
\cite{spl:context-conf}.

\section{ACKNOWLEDGEMENTS}
This work is supported by DARPA and Rome Laboratory under agreement 
F30602-96-0239 and NSF under grant CCR-9402486 and a grant from Xerox PARC.
John Salasin was influential in guiding this project, both as an NSF 
and a DARPA project.

\bibliographystyle{abbrv}



\begin{thebibliography}{1}

\bibitem{grady-jim:95}
G.~Booch, J.~Rumbaugh, and I.~Jacobson.
\newblock The unified modeling language for object-oriented development.
\newblock Technical report, Rational Software Corporation, 1996.
\newblock http://www.rational.com/ot/uml.html.

\bibitem{gang-of-4}
E.~Gamma, R.~Helm, R.~Johnson, and J.~Vlissides.
\newblock {\em Design Patterns: Elements of Reusable Object-Oriented Software}.
\newblock Addison-Wesley, 1995.

\bibitem{sdcr:acm}
R.~Guerraoui.
\newblock Strategic research directions in object-oriented programming.
\newblock {\em ACM Computing Surveys}, 28(4), December 1996.

\bibitem{sdcr:aop}
G.~Kiczales.
\newblock Aspect-oriented programming.
\newblock {\em ACM Computing Surveys}, 28A(4), December 1996.

\bibitem{cse:preventive}
K.~J. Lieberherr and D.~Orleans.
\newblock Preventive program maintenance in Demeter/Java (research
  demonstration).
\newblock In {\em International Conference on Software Engineering}, 
    Boston, MA, 1997.


\bibitem{karl:demeter}
K.~J. Lieberherr.
\newblock {\em Adaptive Object-Oriented Software: The Demeter Method with
  Propagation Patterns}.
\newblock PWS Publishing Company, Boston, 1996.
\newblock ISBN 0-534-94602-X.

\bibitem{LopesLieberherrReflection96}
C.~V. Lopes and K.~Lieberherr.
\newblock {A}{P}/{S}++: case-study of a {M}{O}{P} for purposes of software
  evolution.
\newblock In {\em Reflection '96}, S. Francisco, CA, April 1996.

\bibitem{spl:context-conf}
L.~M. Seiter, J.~Palsberg, and K.~J. Lieberherr.
\newblock {Evolution of Object Behavior using Context Relations}.
\newblock In D.~Garlan, editor, {\em Symposium on Foundations of Software
  Engineering}, San Francisco, 1996. ACM Press.

\bibitem{wilde-etal:maint-support}
N.~Wilde and R.~Huitt.
\newblock Maintenance support for object-oriented programs.
\newblock {\em IEEE Transactions on Software Engineering}, 18(12):1038--1044,
  December 1992.

\end{thebibliography}
%\bibliography{biblio}
\end{document}


