More On Total Loss
by Lidor Wyssocky

A couple of weeks ago I wrote about code which doesn’t deserve to be maintained. I received a lot of comments on this post. Many of them argued that unlike tangible goods, code does not decay. Some people referred me to Joel Spolsky’s article, saying that throwing away code which was already tested and used on the field is never a good economic decision.

In my response to these comments I clarified:

“If you get a piece of code and you assume it was well taken care of, you might be… well, wrong. That’s why you have to check. Saying that any piece of existing code is better than a new one doesn’t make sense. If, for example, the previous owners of the code did a lousy maintenance job, you might end up with code that requires you to invest weeks of work for each small change. You can try refactoring that mess, but this is not always possible or cost-effective.

Joel’s article and your comments are 100% right in an ideal world where most of the code out there is reasonably maintained. I’m not sure this is the reality we all work in. But in any case, it’s better not to assume anything and just make sure you check the status of the code before making a decision.

I don’t like black and white rules. Unlike Joel, I try not to use phrases that begin with “Never…” or “Always…”. Just keep your mind open to the option that sometimes a rewrite is better than refactoring.

Of course, you should do it wisely. Don’t wake up one day and throw away 500K lines of code. Do it incrementally and with proper safety nets. But keep in mind that this is a valid option.”

Then, a couple of days ago I came across this paragraph in Jerry Weinberg’s classic book Quality Software Management Volume 1:

“In time, existing code may even come to have a negative quality, meaning that it would be cheaper to develop new code than attempt to keep repairing the old. Many pattern 1 and pattern 2 organizations are holding large inventories of negative quality software, but usually they are unaware of that fact. Or if they are aware, they are so unsure of their ability to develop new code that they continue to limp along patching ever more pitiful and expensive systems.”

Maybe it’s just me, but this sounded awfully familiar. I just couldn’t believe I read this paragraph only after writing my post. Well, there you have it. I guess you should keep your options open, and keep in mind that sometimes starting over again is the right thing to do.

Share this post:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • BlinkList
  • Reddit
  • digg
  • NewsVine
  • blogmarks
  • Furl
  • Netvouz
  • Spurl
  • YahooMyWeb

Optimize Your Software Development

See how I can help you develop software more effectively

2 Responses to “More On Total Loss”

  1. Nguyen Says:

    I guess what Joel meant was that code rewriting could be bad because people did not really understand all the assumptions/hacks/fixes made by the original coders and thus may rewrite it incorrectly (e.g. break other areas of the app or run incorrectly in certain configurations etc.). Regardless, if we are confident that we truly understand the existing code and all of its implications and think that it will save time in the long run by rewriting it then there is no reason why rewriting does not make sense.

  2. www.r10.net küresel ısınmaya hayır seo yarışması Says:

    I am Very thank full the owner of this blog. Becouse of this blog is very imformative for me.. And I ask u some thiing You make more this type blog where we can get more knowledge.
    thanks you very high work..
    http://www.saboces.gen.tr

Leave a Reply