1. What is refactoring?
Reconstruction (TERM): an adjustment to the internal structure of the software. The purpose is to improve the comprehensibility and reduce the modification cost without changing the [suspicious behavior of the software.
Refactoring (verb): uses a series of refactoring principles (techniques) to adjust the structure without changing [software-aware Behavior.
Two hats: Add new features and refactor
2. Why rebuild
Improve the software design to organize and modify the code structure to eliminate repeated code (duplicate code)
Make the software easier to understand
Helping you find bugs
Helping you increase programming speed
3. When to refactor
1) when the three rules do something for the first time, they only do it. If they do something similar for the second time, they will dislike it, but they do it anyway. The third time they do something similar, you should refactor it.
Three strikes and you refactor)
2) added functions and restructured them together.
3) rebuild together with fixing errors
4) Review the code and refactor it together
5. Difficult Reconstruction
Database
Modify the interface (do not release the interface too early. Please modify your code ownership policy to make refactoring smoother)
Time should not be restructured (the code is too messy, and it is better to rewrite a rebuild; the project is near the deadline and there is no time, but it should have been re-built long ago)
6. refactoring and Performance
8. Reconstruction Origin
I have not carefully read the following sections.