How often should you refactor?

前端 未结 25 2297
耶瑟儿~
耶瑟儿~ 2020-12-13 01:36

I had a discussion a few weeks back with some co-workers on refactoring, and I seem to be in a minority that believes \"Refactor early, refactor often\" is a good approach t

25条回答
  •  天命终不由人
    2020-12-13 02:06

    Refactor opportunistically! Do it whenever it's easy.

    If refactoring is difficult, then you're doing it at the wrong time (when the code doesn't need it) or on the wrong part of the code (where there are better efficiencies to be gained elswhere). (Or you're not that good at refactoring yet.)

    Saving refactoring for "maintenance" is a tautology. Refactoring is maintenance.

提交回复
热议问题