Refactoring
What is refactoring?
-
Changing a program's written code without changing its
visible behavior is called refactoring.
-
Examples:
- Changing the name of a variable or method
- Reorganizing or restructuring the code
Why refactor? When?
- Usually when planning code modifications
(enhancements)
that would be easier if the program were structured better
or had better names.
-
It's important to separate
refactoring from
enhancements.
- Refactor first, and test thoroughly
(regression testing).
- Implement new functionality after refactoring is
complete.
Alyce Brady, Kalamazoo College