Peter Morlion logo


Fixing My Legacy Application: Removing Unused Components

When I first started writing this app, I wanted to move fast. I found a JavaScript library that promised to connect my client-side code to my Entity Framework context very easily: Breeze.

For some reason that I can’t remember now, I never ended up using very much of it, if anything at all. But I had never cleaned up the mess I had left behind. This is a typical example of how legacy code accumulates: components get added for small things, but they end up being used in only a few places of the application. Sometimes the team stops using the component entirely, but they neglect to remove all references to it.

After a few years of development, it can become hard to distinguish between components that are necessary, and the ones that can safely be removed. Developers often feel it’s safer to just not touch anything. But this just makes the situation worse over time.

On a side note: this can also be a security and stability issue. You are responsible for keeping these components up to date. Older components may have bugs or security issues that have already been fixed.

In my case, I had to make some minor code changes. But it’s equally important to

  • remove the NuGet package
  • rename any variables that no longer matched what they contained

The end result should be like the component was never used in the first place.

Leave a Reply

Your email address will not be published. Required fields are marked *