Supporting Program Comprehension for Refactoring Operations with Annotations

Restructuring a program is a concept that aims at increasing the maintainability of a piece of code by changing its structure. The term refactoring is often used synonymously, especially when the observable behavior of a program should not change when transforming the structure of the software to a more sophisticated level, e.g. by using design patterns. Behaviour-conserving program transformations are difficult as the understanding of both the code to transform as well as the transformation is prerequisite for conserving the conduct of a transformed program. In addition, a transformation should only be executed if certain preconditions apply. To capture the semantic and syntactic details about a specific code fragment, it is proposed documenting them by adding machine-processable and at the same time human-readable annotations. These annotations contain explicit information and could be added to source code by tools evaluating the code, as well as by practitioners. With annotations, it may be possible checking preconditions for program transformations to execute, and gain information necessary for these transformations.