What makes code legacy?

后端 未结 21 1931
说谎
说谎 2020-12-13 02:04

I have heard many developers refer to code as \"legacy\". Most of the time it is code that has been written by someone who no longer works on the project. What is it that ma

相关标签:
21条回答
  • 2020-12-13 02:33

    Legacy generally refers to code that is no longer being developed - meaning that if you use it, you have to use it on its original terms - you cannot just edit it to support the way the world looks today. For example, legacy code has to run on hardware that may not exist today - or is no longer supported.

    0 讨论(0)
  • 2020-12-13 02:36

    Legacy code is anything written more than a month ago :-)

    0 讨论(0)
  • 2020-12-13 02:37

    A colleague once told me that legacy code was any code that you hadn't written yourself.

    Arguably, it's just a pejorative term for code that we don't like any more for whatever reason (typically because it's not cool or fashionable but it works).

    The TDD brigade might suggest that any code without tests is legacy code.

    0 讨论(0)
  • 2020-12-13 02:37

    For me legacy code is code that was written prior to some paradigm shift. It may still be very much in use but it is in the process of being refactored to bring it into line.
    e.g. Old procedural code hanging around in an otherwise OO system.

    0 讨论(0)
  • 2020-12-13 02:38

    Legacy code is code that is painful/expensive to keep current with changing requirements.

    There are two ways that this can happen:

    1. The code is unsuitable for change
    2. The semantics of the code have been swapped out to silicon

    1) is the easier of the two to recognize. It is software that has fundamental limits making it unable to keep up with the ecosystem around it. For example, a system built around O(n^2) algorithm won't scale beyond a certain point and must be re-written if requirements move in that direction. Another example is code using libraries that are not supported on the latest OS versions.

    2) Is harder to recognize, but all code of this kind shares the characteristic that people are afraid to change it. This could be because it was badly written/documented to begin with, because it is untested, or because it is non-trivial and the original authors who understood it left the team.

    The ASCII/Unicode chars that comprise living code have semantic meaning, the "why's", "what's" and to some degree the "how's", in the minds of people associated with it. Legacy code is either un-owned or the owners do not have meaning associated with large portions of it. Once this happens (and it could happen the next day with really poorly-written code), to change this code, someone must learn it and understand it. This process is a significant fraction of the time it takes to write it in the first place.

    0 讨论(0)
  • 2020-12-13 02:38

    This is a general term thrown around quite often (and quite generically) in the software ecosystem.

    Well, I like to think of legacy code as inherited code. This is simply code that was written in the past. In most cases, legacy code do not follow new/current practices and is often considered archaic.

    0 讨论(0)
提交回复
热议问题