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

WayneIndup said: We accept YAHOO email account registration upon request. You only need to pay 50% in advance. Then send the desired email list. We will register according to that list. Pay the remaining 50%. We will send the files to you. Received file format Email:password:Cookies For further details please contact Telegram https://t.me/chainsdev Zalo : O93467O123

Wilberdes said: https://accsmarket.net is actively seeking passionate partners to join our dynamic sales team. As a partner, you'll gain access to our extensive inventory of verified accounts across multiple platforms. Collaborate with us to unlock new opportunities for growth and success in the digital landscape. Click here : https://AccsMarket.net

RaymondHew said: Welcome to https://Accsmarket.net, your premier destination for a diverse array of accounts tailored to meet your digital needs. From social media platforms to gaming accounts, and everything in between, we offer a comprehensive selection to suit every requirement. Whether you're a business seeking to enhance your online presence or an individual looking to level up your gaming experience, https://Accsmarket.net has you covered. Our platform prides itself on providing high-quality, verified accounts, ensuring security and reliability with every purchase. Explore our extensive inventory today and unlock new possibilities in the digital realm with https://Accsmarket.net. Click to : https://Accsmarket.net

RaymondHew said: Introducing https://Accsmarket.net, your premier destination for purchasing a wide array of accounts across diverse platforms. Whether you're in need of social media profiles, gaming logins, or business accounts, we offer a seamless and secure solution. Explore our extensive selection of verified accounts and streamline your digital endeavors with ease on https://Accsmarket.net Click today : https://Accsmarket.net

MichaelLergy said: https://AccBulk.com makes buying bulk verified accounts easy and convenient. Our PVA accounts are designed to work on any social media platform, created with different server IPs for maximum security. Trust us for fast, reliable service and instant access to the accounts you need. Read More: https://AccBulk.com Thanks a Lot!

one cargo said: THE ONE CARGO บริการรับ สั่งของจากจีน นำเข้าสินค้าจีน ให้บริการฝากสั่งซื้อ นำเข้าแบบปลีก โดยทางบริษัทช่วยสั่งซื้อให้และนำเข้ามาให้สะดวกครบจบ เหมาะสำหรับลูกค้าที่สั่งสินค้าไม่เป็น ต้องการให้ทางบริษัททำให้ทุกอย่าง ต้องการซื้อใช้เองชำระเงินรอบเดียวจบ รอรับสินค้าอย่างเดียว

PeterDok said: https://AccBulk.com is your trusted partner for buying verified social media accounts. Our PVA accounts are secure, reliable, and ready to use across various platforms, providing you with the tools you need for success. Shop now and enjoy fast, hassle-free access to your accounts. Click & See: https://AccBulk.com I’m Grateful!

BrandonBic said: For verified accounts that deliver, choose https://AccsMarket.net. We offer a wide range of PVA accounts that are secure, reliable, and ready to use on any social media platform. Shop with confidence and enjoy fast, hassle-free access to your new accounts. Access Now: https://AccsMarket.net Thank You Greatly!

PeterDok said: https://AccBulk.com specializes in offering bulk verified accounts that are perfect for marketers, influencers, and businesses. Our PVA accounts are created with unique server IPs, providing the security and reliability you need. Shop with us for fast, secure access to high-quality accounts. Head Over: https://AccBulk.com Grateful!

PnhiGew said: Я бля вам устрою, мне уже на все насрать, не надо было трогать этого клиента. Есть желание решить вопрос мирно? Жду звонка 89372555454 Или решения вопроса armor.zmi@mail.ru тут ваш выбор
Back