Old Code Left in Place

What's the harm in leaving old code in place? It's not like it costs us anything. ... Or does it?

Old Code Left in Place

This is one in a series of articles on technical debt.

There's a natural human tendency to hold on to things, especially if they are things that we ourselves created.  This manifests itself when maintaining code all the time.  Projects evolve over time and requirements change.  This evolution leads to the replacement of certain functionality within a program.  

In terms of Access applications, this may involve creating a new version of an existing report or refactoring a routine in code to provide a different outcome given the same inputs.  

There's a temptation when doing this to copy the existing routine or report and distinguish the two versions by appending "_old" to the name of the original version.  This can be a very useful technique while developing the changes.  It allows you to see the two versions side by side and concentrate on making the changes exactly where they are needed.

The problem is when you leave the old versions in place.  Because at some point in the future, you will be coming back to this project and you will see the old versions there.  If you're a conscientious programmer, you won't just assume you can delete them.  You will need to trace through all the code to make sure they're really not being used anymore.  This takes time.  And it's a distraction from whatever your original purpose was.

Thus, I implore you to NEVER leave old versions of code, forms, or reports in place, even if only temporarily...because you WILL forget to remove it.  Software projects (mine included) are littered with old code that was only intended to be kept temporarily.

Milton Friedman used to say, "Nothing is so permanent as a temporary government program."  Clearly Mr. Friedman didn't know any programmers.  

Besides, you don't need to worry about losing the old code, form, or report, anyway, since it's already saved in version control.  (You are using version control, right?)

Image by Friedrich Frühling from Pixabay

All original code samples by Mike Wolfe are licensed under CC BY 4.0