Skip to main content
Liz Basson

There is something particularly unsettling about a ghost story in which the past refuses to remain in the past. We might forgive a great many things with the passage of time, but there is something about an unresolved grievance that seems to demand an audience eventually.

Japanese folklore has long explored this idea through the onryō, a spirit associated with a wrong that has not been resolved. It is a rather fitting concept for Halloween, but it also brings to mind something considerably less supernatural: legacy code.

Because if there is one thing the technology industry understands, it is that the past has a habit of catching up with us.

The Things We Leave Behind

Every developer, given enough time, will encounter a piece of code that feels as though it belongs to another era. Perhaps it is a function written by someone who left the company years ago, a plugin that nobody dares to update, or an application running on a version of PHP that has long since stopped receiving security support.

You open the file with the best of intentions. You follow the logic, examine the dependencies, and begin to understand why nobody has touched it in years. One small change might affect three other systems, and the documentation, if it exists at all, offers little reassurance. You tell yourself you will return to it when there is more time. And so the code remains.

There is something almost comical about how easily this happens. We spend our working lives creating systems intended to solve problems, only to leave behind problems of our own. A temporary workaround becomes permanent. A quick fix becomes an architectural decision. Eventually, the people maintaining the application may have no idea why certain decisions were made in the first place. The original developers move on. The code stays.

The Comfort of Familiar Problems

Perhaps the most curious thing about legacy software is not that it becomes difficult to maintain, but that we learn to live with it. We know which parts of the application are fragile. We know which plugin should never be updated without a backup. We know that one particular function must not be altered because something mysterious happens to the checkout when we do. Over time, these peculiarities become part of the landscape. We stop questioning them because we have learnt to work around them.

There is a certain comfort in familiarity, even when the familiar thing is objectively inconvenient. At least we understand its shortcomings. At least we know where the problems are likely to appear. But familiarity is not the same as safety.

A website can load perfectly well while running outdated software. An application can continue performing its intended function while its dependencies become increasingly difficult to maintain. A system can appear entirely uneventful right up until the moment it demands considerably more attention than anyone has budgeted for. The absence of a visible problem is not proof that a problem does not exist.

When the Ghost Becomes a Security Risk

This is where the metaphor becomes rather less whimsical. PHP applications depend on a collection of moving parts: the PHP runtime, the application itself, its dependencies, its hosting environment, and, in the case of WordPress, its core software, themes and plugins. Each has its own maintenance requirements, and neglecting one component can introduce risks that are not immediately apparent from the outside.

Security vulnerabilities make this particularly clear. A vulnerability may be discovered and a patch released, yet an application can remain exposed if the necessary update is never applied. The fix exists, but the system continues operating as though nothing has changed.

Of course, updating an older application is not always as straightforward as clicking a button. A new PHP version may expose deprecated functionality, incompatible dependencies or assumptions buried deep within custom code. There may be a legitimate reason to plan an upgrade carefully rather than apply it immediately to a production environment. But there is a difference between managing that risk and pretending it does not exist. One is a deliberate engineering decision. The other is simply postponement dressed up as pragmatism. And the longer we postpone the work, the more difficult it can become to distinguish between the constraints we genuinely face and the habits we have acquired.

The Curse of “It Still Works”

Few phrases are more comforting, or potentially more misleading, than “it still works.” It is an understandable argument. If a website generates revenue, serves its customers and fulfils its intended purpose, replacing its underlying technology may seem an unnecessary expense. Businesses have limited budgets, developers have competing priorities, and not every old application needs to be rebuilt from scratch. Yet functionality is only one measure of a system's health.

We should also ask whether the software can be maintained, whether its dependencies remain supported, whether security updates can be applied, and whether the people responsible for it understand how it works.

These questions are less exciting than discussing a new framework or unveiling a redesigned website. They are also rather less visible to the people paying for the work.

There is rarely much fanfare when a developer upgrades a runtime, removes an abandoned dependency or documents a complicated piece of logic. The result may look exactly as it did before. Nothing particularly dramatic has happened. That is, in many respects, the point. Good maintenance often consists of preventing an event that nobody will ever know was possible.

An Exorcism Is Not a Rebuild

It would be easy to conclude that all legacy code should be replaced, that every old system is a liability, or that the only sensible response to technical debt is to start again. That would be a rather expensive misunderstanding.

Older software is not necessarily bad software. Some systems have endured because they are dependable, well understood and perfectly adequate for their purpose. A rewrite introduces its own risks, costs and opportunities for new mistakes. There is little virtue in replacing a functioning application merely because its architecture no longer resembles the latest industry preference. The more useful question is what the system needs.

Sometimes the answer is a security update. Sometimes it is a gradual migration, a refactor, better documentation or the removal of dependencies that no longer serve a purpose. Occasionally, the sensible decision is to retire the application altogether. The work begins with understanding what we have inherited, rather than assuming that everything old must be discarded.

It also requires us to recognize when maintenance has become avoidance: when we continue applying small fixes because a proper solution would require an uncomfortable conversation about time, money or responsibility. Not every ghost needs to be destroyed. Some simply need to be understood. Others, however, have been occupying the house for far too long.

What We Choose to Carry Forward

There is something revealing about the way we speak of legacy code. The word legacy suggests an inheritance, something passed from one generation to the next. We usually associate inheritance with something of value, yet in software, the inheritance may include decisions, shortcuts and complications that nobody would willingly choose today. Still, we are rarely given the luxury of beginning again.

We inherit systems built by people with different priorities, different constraints and different information. Sometimes their decisions were excellent. Sometimes they were necessary compromises. Sometimes they were mistakes.

Our responsibility is not to judge every decision with the benefit of hindsight. It is to understand the circumstances in which it was made and decide whether it still serves us. That is what separates maintaining a system from merely keeping it alive.

Japanese ghost stories offer a rather evocative reminder that unresolved things have a way of returning to our attention. In software, the consequences are less supernatural, but the principle is familiar enough.

The code we inherit is not always the code we would have written. The systems we maintain may contain decisions we would never make today. Yet once we become responsible for them, we also become responsible for deciding what happens next.

Perhaps that is the real horror story of legacy code: not that it is old, complicated or occasionally held together by an astonishing number of workarounds, but that we can become so accustomed to its problems that we stop noticing them.

And so, this Halloween, before blaming the ghosts in your codebase, it may be worth asking a more uncomfortable question.

Have they returned to haunt you, or have you simply never dealt with them in the first place?

—Liz Basson

Elegant workspace with laptop and design sketches

Ready To
Explore?

Take a look at my projects and see how I craft elegant, user‑friendly web experiences.