CpSc 461, Software Engineering Techniques
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).
- Pull Up Field
- Pull Up Method
- Push Down Field
- Replace Conditional with Polymorphism
- Pull Up Constructor Body