Definition of "Legacy Code"

By: Johnathon Wright on: January 08, 2021

I had an interesting discussion with a client recently. I had used the word "legacy" to refer to parts of their codebase. They then repeated the word, but with somewhat more negative connotation. So I'm writing here to firm up my definition of what it means to be legacy. Here are some thoughts I got from a Slack channel:

  • [Kathryn] it's not a good definition, but i've always found that people just say "legacy" if it was there before they were haha
  • [Red] Or uses libraries, frameworks, or languages that are either no longer seeing wide usage or just plain dead 
  • [Andrew] I agree with @kathryn, but to put it fancier I think it often means code where the knowledge to maintain it is not organizationally shared and remains in the hands of a few senior developers
  • [Kathryn] That's a really good point too -- about lack of shared knowledge
  • [jag] Legacy code is "code I didn't write and want to normalize rewriting versus learning how it works"
  • [Brian] I recently heard someone use "legacy" to refer to a 3 year old because it uses an older version of angular.  They have another application that is  20 years old that uses ocx controls that they consider legacy as well.  Those seem different to me.
  • [jag] But I think it started out meaning what @Red said - just that it's slipped down the slope.
  • [Nick] I’ve always considered legacy to be the “old” product or code that is in the process of being replaced by something newer and shinier, and typically just in maintenance mode where any new features get added to the new/shiny thing
  • [Brian] Interesting.  I think I've used it more to define things that should be replaced.  Your definition is clearer in the sense that it's a system that isn't going to be used later.
  • [Red] Yeah I was trying to think of what the definition should be, but I'll definitely agree that what you all said is far more common of how its really used.  :)
    I mean I think most would agree that a bunch of ancient COBOL programs are "legacy code", but that doesn't mean that its about to be replaced.
  • [mark] I've used it both ways...as in "old code"...which often (but not always) means it out of date or lacking in some way. But there is often a bias where developers who originally wrote or architected the code are reluctant to use that term to describe it.
  • [Red] We're all sensitive to age to some extent - nobody wants to be called "legacy"
  • [Jacob] legacy code is that code you hate and/or don't understand but can't get rid of
  • [egg] I’d call it code that’s become difficult or impossible to change, whether that’s because knowledge about it has been lost, or because it’s been poorly maintained for an extended period of time (possibly on top of poor architecture).
  • [Tracy] I work in, correct problems and add new features to a code base that was started back in the early 1980s. Since the code is not the "new thing" and the language is no longer supported by the company that wrote it. I work in legacy code all day.
  • [Paul] "Working Effectively With Legacy Code" defines it as "Any code you're afraid of," which prompted me to observe that most startups produce legacy code the moment it leaves the programmers' fingertips.
  • [tim] maybe, it's better that I work on the legacy project. But some of the code in our system is very difficult to touch and it is brittle.
  • [Red] Yeah I like that - it doesn't imply that its about to go away, but it does imply the end of real investment.
  • [mullican] A fuller quote from the book Working Effectively with Legacy Code:
  • [haizop] I would say that "legacy" usually implies:
    1. the code is somehow organizationally antecedent to current development initiatives. Something has changed, either there is a new team, a new product, etc.
    2. AND the code is deemed to be technically out of line with current initiatives, for any number of reasons, be they libraries are out of date, architecture is deemed bad, etc.
  • [Paul] Yeah. To me, the key question isn't really about the code you have, but about the code you want. It's amazing to me how many times I've heard "let's refactor this." OK, fair enough. But refactor it to what?
  • I think we generally agree on the following:
    1. The definition between what it really means and what people use it to mean are different.
    2. What it actually means is code that has been in production for some extended period of time, where the domain knowledge around the code is rather specialized, and where the age of the codebase shows in terms of hacks, workarounds, kludges, and tightly-coupled codepaths.
    3. People often misuse the term to mean code they wish didn't exist anymore and to imply/wishcast that the code ought to be replaced with newer code, in part because people like building new things, in part because people tend to underestimate the domain complexity, and in part because people don't want to take the time to understand it. 
      Is that fair?
  • [Jacob] it's also a scapegoat to get out of work "oh that's built on legacy code and only bob can work on that"
  • [Paul] It can be that, but to @haizop's point, it can be perfectly legitimate to say "that system isn't consistent with our current architecture." And "it would be prohibitively expensive to rewrite."
  • [Andrew] To that last point @Paul Snively I think another aspect of this is that it's code you shouldn't copy/use as a model for new code. Telling a new engineer, "that's legacy" is a way of saying, we don't do it like that anymore
  • [Paul] Which is not at all to say "it has no value" (it's probably generating revenue!) or "the people who wrote it were idiots" (no; they were working under different constraints).
  • [Jacob] i maintain a php app that was started in 1998. after about 7 years of hacking on it it was a huge mess that needed to be iterated towards something more maintainable. no budget or time for that. so they decided to rewrite the whole thing from scratch, in cold fusion. in 2007-8 (right around when there was about 7 people actively writing new apps in coldfusion). after about 3-4 years and who knows how many millions spent, it launched with 1/4 the features and 10x the bugs and 3x the maintenance costs. the coldfusion app got shuttered last year. the php one is still going.
  • [Paul] I don't think I've heard of Cold Fusion since 2007.
  • [jag] CFML PTSD I think is actually in DSM-V.
  • [Paul] That's another thing I don't get: "We're going to take the same team that wrote system X, not do any new training or hiring, not going to significantly change technology, but we're going to rewrite system X, and it'll be much better."
  • [Jacob] no no no. they hired a whole new team while not telling my team it was being rewritten. just that my budget was frozen.
  • [jag] It's a way of saying "Those mistakes were so much fun to make the first time - let's make them again!" Throwing away domain experience is just setting fire to money.
  • [Paul] It's such a weird idea, that software developers are interchangable cogs, when we're much closer to heart surgeons.
  • [Andrew] Heart surgeons who operate on different species of animals, including some aliens that have unique heart configurations no one has ever seen before
  • [haizop] Few things at work annoy me more than hearing a PM refer to an engineer as a "resource".

I had an interesting discussion with a client recently. I had used the word "legacy" to refer to parts of their codebase. They then repeated the word, but with somewhat more negative connotation. So I'm writing here to firm up my definition of what it means to be legacy. Here are some thoughts I got from a Slack channel:

  • [Kathryn] it's not a good definition, but i've always found that people just say "legacy" if it was there before they were haha
  • [Red] Or uses libraries, frameworks, or languages that are either no longer seeing wide usage or just plain dead 
  • [Andrew] I agree with @kathryn, but to put it fancier I think it often means code where the knowledge to maintain it is not organizationally shared and remains in the hands of a few senior developers
  • [Kathryn] That's a really good point too -- about lack of shared knowledge
  • [jag] Legacy code is "code I didn't write and want to normalize rewriting versus learning how it works"
  • [Brian] I recently heard someone use "legacy" to refer to a 3 year old because it uses an older version of angular.  They have another application that is  20 years old that uses ocx controls that they consider legacy as well.  Those seem different to me.
  • [jag] But I think it started out meaning what @Red said - just that it's slipped down the slope.
  • [Nick] I’ve always considered legacy to be the “old” product or code that is in the process of being replaced by something newer and shinier, and typically just in maintenance mode where any new features get added to the new/shiny thing
  • [Brian] Interesting.  I think I've used it more to define things that should be replaced.  Your definition is clearer in the sense that it's a system that isn't going to be used later.
  • [Red] Yeah I was trying to think of what the definition should be, but I'll definitely agree that what you all said is far more common of how its really used.  :)
    I mean I think most would agree that a bunch of ancient COBOL programs are "legacy code", but that doesn't mean that its about to be replaced.
  • [mark] I've used it both ways...as in "old code"...which often (but not always) means it out of date or lacking in some way. But there is often a bias where developers who originally wrote or architected the code are reluctant to use that term to describe it.
  • [Red] We're all sensitive to age to some extent - nobody wants to be called "legacy"
  • [Jacob] legacy code is that code you hate and/or don't understand but can't get rid of
  • [egg] I’d call it code that’s become difficult or impossible to change, whether that’s because knowledge about it has been lost, or because it’s been poorly maintained for an extended period of time (possibly on top of poor architecture).
  • [Tracy] I work in, correct problems and add new features to a code base that was started back in the early 1980s. Since the code is not the "new thing" and the language is no longer supported by the company that wrote it. I work in legacy code all day.
  • [Paul] "Working Effectively With Legacy Code" defines it as "Any code you're afraid of," which prompted me to observe that most startups produce legacy code the moment it leaves the programmers' fingertips.
  • [tim] maybe, it's better that I work on the legacy project. But some of the code in our system is very difficult to touch and it is brittle.
  • [Red] Yeah I like that - it doesn't imply that its about to go away, but it does imply the end of real investment.
  • [mullican] A fuller quote from the book Working Effectively with Legacy Code:
  • [haizop] I would say that "legacy" usually implies:
    1. the code is somehow organizationally antecedent to current development initiatives. Something has changed, either there is a new team, a new product, etc.
    2. AND the code is deemed to be technically out of line with current initiatives, for any number of reasons, be they libraries are out of date, architecture is deemed bad, etc.
  • [Paul] Yeah. To me, the key question isn't really about the code you have, but about the code you want. It's amazing to me how many times I've heard "let's refactor this." OK, fair enough. But refactor it to what?
  • I think we generally agree on the following:
    1. The definition between what it really means and what people use it to mean are different.
    2. What it actually means is code that has been in production for some extended period of time, where the domain knowledge around the code is rather specialized, and where the age of the codebase shows in terms of hacks, workarounds, kludges, and tightly-coupled codepaths.
    3. People often misuse the term to mean code they wish didn't exist anymore and to imply/wishcast that the code ought to be replaced with newer code, in part because people like building new things, in part because people tend to underestimate the domain complexity, and in part because people don't want to take the time to understand it. 
      Is that fair?
  • [Jacob] it's also a scapegoat to get out of work "oh that's built on legacy code and only bob can work on that"
  • [Paul] It can be that, but to @haizop's point, it can be perfectly legitimate to say "that system isn't consistent with our current architecture." And "it would be prohibitively expensive to rewrite."
  • [Andrew] To that last point @Paul Snively I think another aspect of this is that it's code you shouldn't copy/use as a model for new code. Telling a new engineer, "that's legacy" is a way of saying, we don't do it like that anymore
  • [Paul] Which is not at all to say "it has no value" (it's probably generating revenue!) or "the people who wrote it were idiots" (no; they were working under different constraints).
  • [Jacob] i maintain a php app that was started in 1998. after about 7 years of hacking on it it was a huge mess that needed to be iterated towards something more maintainable. no budget or time for that. so they decided to rewrite the whole thing from scratch, in cold fusion. in 2007-8 (right around when there was about 7 people actively writing new apps in coldfusion). after about 3-4 years and who knows how many millions spent, it launched with 1/4 the features and 10x the bugs and 3x the maintenance costs. the coldfusion app got shuttered last year. the php one is still going.
  • [Paul] I don't think I've heard of Cold Fusion since 2007.
  • [jag] CFML PTSD I think is actually in DSM-V.
  • [Paul] That's another thing I don't get: "We're going to take the same team that wrote system X, not do any new training or hiring, not going to significantly change technology, but we're going to rewrite system X, and it'll be much better."
  • [Jacob] no no no. they hired a whole new team while not telling my team it was being rewritten. just that my budget was frozen.
  • [jag] It's a way of saying "Those mistakes were so much fun to make the first time - let's make them again!" Throwing away domain experience is just setting fire to money.
  • [Paul] It's such a weird idea, that software developers are interchangable cogs, when we're much closer to heart surgeons.
  • [Andrew] Heart surgeons who operate on different species of animals, including some aliens that have unique heart configurations no one has ever seen before
  • [haizop] Few things at work annoy me more than hearing a PM refer to an engineer as a "resource".





Comments:

Just checking that you are human. What would be the result of this code?

a = 3*(4/2); b = 1; a+b

snkrspop said: Your writing is really informative, especially because it's so meaningful and updated. Thanks for sharing this wonderful post! Jordan 1 RepsWhen the Air Jordan 1 was created, there was not that much actual tech out there for basketball shoes. Nike changed this by incorporating Air technology in the midsole.

herry said: The post is very informative and useful. You and everyone are doing a great job. Go on emoji

James said: Moving can be expensive, so it is important to create a budget for your move. Include expenses such as moving trucks or hiring movers, packing supplies, and any fees associated with your new home. This will help you stay within your budget and avoid any unexpected expenses. Moving Company Nashville

olivia rhode said: I have been using services from the sites down below and you won't believe it, it's really helpful for me with such ease and smoothness. Whenever I get into trouble while logging in or signing up to my account, I use these sites to deal with my issues and it has been really great help and i suggest you to others to use it these sites. Visit : https://sites.google.com/tomsazure.com/peraalgowallet/home https://sites.google.com/tomsazure.com/paypal-login/ https://sites.google.com/metamaaslogi.com/metamaskextension/ https://sites.google.com/365cryptocurrencies.com/phantomwalletextensions/home PayPal Login Phantom Wallet MetaMask Chrome Extension MetaMask Wallet Extension Pera Algo Wallet

jack maa said: We will explore every bit of the details that you need to know in order to hit the road of trading using the Bybit login platform such as what is Bybit. Hex.com is a platform where you can swap your ETH tokens to acquire the HEX token. The platform is celebrating over three years of flawless operations

sam said: good.herry said: The post is very informative and useful. صب واي سيرفرس من سيربح المليون لعبة جاتا العاب كلاش

James99 said: Keeping your cement tile roof clean is vital for its longevity. Moss, algae, and lichen can grow on the tiles, which not only detracts from your home's curb appeal but also can cause damage over time. https://www.yumlist.ca/davie/roofing/sweet-kristy

WilliamEvoms said: Армия Казахстана – это современная и профессиональная военная сила, играющая ключевую роль в обеспечении национальной безопасности и защите интересов страны. Вооруженные силы Казахстана обладают высоким уровнем подготовки и оснащены передовым военным оборудованием, что позволяет им успешно выполнять свои обязанности как на территории страны, так и за ее пределами. Одним из важных аспектов деятельности армия новости Казахстана является подготовка высококвалифицированных специалистов. Благодаря системе профессионального обучения и строгому отбору кадров, военнослужащие страны обладают необходимыми навыками и знаниями для эффективного выполнения своих обязанностей. Кроме того, армия Казахстана активно участвует в международном сотрудничестве и миротворческих миссиях, способствуя поддержанию стабильности и безопасности в регионе и в мире в целом. Военные силы Казахстана остаются важным столпом национальной обороны и гордостью страны как и беспилотники, обеспечивая ее защиту и способствуя сохранению мира и стабильности.

casino said: casino

deneme bonusu said: deneme bonusu
Back