How do you refactor?

前端 未结 14 1231
别那么骄傲
别那么骄傲 2020-12-13 03:06

I was wondering how other developers begin refactoring. What is your first step? How this process (refactoring) differ if you refactor code which is not yours? Do you write

14条回答
  •  Happy的楠姐
    2020-12-13 03:22

    Start with getting unit tests, and then use automated refactoring tools. If the refactoring can't be automated then it's not truly a mechanical transformation of the code and so isn't a refactoring. The unit tests are to make sure that you are truly just performing mechanical transformations from one codebase to an equivalent one.

提交回复
热议问题