代码重构

What's refactoring
•The process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure.
•A disciplined way to clean up code that minimizes the chances of introducing bugs
 
Why refactoring
•Reasons :
–Design improvement and maintainance
–Better readability
–Bugs
 
Bad Smell
•Duplicated Code
•Long Method
•Large Class
•Long Parameter List
•Data Clumps
•Switch Statements
•Temporary Field
•Feature Envy
•Divergent Change
•Shotgun Surgery
•Switch Statements
•Temporary Field
•Feature Envy
•Divergent Change
•Shotgun Surgery
 
How
•Extract
•Move
•Rename
•Tests are essential
•Small steps
 
Misunderstanding
•Regular time?
•No tests?
 
 
posted @ 2012-10-16 17:01  j-road  阅读(131)  评论(0编辑  收藏  举报