Main Page | See live article | Alphabetical index

Legacy code

Legacy code is source code that relates to a no-longer supported or manufactured operating system or other computer system. The term can also mean code inserted into modern software for the purpose of maintaining an older or previously supported feature—for example supporting a serial interface even though most modern systems only have USB.

In practice, most source code has some dependency on the system on which it is designed for—it is hard to write a large, useful program that is totally independent. When the manufacturer upgrades or supersedes that system, the code will no longer work without changes, and becomes legacy code. A large part of the task of a software engineer is altering code to continually prevent this.

While the term usually refers to source code, it can occasionally be heard applied to executable code that no longer runs on a modern version of a system, or requires a compatibility environment to do so. An example would be a classic Macintosh application which will not run natively on Mac OS X, but runs inside the Classic environment.