Refactoring

See Also: Code Smells

Martin Fowler and Kent Beck (the designer of JUnit) are the authors of a very influential book called “Refactoring: Improving the Design of Existing Code”.

In Fowler’s book, he introduces twenty-two specific “code smells”, along with specific guidance for fixing the smelly code and replacing it with better code; this process is called “refactoring”.

In general, in the context of software development, refactoring refers to the process of making changes to code that:

The “refactor” step in the “Red-Green-Refactor” cycle of Test-Driven Development refers to this kind of refactoring. The idea is that once you have tests for your code, and a candidate solution that passes the tests, you are much more free to experiment with refactoring the code because: