When to rewrite a code base from scratch

后端 未结 18 630
悲哀的现实
悲哀的现实 2020-12-12 10:35

I think back to Joel Spolsky\'s article about never rewriting code from scratch. To sum up his argument: The code doesn\'t get rusty, and while it may not look pretty afte

18条回答
  •  温柔的废话
    2020-12-12 10:52

    Instead of a complete rewrite from scratch you want to start refactoring the code base in small steps while introducing unit tests. For example

    1. Move duplicate code into a common class with tests for resuse throughout the project
    2. Introduce interfaces to create separate testable modules. You can then refactor the implementation behind the interface while relying on your tests to ensure you don't break anything.

提交回复
热议问题