Structure Builder: From Object Interactions to Code
 
Neeraj Sangal, President, Tendril Software Inc.
Edward J. Farrell, Principal Architect, Tendril Software Inc.
Karl J. Lieberherr, Advisory Board, Tendril Software Inc. and Northeastern
University 
 
Structure Builder (SB) from Tendril Software is an innovative tool for Java
software development. In UML, program behaviour is expressed as object
interaction diagrams. A key innovation of SB is that it allows the developer
to generate Java code from these object interactions. This allows for quick
and accurate code generation for significant parts of the program and it
reduces the code for manipulation and navigation of data structures.
A UML class diagram serves as the structural architecture
which is used to derive the methods. A program is separated into object
navigation and additional processing. 
 
A collaboration is expressed in terms of a set of traversals which collect
the participant objects of the collaboration. For example, if you have an
object o and you need a subobject three levels down, you click the UML class
diagram to define the path o.a.b.c and call get. This will make the object
referred to by the path
available. Any number of participant objects may be collected this way.
Instead of calling "get" we could also call "execute" to call a designated
method and return its result. A benefit of this approach is that the
detailed Java code for carrying objects around is automatically generated by
SB. Automatic object transportation is
a general feature of SB.
 
Structure Builder is introducing two concepts: an object tracker model and a
code fragment model. The object tracker keeps track of the objects which are
available at a given point in a collaboration. A significant part of the
programming task is
ensuring that objects are transported to where they are needed in a program.
Object tracker automates this task.

The code fragment model incorporates the following features: A code fragment
takes several objects as input and produces several objects as output. A
code fragment consists of a path, followed by an action name and associated
properties. The kind of actions which can be called depends on the type of
the object. All objects support the actions, execute, get and newMethod.
Additional actions are defined for other types. For instance, the popular
Java collection type, Vector, has the following additional actions: add,
remove, find and iterate.

A collaboration is a sequence of code fragments. Each code fragment makes
available output objects which may be used by code fragments later in the
sequence. Each path in a code fragment may also contain extra code to be
executed when the path is traversed.
 
The SB approach is general and powerful and facilitates the design and
coding of Java programs. The strong reverse engineering capabilities of SB
allow software developers to take their existing Java programs and continue
development in a simplified way in SB style.
 
Related Work:
The Structure Builder approach is motivated by the Demeter approach
[Mezini-Lieberherr-OOPSLA-98] but does not require new language constructs.
It only uses standard Java and SB users immediately see all the generated
Java code.
 
Reference:
Mira Mezini and Karl Lieberherr, Adaptive Plug and Play Components for
Evolutionary Software Development, OOPSLA '98, Vancouver, Canada.

Tendril Inc., www.tendril.com