Restructuring programs by tucking statements into function

Arun Lakhotia and Jean-Christophe Deprez
The Center for Advanced Computer Studies
The University of Southwestern Louisiana
Lafayette, LA 70506, USA
+1 (318) 482-6766
{arun,jxd7803}@cacs.usl.edu

Abstract

Changing the internal structure of a program without changing its behavior is called restructuring. This paper presents a transformation called tuck for restructuring programs by decomposing large functions into small functions. Tuck consists of three steps: Wedge, Split, and Fold. A wedge—a subset of statements in a slice—contains computations that are related and that may create a meaningful function. The statements in a wedge are split from the rest of the code and folded into a new function. A call to the new function is placed in the now restructured function. That tuck does not alter the behavior of the original function follows from the semantic preserving properties of a slice.

To appear in Special Issue of Journal of Information & Software Technology

Full paper