What can you do to a legacy codebase that will have the greatest impact on improving the quality?

前端 未结 11 1198
既然无缘
既然无缘 2021-01-30 06:51

As you work in a legacy codebase what will have the greatest impact over time that will improve the quality of the codebase?

  • Remove unused code
  • Remove dup
11条回答
  •  清歌不尽
    2021-01-30 07:34

    I work with a legacy 1M LOC application written and modified by about 50 programmers.

    * Remove unused code
    

    Almost useless... just ignore it. You wont get a big Return On Investment (ROI) from that one.

    * Remove duplicated code
    

    Actually, when I fix something I always search for duplicate. If I found some I put a generic function or comment all code occurrence for duplication (sometime, the effort for putting a generic function doesn't worth it). The main idea, is that I hate doing the same action more than once. Another reason is because there's always someone (could be me) that forget to check for other occurrence...

    * Add unit tests to improve test coverage where coverage is low
    

    Automated unit tests is wonderful... but if you have a big backlog, the task itself is hard to promote unless you have stability issue. Go with the part you are working on and hope that in a few year you have decent coverage.

    * Create consistent formatting across files
    

    IMO the difference in formatting is part of the legacy. It give you an hint about who or when the code was written. This can gave you some clue about how to behave in that part of the code. Doing the job of reformatting, isn't fun and it doesn't give any value for your customer.

    * Update 3rd party software
    

    Do it only if there's new really nice feature's or the version you have is not supported by the new operating system.

    * Reduce warnings generated by static analysis tools
    

    It can worth it. Sometime warning can hide a potential bug.

提交回复
热议问题