How often should you refactor?

前端 未结 25 2271
耶瑟儿~
耶瑟儿~ 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:22

    We're having a discussion at work on this right now. We more or less agree that "write it so it works, then fix it". But we differ on the time perspective. I am more "fix it right away", my coworker is more "fix it in the next iteration".

    Some quotes that back him up:

    Douglas Crockford, Senior Javascript Architect Yahoo:

    refactor every 7th sprint.

    Ken Thompson (unix man):

    Code by itself almost rots and it's gonna be rewritten. Even when nothing has changed, for some reason it rots.

    I would like that once done with a task the code submitted is something you can come back to in 2 months and think "yes, I did well here". I do not believe that it is easy to find time to come back later and fix it. believing this is somewhat naive from my point of view.

    Edit: spelling error

提交回复
热议问题