Patent ID: 7669188

Claim:
A system for identifying viable refactorings of program code using a comprehensive test suite, comprising: a memory configured to store data comprising: original program code comprising program statements written in accordance with a programming language and defining operations executed following transformation into machine code; a test suite associated with the original program code and comprising one or more additional operations and expected results; a refactoring engine, comprising: a selection module configured to select a set of refactoring rules and to automatically apply refactorings to the original program code; and an evaluation module configured to evaluate one or more of the program statements in the original program code against the refactoring rules and to restructure the program statements pursuant to the one such refactoring rule from the refactoring rule set; and a code tester comprising: a test execution module configured to execute the additional program operations against the program statements as restructured; a comparison module configured to compare actual results from the original program operations' execution against the expected results; a reversion module configured to revert upon unsatisfactory comparison the restructured program statements to the original program statements and to select another such refactoring rule from the refactoring rule set for automatic application to the original program code; and a conversion module configured to save upon satisfactory comparison the restructured program statements to the original program statements and to select another such refactoring rule from the refactoring rule set for automatic application to the original program code, wherein the refactorings resulting in satisfactory comparison of the actual results to the expected results are assigned weightings quantifying the amount of difference between the original program statements and the restructured program statements and are exposed based on the weightings to a developer through a user interface.