What makes code legacy?

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

    I consider code "legacy" if any or all of the following conditions apply:

    • It was written using a language or methodology that is a generation behind current standards
    • The code is a complete mess with no planning or design behind it
    • It is written in outdated languages and in an outdated, non object-oriented style
    • It is difficult to find developers who know the language because it is so old

    Unlike some of the other opinions here, I've seen plenty of modern applications that work decently without unit tests. Unit testing still has not caught on with everyone. Perhaps ten years from now the next generation of programmers will look at our current applications and consider them "legacy" for not containing unit tests, just as I consider non object-oriented applications to be legacy.

    If few changes need to be made to a legacy codebase, it's better to simply leave it as-is and go with the flow. If the application needs drastic functionality changes, a GUI overhaul, and/or you can't find anyone who knows the programming language, it's time to throw away and start over. A word of warning, however: rewriting from scratch can be very time-consuming, and it's difficult to know if you've replicated all functionality. You'll probably want to have test cases and unit tests written for the legacy application and the new application.

提交回复
热议问题