Memo: “Refactoring — Not on the backlog!”
An amazing article about how to approach refactoring in a codebase
From times to times, it happens to me to have the same conversation around how to fix issues related to technical debt, when “there is no time for it”.
Every time I find myself trying to explain the approach they should use, which is to systematically reduce the debt, slice by slice, piece by piece, component by component. That’s what I have always done in the last ten years or so, whenever I had to deal with a messy codebase (often created by someone who thought they “didn’t have time” too).
Every time my memory goes back to this enlightening article by Ron Jeffries, and to this image that illustrates exactly this approach:
And to this “magic recipe”:
What should we do? We take the next feature that we are asked to build, and instead of detouring around all the weeds and bushes, we take the time to clear a path through some of them. Maybe we detour around others. We improve the code where we work, and ignore the code where we don’t have to work. We get a nice clean path for some of our work. Odds are, we’ll visit this place again: that’s how software development works.
Maybe this feature takes a little bit longer. Often it doesn’t, because the cleanup helps us even with the first feature that passes this way. And of course it’ll help any others as well.
Every time, I have a hard time to find this article (which I don’t think has the visibility and prominence that deserves).
So I have decided to post it in my blog, where I’ll easily find it in the future. Please read it, and share it as much as possible, so I can stop to have those conversations in the future :)