论坛首页 Java企业应用论坛

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

浏览 1138 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2012-11-21  
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.
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics