Friday, August 6, 2010

Refactoring Study Notes

http://sourcemaking.com/refactoring



Refactoring (noun): a change made to the internal structure of software to make it easier to understand and cheaper to modify without changing its observable behavior.

Refactor (verb): to restructure software by applying a series of refactorings without changing its observable behavior.


 the purpose 

Optimization fits refactor but the code my be harder to understan.

Always be aware of which hat you are wearing.

Tidying up the code.

Regular refactoring help the code maintain its shape.

Eliminate duplicate code.

 Make the code better communicate its purpose.

Design decay

Rule of three:  1st time just do it.  2nd time wince.  3rd time refactor.

When to refactor:
  1. add a function
  2. fix a bug
  3. code review
Small code review, use code.

Large code review, use UML and CRC 
(class-responsibility-collaboration) 
cards.

Design reviews with groups, code review with individuals.

{What about using a random process to select the individual reviewers pairing?}

Ken Beck:  "Programs have two kinds of values:  what they can do for you today and what they can do for you tomorrow."

parasitic indirection - indirection that gives not value

int someValue()
{
   return noValue()
}

int noValue()
{
   return 1;
}

avoid refactoring when close to a deadline. 


OK

No comments: