`
feikiss
  • 浏览: 99988 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

Some noteson reading the book <refactoring, improving the design existing code>

阅读更多
While reading the book <refactoring, improving the design of existing code>, I got some impressed tips and mark them as below.

When you use refactoring to develop software, you divide your time between two distinct activities: adding function and refactoring. When you add function, you shouldn't be changing existing code; you are just adding new capabilities. You can measure your progress by adding tests and getting the tests to work. When you refactor, you make a point of not adding function; you only restructure the code. You don't add any tests (unless you find a case you missed earlier); you only restructure the code. You don't add any tests (unless you find a case you missed earlier); you only change tests when you absolutely need to in order to cope with a change in an interface.


when should you refactor?

Here's a guideline Don Roberts gave me: The first time you do something, you just do it. The second time you do something similar, you wince at the duplication, but you do the duplicate thing anyway. The third time you do something similar, you refactor.

Tips:

Three strikes and you refactor.
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics