O'Reilly logo
  • WEI EN WEI EN thinks this is interesting:

Whenever I do refactoring, the first step is always the same. I need to ensure I have a solid set of tests for that section of code. The tests are essential because even though I will follow refactorings structured to avoid most of the opportunities for introducing bugs, I’m still human and still make mistakes. The larger a program, the more likely it is that my changes will cause something to break inadvertently—in the digital age, frailty’s name is software.

From

Cover of Refactoring: Improving the Design of Existing Code

Note

在數位時代裡,軟體是易碎品的代名詞。所以重構的第一步是先確保已經有足夠的測試,然後才開始試著改寫你的程式碼。