DemeterJ: Adaptive and Aspect-Oriented Programming in Java
Demeter Research Group, Northeastern University, College of Computer Science, Boston
- What does the product do? DemeterJ is a tool which allows you to
write aspect-oriented Java programs
are easy to evolve and reuse. The product is
the result of 10 years of research/development in Adaptive Programming (AP)
which started with the Law of Demeter. The techniques to achieve adaptive
programming are to add strategic information about traversals and objects
to Java programs and to follow style rules, such as the
Law of Demeter. See
The program takes as input Java programs extended with additional aspect
descriptions and translates the extended Java programs to ordinary Java
- Why is the product useful? The product has the following benefits compared
to unextended Java: (1) Programs become more flexible and adapt automatically
to a wide variety of structural changes. (2) Programs are more readable
since traversal strategies are a part of the program, i.e., the programmer's
high-level intentions are encoded directly into the program code (as traversal
strategies), rather than having to be written as comments or external documentation.
This means that a part of the rationale capture for the program is an integral
part of the program itself. Without the explicit traversal strategies,
the programs are harder to read since often a large number of function
calls would need to be studied to get the equivalent information in the
strategies. (3) Programs become shorter because traversal strategies
are shorter than the detailed traversals. The current version of the product
supports adaptive object-oriented programming with the following aspects
using widely used notations: The basic behavior is expressed in a
language which has Java embedded in it.
The language supports a traversal/visitor
style of programming following a significant
improvement to the Visitor design pattern. The object structure
aspect is expressed in UML (Unified Modeling Language of Rational et al.)
and the domain-specific language aspect is expressed in an extension to
UML using an EBNF style syntax.
Other aspects, including the synchronization aspect and the remote invocation
aspect, are also supported. AP Studio is a graphical user interface
for DemeterJ. It supports
visualization of and visual development of DemeterJ programs, especially
traversal strategies embedded in UML class diagrams.
For further information regarding the usefulness of the adaptive and
see the OOPSLA 98 paper on "Adaptive Plug-and-Play Components for
Evolutionary Software Development" by Mezini and Lieberherr
DemeterJ is a high-level
interface to the programming language Java which allows you
to write Java programs adaptively. The compiler
is accompanied by a graphical user interface, called AP Studio,
which allows you to develop key components of adaptive programs graphically.
- Platforms. DemeterJ is implemented in DemeterJ and available
in 100% pure Java source form. It runs on all platforms where Java runs.
DemeterJ uses the Java Compiler Compiler.
DemeterJ (1996-*) is the successor of Demeter/C++ (1989-1996)
several improvements to the Adaptive Programming technology.
Adaptive Programming is the special case of Aspect-Oriented Programming
where one of the building
blocks is expressible in terms of graphs and
where the other building blocks refer to the graphs using
traversal strategies. A traversal strategy is
a partial specification of a class diagram pointing out a few
cornerstone classes and relationships. Traversal strategies may
be viewed as regular expressions specifying a traversal through a graph.
DemeterJ has the following features:
Supports the building blocks (aspects): Object Structure, Collaborations, Object Description,
Synchronization, and Remote Invocation.
Has extensive support for the ubiquitous Visitor design pattern.
Allows you to follow the Law of Demeter in an ideal way.
Generates a visitor library from a class dictionary for example for
printing, comparing and copying objects.
Provides a generic aspect weaver for Java.
Uses JavaCC to create parsers.
Is all written in Java as a DemeterJ program (implementation
in its own technology).
Contains a reusable AP Library which implements
the core technology behind adaptive programming. The AP Library
is reusable to add adaptiveness to other tools.
Short paper on DemeterJ.
Book on Demeter/C++ but much of it applies to DemeterJ.
The implementors of the Java tools are (building on the work of the
Demeter/C++ team: Xiao/Huersch/Silva-Lepe):
Doug Orleans: principal architect and implementor
Johan Ovlinger: Traversals as objects, remote invocation aspect,
Josh Marshall: Generic Aspect Weaver, synchronization aspect
Crista Lopes: Provided design for synchronization and remote invocation aspects
Kedar Patankar: principal architect and implementor GUI
Binoy Samuel: principal architect and implementor AP Studio front-end
Karl Lieberherr (PI) firstname.lastname@example.org,
Jens Palsberg (Purdue University),
Supported by DARPA and Rome Laboratory under agreement
F30602-96-0239 (Evolution of Software Via Adaptive Programming).
version February 11, 2002