Posted on Leave a comment

What is legacy code anyway?

Legacy code is software that was written previously by yourself or another developer, left to rot probably undocumented, then after a time brought back to the table as a project to be improved upon.

Code ages. And quickly! Low budget projects tend to be created with little documentation and lots of hacks or workarounds. "This will do for now. We’ll fix it in the next version." Only the developer saying that does not document the need for a fix or revision. This is called firefighting or bandaiding. As time passes techniques or functions that were once hot and vogue become passé and deprecated and sometimes altogether unsupported. One of my recent projects left me scratching my head for a week because the php function session_register() is deprecated and excluded from version php 6.

These legacy apps are also known as evolutionary prototypes. Evolutionary prototypes build features and changes upon the existing functioning application. They have a limited life. After a number of revisions, the application starts to fail miserably. It is like adding more and more plumbing to the house. Eventually you forget what that one pipe does but it exists therefore it must be important. Unfortunately, most clients just see the number of dollars spent building up to the current revision of their application and have trouble justifying the expense of a total rewrite.

Legacy code can be extremely painful to troubleshoot and down right painful to modify since the modifications might mean having to work in the awful practices the previous developer employed rather than using good, professional coding techniques even when the previous developer was yourself. However, most applications will fall into the category of legacy code so a good developer should treat all projects, even the small and under budgeted, as ongoing large scale applications with appropriate documentation of assumptions, explanations of hacks and workarounds, suggestions for future updates, test documents, and so forth. Clients should plan on a total rewrite after 3-7 evolutions.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.