Technical Debt Doesn't Disappear
caseysoftware.com
caseysoftware.com
For a good read on the subject, try "Working Effectively with Legacy Code" by Micheal C. Feathers.
I prefer the term "technical baggage," over "technical debt." This is mainly because debt refers to an economic means of borrowing a sum of future purchasing power. This breaks down when referring to the cost of engineering decisions. The cost of maintaining legacy systems tends to increase with time and you cannot calculate any sum to borrow based on assets or secured revenue. The decisions you make now will haunt your business for a long time to come. Poor technical decisions are simply something you will have to learn to live with.
When dealing with legacy systems from a business perspective, the question one has to ask is, "how valuable is it to maintain and enhance the existing system going forward?" In other words, when will the costs of continuing development of your legacy system outweigh the revenue it generates? For large systems found in banks and insurance companies it can be a very long time. For small businesses it is much shorter than you think.
FWIW, it seemed to me that Netscape simply made the decision to start from scratch too late. The revenue they were generating from their old code base had trickled off too long and dipped below their operating costs before the warning signs went up. I don't think it makes a compelling argument against re-writing.
As someone supporting a legacy system, it sometimes makes sense to re-write the system. Treat the existing system as a prototype and derive the minimum viable product from it to start with. Spin it off as a new product, set an shut-off date for the old software, and convert your customers. Obviously this doesn't work for every scenario; so YMMV. Just be smart about it and use evidence to back up your assumptions. Sometimes simply writing a legacy compatibility layer and porting the most painful bits of code slowly is the key. Re-writing certainly isn't for everyone.
Yes, but sometimes, this stuff actually compounds!
The problem was not the rewriting itself but the lack of understanding how things went wrong the first time. From my experience it is absolutely mandatory to have many deeply introspective and self-critical thought sessions to figure out how you got into the mess. Only if you have clearly identified what went wrong in the past, you will be able to successfully rewrite a project and avoid the mistakes.
For some of the products we did this and rewriting was a huge success. For some others we did not and the rewrite turned out to be just as terrible as the original version. Then we rewrote it again and it was still a mess.
And even then, they don't disappear. Windows 98 is 12+ years old and it's still lurking around out there. Vista was only the main version of Windows for 2 years and I bet it will haunt our support queues for another 5 years at least..
Assume you're going to get it wrong, and leave yourself an out.
Often the cost of refactoring is much less than the cost of a rewrite. If this isn't the case, then I suggest you look at your language/toolset/coding standards.
Is it possible to get yourself to the point where you no longer have to pay the cost of a complete rewrite? It might even be possible and worth doing a rewrite for the purpose of avoiding future rewrites. (And if you say this is like "a war to end wars," I'll just say that's cute, but wrong.)
Was there ever a "Five Whys" asked about the rewrite?
I took the product over as lead developer and saw no way to save it. It helped that only maybe about 10% of the features we wanted to have were implemented, so two of us managed to do the rewrite in less than six months.
The main focus of this rewrite was indeed to make sure that we would never have to rewrite the product ever again. We kept a very close eye on identifying what went wrong, what design principles can help us to avoid doing things wrong in the future, and how to design for extensibility considering that 90% of the features still have to be added.
In the end the rewrite turned out to be very successful. Until the day I left the company (three years after) no rewrite was ever necessary again. Rather, we managed to keep up the good principles laid down during the rewrite so we could just work on the code incrementally. The product was also the commercially most successful piece of software the startup sold.
Sustainable practices are smart practices.
Managers and business users hate rewerites as it is. That's part of the reason there is so much horrendous legacy code out there. Often, people who have the authority to make decisions about rewriting something don't interaface with the code, don't understand undetlying issues, don't see what was changed in technological context since the code was written.
In my own experience, most of the rewrites were totally worth it. It wasn't just because the code became better, it was because the understanding of the problem has matured. People were able to understand the problem better, so were were able to write better code to solve it.
Lies like "We already know what it should do!" and "We don't need to maintain the legacy, your issue will be fixed in the New System" and "There won't need to be any changes to business processes!"
I have never seen a re-write done with a greater understanding of the problem. In every case I've observed, the non-developer stakeholders start insisting on features working exactly as before OR start adding new, wonderful features from the get go. It results in a mess that solves NOTHING.
The debt metaphor is very apt. You can declare bankruptcy on your technical debt and walk away... But your tech credit history (IE your business systems) are a mess, your creditors (users) start to hate and mistrust you, and starting anything fresh becomes complicated beyond belief.
Re-writes suck. They SUUUUUCK. And people persist in doing them. That's why we keep needing these articles.
When I was an "e-business" consultant, we had a saying: "Six month projects take nine months, twelve month projects take eighteen months, and two year projects get canceled." If your rewrite is projected to take over a year, you're in huge trouble.
Is this meant to be sarcasm? Because if not, thats an insanely huge function. I imagine most compilers would choke on it...
It makes puppies cry.