45

Possible Duplicate:
What makes code legacy?

What is the definition of "legacy code"?

Community
  • 1
  • 1
user128807
  • 10,447
  • 17
  • 53
  • 72

5 Answers5

55

Channeling Michael Feathers: Code without tests.

Jörg W Mittag
  • 363,080
  • 75
  • 446
  • 653
  • Your response is the last one and I was looking for this definition because I'm reading the M.F book ) ! – TooCool Feb 24 '17 at 11:14
  • 2
    If someone dropped a folder of undocumented 1989 COBOL on you which ran on Unix but had 93% code coverage, would you not call it legacy? – Luke Puplett Sep 04 '18 at 11:20
  • 2
    @LukePuplett I believe a stream of thought exists in which "good" tests serve as (among other things) documentation of _actual_ behavior, which is often desired over other forms of documentation describing _desired_ behavior. Perhaps this stream of thought is what Jörg and Michael Feathers has in mind? – Matt Thomas Feb 04 '19 at 14:37
49

I can't remember where I saw the expression (Pragmatic Programmer?) but one way to think about it is code is legacy code as soon as it's written.

Generally it's referred to code that gets inherited by a team or a programmer from somewhere else (external or internal).

I prefer the former definition, though. :)

Shaggy Frog
  • 27,575
  • 16
  • 91
  • 128
  • 1
    This indeed is a great definition (and also in line with my definition, since I refuse to discuss my code with myself) :D – Mchl Nov 13 '10 at 21:43
  • I read somewhere, how do you think of this: legacy code is code which you can't rely on, the code we wrote 5 minutes ago and doesn't have tests? legacy code. –  Dec 01 '16 at 01:15
25

Code someone else written (usually someone no longer available for any contact), but you must deal with it now.

Mchl
  • 61,444
  • 9
  • 118
  • 120
23

Code written by others or under a previous language, architecture, methodology, or framework that pertains to the current project.

jball
  • 24,791
  • 9
  • 70
  • 92
15

I would say that legacy code is (usually old) code that can be rewritten using better programming techniques or languages. Legacy code usually is not easily rewritten because of dependencies on that code.

Leonid
  • 22,360
  • 25
  • 67
  • 91