Repetitive and menial tasks demand automation. Given a high-level description of a change, an automated tool can apply that change throughout the source code. We have developed a system that enables developers to automate the editing tasks associated with source code changes through interactive creation and execution of formally-specified source-to-source transformations. We applied a task-centered design process to develop a language for describing program transformations and to design a user-interaction model that assists developers in creating transformations in this language. The transformation language combines textual and graphical elements and is sufficiently expressive to deal with a broad range of code-changing tasks. The transformation environment assists developers in visualizing and directing the transformation process. Its "by-example" interaction model provides scaffolding for constructing and executing transformations on a structure-based representation of program source code. We evaluated our system with Java developers and found that they were able to learn the language quickly and to use the environment effectively to complete a code editing task.
By enabling developers to manipulate source code with lightweight language-based program transformations, our system reduces the effort expended on making certain types of large and sweeping changes. In addition to making developers more efficient, this reduction in effort can lessen developers' resistance to making design-improving changes, ultimately leading to higher quality software.