What is Code Refactoring?
Refactoring: a change made to the internal structure of software to make it easier to understand and cheaper to modify without changing its observable behavior.
Intentional code changes that don’t affect an applications outside behavior.
We do this for a few reasons…
- Makes Code Easier to Understand
- Helps You Find Bugs
- Makes Adding New Features Easier/Faster
What Do I Need to Get Started?
Refactoring a codebase is a team sport. Making anything beyond trivial changes to a codebases needs coordination with your entire team to ensure that everyone is on the same page.
- Keep it Simple & Incremental
- Target Areas Where Frequent Changes Are Needed
- Test and Commit Often
- Don’t Overdo It!
Selling/Calculating ROI for Refactoring
Every situation is going to be different. In organizations that have leaders with strong engineering backgrounds, the question might not be “Should we our code at all?” but “When and which parts of our code should we refactor?”
In general, the choice to refactor parts of a codebase boils down to what is the return on investment of refactoring said code.
Convincing Your Boss
Refactoring: Improving the Design of Existing Code By Martin Fowler
Growing Object-Oriented Software, Guided By Tests by Steve Freeman and Nat Pryce
Refactoring (Ruby ed): https://martinfowler.com/books/refactoringRubyEd.html
Practical Object-Oriented Design: https://www.poodr.com