next up previous
Next: Class Dictionaries Up: Demeter/Java User Manual Version Previous: Demeter/Java User Manual Version

Subsections

Introducing Demeter

 

Welcome to Demeter, the adaptive object-oriented software development tool. Demeter is designed to help you build high-quality object-oriented software in a productive and timely manner.

Overview of Demeter

The Demeter System is an object-oriented software development environment that allows you to develop adaptive programs. The Demeter tools make it easier for you to create new programs and to maintain and modify the existing ones. The Demeter features include:

The main characteristic of adaptive programs is that they define object behavior without specifying the detailed structure of the objects. Therefore, programs are less dependent on a specific class structure and thus become more adaptive to changes and evolution.

Demeter Basics

Demeter is an object-oriented software development environment. As such, it helps you design the two key components in any object-oriented system: object structure and object behavior. In Demeter, these two components are represented by the concepts of class dictionary and traversal strategies with visitor classes, respectively.

A class dictionary  defines the class structure of an application; that is, it defines the application's classes and the relationships between them. In particular, it describes the inheritance hierarchy and the reference hierarchy of classes. The reference hierarchy consists of all binary relationships other than the inheritance (is-a) relationship. This includes the aggregation (part-of) and uses relationships. The advantage of working with class dictionaries as opposed to Java class definitions is the higher level of abstraction that one gains with class dictionaries. The Demeter tool will automatically take care of Java class definitions. This results in higher flexibility when changes occur.

UML (Unified Modeling Language from Rational) is becoming a standard language for class diagrams. While the Demeter approach can support full UML in principle, the current tools support only the most important subset of UML. On the other hand, class dictionaries are also more general than UML class diagrams because of the grammar feature.

Traversal strategies  along with visitor classes  define a specific behavior for a collection of classes. The behavior of the application as a whole is described by a set of traversal strategies and a set of visitor classes. The advantage of using this combination as opposed to regular Java code is their adaptiveness. Traversals with visitors help to decouple class structure from the behavior of a program by not hard-wiring the details of the class structure into the program. Consequently, the program's behavior is less prone to change when the class structure is modified. In addition, programs written with traversals and visitors are more concise since trivial structure traversal code does not need to be specified and is again left to the tool's code generator.

Installing and Using Demeter

Source Files

In order to use the Demeter tools, you first need to produce the source files containing the class dictionary, traversal strategies, and visitor methods that make up your program. You do this by using any text editor of your choice. According to the Demeter System conventions, these are the types of extensions for source files:

.cd
: contains a Demeter class dictionary, including visitor classes.
.beh
: contains Demeter traversal strategies and visitor methods.
.input
: contains input that can be used to test the program.
.wvr
: these are files used by the aspect weaver.
.cool
: contains Coordination(Cool) information.
.ridl
: contains Remote invocation(Ridl) information.
.prj
: The Demeter/Java project file. This file is generated for you. The nerve center for your project, this file may contain path names or other platform-dependent information. You may need to edit them when moving from one platform to another. Used for generation and compilation. For example, defines CDFILE, the file containing the class dictionary. It has a filename of the form <file>.cd

Any meaningful Demeter application consists of one <file>.cd and one or more <file>.beh. All these files should reside in the application's root directory.

Generated Files

Brief explanation of the files which are Demeter/Java generated[*], usually in directory gen.

Demeter Compiler Options

Usage:
    demjava [ -project projname ] [ -verbose ] [ -debug ] [ -tie ]
            [ module [ module-options ] ]
    demjava -version
    demjava -help
Modules:
    new         Start a new project.
    generate    Generate aspects, grammar, or Java code.
    parsegen    Generate parser Java code from the grammar.
    compile     Compile the Java code into bytecodes.
    test        Test the compiled program.
    clean       Remove all generated files.

Each module runs preceding modules that it depends on, if needed. If no module is specified, the "compile" module will be run, unless there is a .cd file in the arguments, in which case, for backwards compatibility, only the "generate" module will be run.

The -verbose and -debug flags determine the level of output; the -tie flag ties error output to standard output, as it did before. Any unrecognized options before the module name are passed on to the module (again, for backwards compatibility).

The first thing demjava does is to load the project file. If the project name is specified with the "-project projname" option, then the file "projname.prj" is loaded from the current directory; otherwise, if there is exactly one .prj file in the current directory, then it is loaded; otherwise (unless the module is "new") demjava aborts.

A project file is created by "demjava new [projname]", where projname defaults to "program". The project file can then be hand-edited (it's just an ordinary text file) to specify project configuration options as necessary. See the comments in the generated project file for more info on how to customize the project file.

The generate module is the code, grammar, and aspect generator (i.e. the entire demjava program in previous versions). Its options are the same as in 0.6.6, except that the -parser, -compile, and -classdir options are now ignored.

The parsegen and compile modules invoke programs by calling exec(). The programs they invoke are specified in the project file as the values of PARSEGEN and COMPILER, respectively. If your platform's version of exec() uses an executable path to search for programs to be executed (e.g. the PATH environment variable on Unix and Windows), then the programs specified by these variables must be on this path at runtime (or else their paths must be fully specified in the project file).

The test module invokes the Java virtual machine (specified by JVM in the project file) on your compiled program (as specified by CLASSDIR, PACKAGE, and MAIN). If TEST_INPUT is set, it specifies a file which will be read as input for the test.

The clean module removes all files and directories (recursively) specified in the CLEAN_ARGS setting in the project file.

The demjava script and the demjava.bat batch file in the bin directory take care of setting the class path correctly and passing the user path to demjava, but you will need to customize the paths in these files when installing.

Getting Help

Demeter provides extensive help  through the following facilities:

What next?

Now that you have an idea of what Demeter is about and have installed it on your system, we suggest that you put this manual aside and work your way through the Demeter Lab Guide. It contains a tutorial that walks you through the fundamentals of adaptive software development. Once through the Lab Guide, you should be ready to begin adaptive software development.

The remainder of this document should be used as a reference. It gives detailed information about all of the features of Demeter, and should prove invaluable as you begin to take advantage of the full power of adaptiveness in your software development projects.


next up previous
Next: Class Dictionaries Up: Demeter/Java User Manual Version Previous: Demeter/Java User Manual Version
Joshua C. Marshall
12/2/1998