#0105 · 方法
重构前先锁住行为
重构 [模块] 之前,先补一组测试把它现在的行为固定下来,包括看起来奇怪的行为。测试全绿后再重构,重构完测试必须原样通过,一个断言都不改。
Before refactoring [module], write tests that pin down its current behavior, including the odd parts. Get them green, then refactor. When you're done they must pass unchanged, without editing a single assertion.
小杜
已贴 1,040 张上墙共收到 0 个章