My second mini-Project -- Transformational Abstraction for Java


Sponsor: Spencer Rugaber

Area: Software Engineering


Purpose

Programmers routinely document their source code. These comments usually reside at the line level or the function level. However, there are many layers of complexity between the line level and the function level. For example, a function may contain several loops (possibly nested). Each loop may be thought of as doing a "chunk" of work that could be documented.

Wouldnít it be nice to have a code editor which somehow showed the abstract syntax of the program and allowed annotations to be added at whatever level of abstraction was desired? The resulting nested layers of annotation could be used for many purposes, for example, introducing a new programmer to the program in increasing levels of detail.

Input

The program will take as input a Java class, representing the top level of the abstract syntax tree. In addition, after the ability to Save annotations has been added (see below), then the program will take the Java class in addition to the file containing the stored annotations. The precise format that the annotations are stored in will be determined during the course of the project.

Process

The Java class file will be parsed into an abstract syntax tree and loaded into memory in a format supporting the required hierarchical annotation.

The resulting syntax tree will be displayed on the screen in a format which: 1) resembles the original code as closely as possible, and 2) makes clear what the hierarchical levels of syntax are. The user will navigate the levels of the syntax tree, viewing, entering and modifying annotations at will. The code will be displayed using a two-dimensional "semantic zooming" paradigm (i.e. like that supported by the Jazz library). So, for example, the initial view of the Java class may just have the description of the entire file and zones representing the include files, the member variables and the methods. When the user clicks on one of these zones, the program will zoom in to the chosen until, displaying more detail, for example, a list of methods along with their annotations. Upon clicking on one of the methods, the program will zoom in further, displaying the parameter list and the top-level syntax structures (along with annotations). At any time, the user can return to a previous level of detail.

At any time, the user will be able to save the annotations as they current exist.

Output

As mentioned previously, the sole output of the program will be a file containing the annotations entered through the program. The exact format of this file is yet to be determined. One possibility is to annotate the Java program using specially formatted comments. Another possibility is to annotate a file containing the abstract syntax derived from the program.
Future
Other features which may be included, or could be added in the future include:
1. Ability to track annotations from more than one person and display others annotations of the same structure.
2. Generation of some sort of documentation file from the annotations.