Code refactoring is an effective method to repay technical debt, which caused by the modification to software. Sums up the effects of code refactoring, including improving software design, helping code understanding, defect discovery and increasing efficiency. Analyzes three opportunities for refactoring:while adding new functions, fixing defects, and code review.