Glossary/Refactoring
Technical Debt & Code Quality
Share:

What is Refactoring?

Refactoring is the process of restructuring existing code without changing its external behavior. The goal is to improve the code's internal structure — readability, maintainability, performance — while keeping the software's functionality identical.

Martin Fowler's canonical definition: "Refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior."

Refactoring is not rewriting. Rewriting means replacing code with new code that does the same thing differently. Refactoring means improving the existing code incrementally. The distinction matters enormously for risk management — refactoring is low-risk because you're making small, testable changes. Rewriting is high-risk because you're replacing working code with untested code.

Why It Matters

The business case for refactoring is often poorly communicated. Engineers say "we need to refactor" and executives hear "we want to spend time not shipping features." The conversation should be about ROI: a $50K refactoring investment that reduces bug rates by 40% and increases deployment frequency by 3x has a measurable return.

Richard Ewing's framework for evaluating refactoring decisions uses the Feature Bloat Calculus: if the maintenance cost of a component exceeds its value contribution, refactoring (or deprecation) is economically justified.

Frequently Asked Questions

What is the difference between refactoring and rewriting?

Refactoring improves code structure incrementally without changing behavior. Rewriting replaces code entirely. Refactoring is low-risk; rewriting is high-risk.

How do you justify refactoring to management?

Frame it in financial terms: current maintenance cost, projected cost savings, impact on deployment speed, and bug rate reduction. Use the Product Debt Index to quantify the financial impact.

Free Tools

Related Terms

📊

Free Tool

Find your refactoring ROI

Use the free Product Debt Index diagnostic to put numbers behind your refactoring challenges.

Try Product Debt Index Free →

Need Expert Help?

Richard Ewing is a Product Economist and AI Capital Auditor. He helps companies translate technical complexity into financial clarity.

Book Advisory Call →