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
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.

Related Articles

Human Resources Management System

A Human Resources Management System (HRMS) is a software application that supports many functions of a company's Human Resources department, including benefits administration, payroll,...

How To Defend Yourself Against Identity Theft

Almost every worldwide government agency responsible for identity theft issues will tell you the same thing: The first step to fighting identity theft is...

Infographic

An infographic is a visual representation of information or data. It combines the words information and graphic and includes a collection of imagery, charts,...

Phishing

What is phishing? Phishing is a type of cybercrime in which victims are contacted by email, telephone, or text message by an attacker posing as...

ScalaHosting

ScalaHosting is a leading managed hosting provider that offers secure, scalable, and affordable...

HRIS

Human resources information system (HRIS) solutions help businesses manage multiple facets of their...

Best Managed Service Providers...

In today's business world, managed services are more critical than ever. They can...