Objective
Refactoring (Refactoring) is a process that modifies code to improve the internal structure of the program without altering the external behavior of the code. Refactoring is a disciplined and methodical process of organizing, which minimizes the chance of introducing errors in the process of finishing. 1th Chapter Reconstruction, the first case (slightly)
2nd Chapter Reconstruction Principle
What is refactoring:
Refactoring (noun): an adjustment to the internal structure of a software to improve its understanding and reduce its cost of modification without changing the behavior of the software observable.
Refactoring (verb): The use of a series of refactoring techniques, without changing the software observable behavior, under the premise of adjusting its internal structure.
The contrast with refactoring is performance optimization. As with refactoring, performance tuning typically does not change the behavior of the component (in addition to the speed of execution) and only changes its internal structure. But the two starting points are different, performance optimization often makes the code more difficult to understand, but in order to get the required performance has to do so. (Performance optimization in order to get the desired performance, have to do a bit of sacrifice, such as adding additional data structure, business logic complexity. Software reconfiguration is to improve the understanding of software, reduce its maintenance costs, the purpose of the software design structure of the internal adjustment, if the refactoring deviated from these two purposes, then should be enough. )
Why refactoring:
Reconstruction and improvement of software design
• Refactoring makes software easier to understand
L Refactoring Help Find bugs
L Refactoring improves programming speed
(The higher the understanding of the internal design structure of the software, the easier it is to see the design defects and improve the programming speed)
When to refactor:
L refactoring when adding functionality
L Refactoring when patching errors
L refactoring when code is reviewed