Demeter/Java and AP Studio Resources .
Demeter/Java and AP Studio Success Stories .
Maintaining and evolving Java programs is very time consuming.
This page informs you how to write your Java programs in a much
more reusable form, called the adaptive form.
You reuse all your Java knowledge and learn a design language on top
of Java. The two important features of the design language are:
Traversals and Visitors. Demeter/Java enforces correct use of the
Visitor Design pattern in complex applications.
The Visitor Design pattern is directly supported in the executable
design language which is on top of Java.
How to use my
book on adaptive programming (AP) to learn adaptive programming in Java
is described in
AP Book Reuse for Java.
A
simple example comparing the book notation
with the Demeter/Java notation
written by Doug Orleans, the developer of Demeter/Java.
A new 2 page introduction to
adaptive programming in Java .
Poster about adaptive programming with Demeter/Java .
Answers to recent messages about Demeter/Java
.
Examples of Demeter/Java programs and translation to Java.
The Demeter Method adapted to Demeter/Java
.
Demeter/Java for Demeter/C++ users
.
HOME PAGE OF 1997 NTU COURSE using Demeter/Java
.
Success with visitor/traversal style programming in conventional
C++ environment at Hewlett-Packard
.
Design Issues and Decisions behind Demeter/Java: explains the rationale
behind the many decisions.
.
Demeter/Java Copyright Notice
.
Demeter Home Page
.
Conceptual papers
Foundations of Software Engineering paper on context objects
http://www.ccs.neu.edu/research/demeter/biblio/context.html
A comparison between Demeter/Java and context objects:
ftp://ftp.ccs.neu.edu/pub/people/lieber/demeter-java-context.txt
Linda Seiter's PhD thesis
http://www.ccs.neu.edu/home/lieber/theses-index.html
Reflection paper
ftp://ftp.ccs.neu.edu/pub/people/crista/papers/reflection96.ps
--------------------------
The Motto behind Adaptive Programming:
The more ambitious plan may have more chances of success
provided it is not based on mere pretension
but on some vision of the things beyond those immediately present.
George Polya in How To Solve It
--------------------------
Introduction
Adaptive Programming (AP) has evolved through two object-oriented programming
languages: The predecessor of Common Lisp (Flavors) and C++. AP is
now moving to Java. AP provides a high-level interface to
object-oriented programming through class dictionaries
and adaptive behavior specifications. AP allows you to specify
the strategy behind your programs while the detailed programs are
produced automatically from an instantiation of the strategy.
This leads to programs which are easier to evolve and maintain.
Demeter/Java is implemented as a preprocessor to Java which requires
you to learn a small extension language to Java. You use
your favorite Java development system to develop your programs.
Fortunately, the extension language is now even
smaller than in Demeter/C++ because
of the use of context objects. Demeter/Java uses classes and
their relationships also to express behavior modifications.
The extension language has a very Java-like syntax.
Another nice feature of Demeter/Java is its direct support for
programming with the Visitor Pattern described in the Design Pattern
book by Gamma et al.
Guy Steele, in one of his Java presentations, used the quote
A data structure is just a stupid programming language.
(R. Wm. Gosper)
AP takes this point of view seriously. It even lets you define
a syntax for the stupid programming language and it lets you
implement the language in a structure-shy way.
Similarities
While Java and the class libraries define an impressive programming
system and Demeter is an add-on to Java and other object-oriented
programming languages, Java and Demeter have many similarities:
-
Both have no explicit
pointers.
Variables that appear to hold an object contain a reference to that
object.
Demeter class dictionaries don't support pointers.
-
Java has a class Object which is the superclass of all classes.
All arrays are implicit subclasses of Object and so are the
String and StringBuffer classes and the
wrapper classes such as Integer, Long, Float.
Demeter has a similar organization:
Universal corresponds to Object; Repetition corresponds to
array classes (ordered collections). Demeter's
class Terminal corresponds approximately to wrapper classes.
-
Java's abstract classes must be subclassed but must
not be instantiated. This is the role of Demeter's alternation classes.
Java and Demeter also support the dual: classes which must not be subclassed
but which (usually) must be instantiated. Java calls
such classes final classes while Demeter calls them
construction classes.
Java does not follow the abstract superclass rule (ASR): All superclasses
must be abstract.
-
Single inheritance. The Demeter Tools/C++ only support single
implementation inheritance and so does Java.
-
Java provides some support for cloning objects while Demeter
provides full support. Traversal specifications may be used
to achieve different levels of cloning between deep and shallow.
Demeter/Java
AP is a generic technology with many different implementations.
The Demeter Tools/C++ provide one possible implementation and
Demeter Tools/Java will be another one.
Demeter/Java is an abbreviation for Demeter Tools/Java.
Demeter/Java offers the following improvements over
Demeter Tools/C++:
-
You get all the benefits which Java has over C++. All facilities
of Java are available.
-
Better customizer support.
You can describe the customizers of adaptive programs by using
a combination of Java's class syntax and Demeter's class dictionary
syntax. When you use Java's syntax you may define subclasses of
non-abstract classes which is impossible with class dictionaries.
User classes defined with Java syntax don't support parsing and printing
of objects, unless it is manually implemented.
Class dictionary defined classes have automatic support for
parsing and printing of objects.
-
Support for the Visitor design pattern.
Demeter/Java has strong support for traversals and
visitor objects. Traversals may be specified succinctly.
Demeter/Java uses Java methods to define adaptive behavior.
A Java method may use several traversals and visitor objects.
The Demeter Tools/C++ allow only one traversal per method
(propagation pattern). Propagation patterns no longer exist directly in
Demeter/Java but they may be expressed by a method which uses
one traversal and visitors.
Transportation patterns no longer exist directly in Demeter/Java but
they may be expressed using visitors with subtraversals.
-
Modularization of class dictionaries, using Java's packages.
Class dictionaries may contain hundreds of classes which
need to be partitioned into simpler components. For example,
the class dictionary for Demeter/Java contains:
classes to define customizers,
classes to define traversals,
classes to attach visitors to traversals,
etc. Therefore we need a partitioning into at least three sub
class dictionaries. Java's packages provide support for the
partitioning, using qualified names and import statements and
nested packages. The package names are of the form: EDU.neu.ccs.demeter.*
-
Feature control.
To allow the generation of small byte codes which can be transmitted
fast through the network, Demeter/Java
will support a feature object which allows selection of the following
generic features:
parsing, printing, copying, comparison, etc.
-
Demeter Tools/C++ support the ASR (Abstract Superclass Rule =
all super classes must be abstract) which may be too restrictive.
Demeter/Java does not follow ASR for selected classes.
This project is a
DARPA/ITO-funded research effort.
Demeter Home Page
.