How Much Does It Really Cost to Do a Major Code Refactor?

Discover the unexpected consequences and hidden costs associated with a major refactoring of your programming project.

David Rodenas PhD


Major Code Refactor.

In the world of software development, the term “refactoring” often evokes crisis. It’s a word many of us would rather not hear. However, we’ve often seen large projects, with grand plans, that over time become increasingly difficult to manage. The cost of change keeps increasing to the point of becoming utterly unmanageable. With an unstoppable increasing cost of change and bugs appearing in more and more unexpected places, there comes a time when “refactoring” seems like the only way out. This last step is the major refactor, the rewriting of almost all the code, and we know it has an incredibly high cost. But its cost goes beyond just developer time.

“Truth can only be found in one place: the code.” — Robert C. Martin

The cost in time

The resources needed for the rewrite are already part of the cost. Usually estimated to be lower than the cost of writing the software in the first place.

The worst-case scenario is rewriting everything. If you talk to a developer, they’ll often say that rewriting everything is faster than writing the program from scratch. So, if we’re talking about a team’s three-year development, they may tell you it will take about six months to get to the same point.

Imagine if this forecast is accurate; how is it possible for recreating the same software to be faster the second time than the first?

It turns out that the major cost of development isn’t writing the code but understanding the software’s requirements. It’s a learning process. And during the software’s first life, the developers have done this learning, not just them, but other roles as well. Therefore, when it’s time to begin the second life, they can skip this process. And that’s why it’s very plausible that the second time around, the development will be faster.

However, will this forecast be met? Most likely not. One thing for sure is that developers’ estimates are just that — estimates, not certainties — and they…



David Rodenas PhD

Passionate software engineer & storyteller. Sharing knowledge to advance our skills. Join me on a journey of discovery in the world of software engineering.