Legacy Code is Just Code

Try and define legacy code. Working Effectively With Legacy Code states it is simply code with no tests. This is an almost perfect definition, however it is quite easy to have code that is covered by automated tests, yet is still considered to be legacy. Poor quality, or missing test cases can provide a false sense of security.

Legacy in the Real World

Legacy code is scary to change or work with. Typically it is stuck using an old language or framework which is too expensive to upgrade. Most notable legacy code is often considered old. Developers or teams that no longer exist wrote it and have long since moved on. Hence legacy code is often ignored or over looked by the wise. To be blunt, most developers consider legacy code to be crap.

Just Code

In the end legacy code is just code. It should be treated and given the same amount of respect as your new and shiny solution. In fact legacy code is more than that, it's proven. Unlike clean code you have stagnating in your repository, legacy code has lived and breathed in production. It may be far from ideal, but it works and it does the job. Learn from it and refactor where possible. In cases where refactoring is not possible, use specific techniques for dealing with legacy code (exapanded in future posts).

In reality software developers leave features in their place, not code. Much of the code I have written can/should/will be replaced but the features live on.

The lesson here is to simply treat all code as equal regardless of its status - legacy or not.