What makes code legacy?

后端 未结 21 1914
说谎
说谎 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:22

    What is it that makes code, legacy code?

    As with plain legacy, when the author is dead or missing, you as a heir get all or some of his code.

    You shed some tears and try to figure out what to do with all this rubbish.

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

    Michael Feathers has an interesting definition in his book Working Effectively with Legacy Code. According to him legacy code is code without automated tests.

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

    It is a very general (and oft abused term) but any of the following would be legitimate reasons to call an app legacy:

    1. The code base is based on a language/platform which is entirely unsupported by the manufacturer of the original product (often said manufacturer has gone out of business).

    2. (really 1a) The code base or platform on which it is built is so old that getting qualified or experienced developers for the system is both hard and expensive.

    3. The application supports some aspect of the business which is no longer actively grown and for which alterations are extremely rare, normally to fix it if something entirely unexpected changes around it (the canonical example being the Y2K issue) or if some regulation/external pressure forces it. Since both reasons are pressing and normally unavoidable but no significant development has occurred on the project it is likely that those people assigned to deal with this will be unfamiliar with the system (and it's accumulated behaviours and intricacies). In these cases this would often be reason to increase the perceived and planned for risk associated with the project.

    4. The system has/or is being replaced with another. As such the system may be used for much less than originally intended, or perhaps only as a means of viewing historical data.

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

    Nobody is gonna read this, but I feel the other answers don't get it quite right:

    1. It has value, if it wasn't useful it would've been thrown away long ago
    2. Its hard to reason about because either of
      1. Lack of documentation,
      2. Original author cannot be found or forgot (yes 2 months later your code can be legacy code too!!),
      3. Lack of tests or typesystem
      4. Doesn't follow modern practices (ie no context to hold on too)
    3. There is a requirement to change or extend it. If there isn't a requirement to change it, it isn't legacy code since nobody cares about it. It does its thing and there is nobody around to call it legacy code.
    0 讨论(0)
  • 2020-12-13 02:26

    Quite honestly legacy code is any code, framework, api, of other software construct thta's not "cool" anymore. For example COBOL is unanimously regarded as legacy while APL is not. Now one can also make the case that COBOL is consideed legacy and APL not because it has about 1m times the install base as APL. However, if you say that you need to work on APL code the reply would not be "oh no, that legacy stuff" but rather "oh my god, guess you won't be doing anything for the next century" see the difference?

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

    Code (or anything else, really) becomes "legacy" when it has been replaced by something newer/better, and yet despite this it's still used and kept alive "in the wild".

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