顽石

人生在勤,不索何获!
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Refactoring--1

Posted on 2010-04-01 11:21  顽石  阅读(148)  评论(0编辑  收藏  举报

When you find you have to add a feature to a program, and the program's code is not structured in a convenient way to add the feature, first refactor the program to make it easy to add the feature, then add the feature.

 

Before you start refactoring, check that you have a solid suite of tests. These tests must be self-checking.

 

Refactoring changes the programs in small steps. If you make a mistake, it is easy to find the bug.