Refactoring Improving the Design of Existing Code

Refactoring Improving the Design of Existing Code


Refactoring,a First Example

  • A poorly designed system is hard to change.Hard because it is hard to figure out where the changes are needed.
  • 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.
  • The first step in refactoring is building a solid set of tests.
  • Refactoring changes the programs in small steps. If you make a mistake, it is easy to find the bug.
  • Good code should communicate what it is doing clearly, and variable names are a key to clear code
  • Any fool can write code that a computer can understand. Good programmers write code that human can understand.

你可能感兴趣的:(Refactoring Improving the Design of Existing Code)