Although revisiting and updating existing code isn’t necessarily fun or an obviously lucrative way to spend your limited time, it can certainly pay dividends. I know my personal knowledge, skill, and experience have changed over the years, and code which seemed perfectly good six years ago can be painful to read now. Perhaps you’ve gained new appreciation for readable code in general. Or limiting how deeply you nest your conditional blocks, or avoiding incomprehensible loops six pages long. Regardless, code which is easy to read and understand is easy to maintain, and has fewer bugs.

Sometimes, its not your skill which was necessarily at fault, but your environment. Perhaps the code has simply outgrown the original project scope, and become littered with references and obscure exceptions which were bolted on later. Reconsidering and refactoring the code is a necessary step to regaining control of the chaos. Or the original project simply didn’t afford enough time for development, and you had to leverage existing code which didn’t quite fit. Our own ipMom account interface started life as PostfixAdmin, which was quick and easy to put into production, though you wouldn’t be able to tell anymore.

Finally, programming languages themselves change. New libraries are added, and new functions which can make your code leaner and cleaner overall. With relatively new programming languages, its easy to have code which predates any developed or widely-used best practices for the language. Bringing the code up to spec now will make it easier for you, and easier for others, to maintain it in the future.