Legacy Code

Legacy code refers to source code that has been inherited from a previous version of a website or software application. Developers often regard legacy code with some disdain because it is thought of as less reliable than state-of-the-art new code. This comes from an assumption that the previous developer who wrote the code was less skilled or could have done a better job, but the reality is that legacy code is usually reflective of the constraints and parameters in place when it was written. Therefore, legacy code should not be expected to work seamlessly with all future updates. This also means all new code will become legacy code at some point.

How to use legacy code

While not all legacy code is inherently bad, there are steps programmers should take to review and revise legacy code so it can maintain its integrity.

  • Read the documentation. Keep on hand the documentation that accompanies the legacy code. This will help you make sense of all the moving parts so you can understand what impact one piece of code has on the broader system.
  • Run legacy tests. Create and perform tests on the legacy code so you can identify all of the problem areas. This includes unit tests and characterization tests.
  • Try refactoring. Refactoring involves simplifying the internal code structure to prevent software entropy. This eliminates potential weaknesses and minimizes the amount of changes needed, but it should be done in small doses to avoid any major disruption.
  • Make changes incrementally. Similar to the process of refactoring, any changes to the function of the code should be documented and implemented gradually so that each modification can be tested and reviewed individually. Otherwise, you could end up with a broken system and no idea what’s causing the malfunction.

Related links:

Kaiti Norton
Kaiti Norton is a Nashville-based Content Writer for TechnologyAdvice, a full-service B2B media company. She is passionate about helping brands build genuine connections with their customers through relatable, research-based content. When she's not writing about technology, she's sharing her musings about fashion, cats, books, and skincare on her blog.

Top Articles

The Complete List of 1500+ Common Text Abbreviations & Acronyms

From A3 to ZZZ we list 1,559 SMS, online chat, and text abbreviations to help you translate and understand today's texting lingo. Includes Top...

List of Windows Operating System Versions & History [In Order]

The Windows operating system (Windows OS) refers to a family of operating systems developed by Microsoft Corporation. We look at the history of Windows...

How to Create a Website Shortcut on Your Desktop

Website Shortcut on Your Desktop reviewed by Web Webster   This Webopedia guide will show you how to create a website shortcut on your desktop using...

Generations of Computers (1st to 5th)

Reviewed by Web Webster Learn about each of the 5 generations of computers and major technology developments that have led to the computing devices that...

Snail Mail

Snail mail, also called direct mail, is a slang term for...

CC vs BCC: What...

CC and BCC are two options to add third-party recipients to...

Eventbrite

  Eventbrite is an online event posting, event management, and ticketing website. Eventbrite can...