Start Fresh or Expand and Modify?

This question is faced by programmers just about every time they are presented with code which they did not write, and have been asked to fix. Our ego tells us that we can do a much better job than the original programmer, that the entire code is a waste, and should be completely thrown out.

In a few cases, we’re actually right.

In most cases, management might wade into the discussion and veto the idea of starting over, claiming budgetary constraints, or perhaps an unwillingness to admit that the money spent on the original solution was a complete and total waste. The new programmer must therefore adopt the [horribly written] code and modify it, expand it, until it resembles scar tissue – one layer on top of another to fix things as they arise, rather than determine the original cause of the first problem and correct that.

We’re not alone.

In any type of project, there is often a desire to hold onto the current version of it in its entirety. Perhaps it does certain things well. Perhaps we spent a lot of time on it. Perhaps it was expensive.

The bottom line, however, is that the current version of the project doesn’t work. It does not accomplish what we need it to accomplish. It needs to be changed, updated, corrected. There will be a version 2, the only question that remains, however, is how closely it will be tied to version 1.

The decision that really needs to be made is whether by starting over (and using the lessons learned from Version 1) you will end up producing a better product. Sometimes the answer is yes, sometimes no. What was true the last time you made that decision might not be true this time.

As an example, take writing an article for a formal publication. After the first draft, you need to decide how to revise it. Sometimes you’ll just go back over the article and fix a sentence here, a word there, a paragraph over there. But other times you might realize that the entire draft is poorly structured, perhaps as a result of changes that occurred during the writing that left the article poorly structured. In that case, you might be better off writing a second article from scratch, loosely based on the first draft.

The decision needs to be made, and most people do make a decision. The problem, though, is that most people don’t realize that they are making a decision, since they always take the same action.

Don’t let that be you! Think about what you’re doing. Are you really saving anything by keeping hold of the first version? Are you really improving the product by starting over from scratch?