28

Everyone talks about legacy code in software development and I have heard the term over the last ten years used to paint any codebase as being bad.

Where did this term, which has such powerful connotations to programmers alike originate?

I am sure there must be some book on software development that pioneered this term. I would love to locate the origin of the term "legacy code".

Arseni Mourzenko
  • 134,780
  • 31
  • 343
  • 513
stevebot
  • 2,003
  • 2
  • 16
  • 19
  • 14
    I heard the following definition of legacy code 20 years ago and I've remembered it ever since: legacy code is the code you currently have in production. It has helped my point of view many times. – Michael Durrant Jun 09 '14 at 16:08
  • 11
    "Legacy code" is a negative term? Who says that? Anyway, the word "legacy" is not specific to programming, nor is it especially significant in this context. – Robert Harvey Jun 09 '14 at 16:10
  • 1
    @RobertHarvey legacy is not specific to programming, but in every environment I have been in (various jobs, conferences, meetups) I have only heard it used with the word code in a negative sense (technical debt). I agree, it shouldn't be *necessarily* negative. – stevebot Jun 09 '14 at 16:29
  • 5
    Michael Feathers (http://www.amazon.com/Working-Effectively-Legacy-Michael-Feathers/dp/0131177052) is most probably not the inventor of that term, but he made an interesting definition: he called legacy code "code without tests". And that is indeed a negative attribute. – Doc Brown Jun 09 '14 at 16:56
  • 1
    "Legacy", as in "Legacy system", was meant to be a PC (politically correct rather than personal computer) way of saying "old", so the intention was that it should be a positive term rather than a negative one. Perhaps any negative connotations have only been added as PC language in general has been parodied. – ClickRick Jun 09 '14 at 17:46
  • 1
    Given also my current job experience, in my company we tend to think about "legacy code" as production code developed by people no longer in the company. Code that we are somewhat FORCED to use because (it works AND (we don't quite understand it enough to replace it OR it has created dependencies we cannot currently eliminate)). If it is undocumented, or nobody knows even how or why it works, then it has a VERY bad conotation (not by the code per se, but for the fact that such situation has come to happen). – heltonbiker Jun 09 '14 at 18:00
  • 12
    Write a bunch of code. Check it in. Go get some lunch. Come on back. There's a whole screen full of legacy code! You've now got to understand that code and make sure that all future changes work correctly in the context of that code. Legacy code is the same as *existing code*. – Eric Lippert Jun 09 '14 at 18:35
  • 4
    "Legacy" here simply means that the original developers are not around any more, and only the code and documentations artefacts are left. It does not refer to an age or quality in any way. – SK-logic Jun 09 '14 at 20:43
  • 3
    Pretty much any old code is a burden to add to or change because requirements change over time, developers move on or in hindsight you can always see ways it could have been done better. In business we don't have the luxury to refactor everything so there will always be a proportion of legacy code that we are encumbered with. This is the literal meaning of legacy. – JamesRyan Jun 10 '14 at 08:52
  • 1
    @JamesRyan Also the languages / frameworks / programming methodologies get updated. Usually those updates cause "modern" code to look much better (cleaner, more efficient) by comparison. I think this is where the "legacy code is POS" logic comes from. – MBender Jun 10 '14 at 09:29
  • I prefer the term heritage code. Avoids the negative connotations that some imply to the phrase legacy code. Implies something to be kept unless you have a good reason (and fashion isn't a good reason). – Kickstart Jun 10 '14 at 10:06
  • @Kickstart i think the problem with that is that the negativity doesn't stem from the name, but the code. :) 'Legacy' in general terms is just as positive and the spin that changing to'Heritage' adds is likely to be temporary. – JamesRyan Jun 10 '14 at 14:43
  • 1
    @JamesRyan, possibly but heritage seems to have a more positive connotation than legacy. As to the code itself, if it is reliable and works (as most is) why would you spend potentially hundreds of man years of work (easy on any non noddy system) to replace it just to move to a more modern technology that is likely to be obsolescent before the rewrite is finished. I am sure many of us have experience of platforms that were once the latest greatest thing and now very dead while the platforms they were meant to replace are still in use. – Kickstart Jun 10 '14 at 14:53

4 Answers4

39

Legacy code is based on the phrase of a legacy system that specifically applies to code. According to Wikipedia it probably dates back to the 1970s and was in common usage in the 1980s. It took off with the tech explosion of the 1990s.

This can be seen with Google's ngram viewer: legacy system,legacy code

legacy system and code

Digging into this further, you can find documented uses of the term 'legacy system' in the 1970s.

The earliest example of 'legacy system' that google has is in a book on Proceedings of the Army Numerical Analysis and Computers Conference from 1978:

... well strutted and documented solution to a clearly defined problem is the legacy system operation needs to be understood and to change the existing system with confidence.

There is also an example of 'legacy system' being used outside of the technology industry in Clout: Womanpower and Politics grin 1976:

... in addition, she holds a seat as the third-ranking Democrat on the powerful Banking and Currency Committee - positions of power she has built up on her own, not via the legacy system.

Beyond these example which shows its use has extended beyond the pure software world, the specifics of where exactly the term originated are probably lost to the sands of time. Given the military and political references, it may have originated with them (primarily the military and its jargon migration ("It seems likely that 'kluge' came to MIT via alumni of the many military electronics projects run in Cambridge during the war (many in MIT's venerable Building 20, which housed TMRC..."))

  • This is a great answer. I am going to keep researching to see if I can find an origin, but you are likely right that the origin has been lost or possibly not documented. – stevebot Jun 09 '14 at 16:31
  • 1
    @stevebot I'd suggest following the path of 'legacy system' rather than code... that term seems to have predated legacy code and has the same essential meaning. –  Jun 09 '14 at 16:42
  • 6
    The text in your 'book on carbon-carbon bond formation from 1979' is from a book called 'New practices in project management' and is from 2002 (first published 1998). It looks like something got confused in the scanning. – Pete Kirkham Jun 09 '14 at 18:46
  • 1
    Doesn't seem like this is the source of the negative term. – JeffO Jun 09 '14 at 19:05
  • @JeffO No, as MichaelT mentions its not conclusive where it came from. This is a damn good answer though which shows research and effort. – stevebot Jun 09 '14 at 19:09
  • @stevebot another bit about legacy code worth reading: [c2 LegacyCode](http://c2.com/cgi/wiki?LegacyCode). I especially like the definition of "Legacy is the stuff I wrote yesterday". –  Jun 10 '14 at 02:07
  • @PeteKirkham thank you - finally got around to updating it to two other references that do have a more clear origin (and poked a bug into Google's feedback system). –  Aug 20 '14 at 23:41
5

Legacy code base usually refers not to a POS system, but rather any system that exists in a code base or system that is no longer used for new development. For instance my team currently supports a few .net 1.1 and 2.0 applications that are considered legacy code. If there comes a time where a modification is required they will be either rewritten or updated to use the latest frameworks and standards. Until then we manage them as legacy applications that need to continue to function but no enhancements or code fixes are implemented.

There are also a few legacy systems that we do not support at all that were written in VB6 and Classic ASP. We have no capacity, or directive to support or modify these systems but as long as they continue to run and have no needs for enhancements they will not likely be updated. There is nothing particularly wrong with any of these systems. They perform their jobs the way they are supposed to and aside from looking like an app from the mid to late 90's they have no major issues.

So legacy does not mean POS just a system that was created in an earlier technology or language that is not up to current standards. Some legacy systems qualify as POS mostly because they lacked the development methodologies that exist to day that allow for managed code and the 15+ years of experience of the veteran web coders.

SoylentGray
  • 3,043
  • 1
  • 23
  • 31
  • I completely agree that Legacy systems are not necessarily POS systems. I am wondering what the origin of the phrase is. – stevebot Jun 09 '14 at 19:49
  • 3
    @stevebot If you want to find the origin of the term, you should ask for that without presupposing a connotation. – user Jun 09 '14 at 21:16
  • 2
    @stevebot - A legacy is anything you leave behind when you pass on. I would presume that the descriptor was just adopted from that they way it had been adopted to countless other fields. – SoylentGray Jun 09 '14 at 21:30
  • 1
    @MichaelKjörling are you telling me you have never heard legacy code used in a negative sense?? That isn't my connotation, but that of others I have heard time and time again in meetups, books and jobs.Like I said, I *completely* agree that legacy *should* not be a negative term. – stevebot Jun 09 '14 at 21:33
  • @stevebot - legacy code only seems 'negative', because it's only ever used in the context of replacing or interfacing with an older system (and the difficulties thereof). A program that was built over a decade ago but is still useful/relevant and has few bugs is still 'legacy software', but everyone just calls it 'software'. Same goes for codebases. – Robotnik Jun 10 '14 at 01:34
  • @stevebot Of course I'm not -- I'm just suggesting how to phrase the question in order to get the answer to what you yourself say you are looking for the answer to, rather than something else. Clear, specific questions with a minimum of superfluous material helps everyone. – user Jun 10 '14 at 06:51
3

"Legacy code" is a term used by marketing people to pressure those whose code is old (but presumably works fine) into updating to the latest greatest (and probably more bug-ridden) software languages and techniques. It is closely linked to "legacy system", which refers to old hardware and operating systems that work fine but don't conform to what is now "politically correct" (e.g. OpenVMS, IBM system).

JohnM
  • 63
  • 1
  • 6
    While this might be true, it would be better if you were to [edit] the answer to cite specific references supporting the claims made in this answer. Are there any such references that you can cite? – user Jun 10 '14 at 06:53
2

The term legacy code dates to at least 1989 as used by Glenn Everhart in comp.sys.amiga:

(...by the way, yes, I do sometimes program in C also...but I find it easier to convert legacy code w/o changing its language...)

I found nothing verifiably earlier in Google Books.

Hugo
  • 3,669
  • 2
  • 25
  • 40
  • As Eric Lippert pointed out, the very minute after you wrote a piece of code you got legacy code. The curves shown by MichaelT and your finding just visualize the time frame, where the mainstream rise of IT started to produce immense amounts of code, involving lots of people all over the world. A bit later the need to replace "old" systems by newer ones raised too - and that's why and when it became a widespread term. – JensG Jun 10 '14 at 10:13
  • 1
    Old code was being replaced constantly, if there was a good reason to. I used to work on a mainframe billing system written (in PL/1) in 1970. It replaced a system written in mainframe assembly language (which in itself was largely an automation of an existing manual system). The PL/1 system was finally replaced after about 35 years of use (couple of failed attempts to replace it prior to that). Possibly now modern technologies are scrapped far earlier (and with disregard for how much rewriting of heritage system this is likely to entail). – Kickstart Jun 10 '14 at 10:55