CpSc 461, Software Engineering Techniques

Refactoring Exercise

Refactoring is a method for improving existing code by re-writing selected portions in a disciplined manner. Refactoring is often done by good programmers as they go along, but it can also be applied to existing legacy code. The canonical reference on refactoring is the book Refactoring: Improving the Design of Existing Code by Martin Fowler, who also maintains a web site and catalog of refactorings.

In this exercise, you will have a chance to apply several simple refactorings. To begin, download, compile, and run Badcode.java. Then examine the following entries in Fowler's catalog and apply them to the code appropriately:

Submit a refactored version of BadCode.java by the beginning of lab next week (4/11).