Program Manipulation via Interactive Transformations

(Marat Boshernitsan)

(NSF) CCR-9988531, (NSF) CCR-0098314, and Sun Microsystems Fellowship

Software artifacts are bound to change. Be it due to design changes, bug fixes, or addition of new features, the process of modifying software source code is often tedious and error-prone.

The change process is complicated because many changes entail pervasive large-scale modifications to an existing body of source code. Examples abound in the many maintenance tasks faced by developers during the lifetime of a typical software project. For instance, simply adding an argument to a procedure requires visiting every invocation site and supplying the missing value. Another example, observed by the aspect-oriented programming researchers, involves delocalized design abstractions such as exception handling, logging, synchronization, and others. Capturing these design abstractions at the source code level is difficult due to limited data and procedural abstractions provided by most programming languages. As trivial a modification as changing which exceptions are handled following the call to a library routine requires finding all such calls and modifying the exception handlers. Yet another flavor of high-level operations is the generative operations that produce chunks of boilerplate code. Outputting fields of a data structure is an example of such an operation. If the list of fields is large and may change over the lifetime of the program, maintaining the output routine "manually" is a tedious and boring task.

Various proposals have been made for systematic modification to existing source code. However, few tools have found their way to the "programming trenches". Our research attacks several major issues with prior approaches: generality, acceptance by the user community, improved abstraction management, and avoidance of proprietary programming language extensions (such as those used in aspect-oriented programming).

We believe that the problem stems from the fact that developers use authoring and editing tools poorly suited to the program maintenance task. Most such tools provide text-based interaction with minimal syntax knowledge and very little structural or high-level language awareness. The use of such tools has significant limitations. On the one hand, developers utilize high-level linguistic structure and programming language semantics when thinking about and discussing software artifacts. On the other hand, the developers are forced to interact with computing systems to create and modify software artifacts using low-level text editors and representations designed for compiler input. Our hypothesis is that enabling the programmers to express operations on program source code at a level above text-based editing will improve programmer's efficiency and result in fewer errors.

Our research focuses on the problem of programmers' expression and interaction with a programming tool. We combine the results from psychology of programming, user-interface design, software visualization, program analysis, and program transformation fields to create a novel programming environment that lets the programmer describe a source code manipulation, such as adding a parameter to a procedure, in a "natural" manner. Our approach is to first study and understand how programmers form mental "update plans" for changing source code. The results of this study will be used to design a tool that makes it easy to specify and execute source code transformations. This tool will utilize the analysis capabilities of Harmonia, a program analysis framework for building language-based tools, and will be embedded in Eclipse, an existing full-featured IDE. The resulting prototype will be evaluated both through an existing cognitive framework as well as through deployment to a user community.


  • Marat Boshernitsan. Program Manipulation via Interactive Transformations. Extended Abstract, January 16, 2003. (PDF, 173K)