In Approaches to Legacy Code Brian Marick postulates that there are three basic approaches: throw it away and re-start; fix it; or strangle it.
“The term strangler application is due to Martin Fowler. The image is of a vine growing up around a tree, gradually killing it, until eventually the only thing left alive is the vine, roughly in the shape of the original tree.”
He notes that most practical approaches will be one of these kinds, or some hybrid combination of them. And he wonders whether this might be the beginnings of a pattern language.
I certainly agree with Brian that more needs to be written in this area. I’m sure many organisations would benefit from a set of patterns that could help them choose a strategy for dealing with legacy code – and with legacy systems in general. Indeed, I wonder whether this applies more broadly than just to code. Very often I find that the major factor holding back a software team’s productivity is some kind of legacy organisation – structures, processes, attitudes. I very rarely get to scrap and start again, but in future I’ll certainly be paying attention to when and whether I fix or strangle!
Update, 13 may 05
More background and reflections on this today from Andy Pols, in Thoughts on Strangler Applications.