There is Only Code

There is just Code. It is either Shiny or it is not.

‘Legacy Code’ is another term, along with Technical Debt, that I would rather we in the software development community would retire. In a recent conversation the following possible definitions of Legacy Code were tossed out:

Legacy code is valuable code that we are afraid to change

Code I wrote yesterday is “legacy”

The code I wrote a minute ago and checked in is legacy

The comment I threw into the mix was:

There is just Code. It is either Shiny or it is not. If not, either throw it away or polish it.

Some of the conversation went around classifying it based on whether it needed to change:

I liken that to the junk drawer. You keep throwing stuff in it. It will hold it all. It only matters when you need something from it.

Whether the code was written last year or earlier this morning, if it is providing the value it needs to provide there is little need to bother with it. If there is a need to mess with it, either to add new functionality or to repair something not-quite-right, it does not matter whether it was written a decade ago or a minute ago. In either case, when you look at that code with a new view, you will see possible places to add some shine or throw out some cruft.

A question was raised as to whether these classifications only matter “when you need something from it.”

Some analogies to ‘junk drawers’ and ‘silver dishes’ were brought into the conversation. The junk drawer as a place where odd bits are tossed and which you only care about its ability to hold the odd bits until you need something from it. The silver dishes as a lovely collection of items that are fine on the shelf until they must be put into service. For both, there is probably a good argument that there is some value in cleaning them up occasionally even when you have no specific use for them. 

So, perhaps there is more than “need something from them” needed for the definition.

Or, perhaps, it is just all code. Code that you polish when you are actively updating it and that you frequently sweep through to remove cruft and cobwebs.