Available at: https://digitalcommons.calpoly.edu/theses/1759
Date of Award
MS in Computer Science
Code decomposition (also known as functional decomposition) is the process of breaking a larger problem into smaller subproblems so that each function implements only a single task. Although code decomposition is integral to computer science, it is often overlooked in introductory computer science education due to the challenges of teaching it given limited resources.
Earthworm is a tool that generates unique suggestions on how to improve the decomposition of provided Python source code. Given a program as input, Earthworm presents the user with a list of suggestions to improve the functional decomposition of the program. Each suggestion includes the lines of code that can be refactored into a new function, the arguments that must be passed to this function and the variables returned from the function. The tool is intended to be used in introductory computer science courses to help students learn more about decomposition.
Earthworm generates suggestions by converting Python source code into a control flow graph. Static analysis is performed on the control flow graph to direct the generation of suggestions based on code slices.