03 Refactoring _ Improve the design of existing code reading notes of the third
The main features of this book are:
Refactoring is the process of modifying a program at a small pace, and if you make a mistake, you can easily find it.
Any fool can write code that can be understood by a computer. The only good programmer is to write code that is easy for human to understand.
Refactoring (noun): an adjustment to the internal structure of software to improve its understanding and reduce its modification cost without changing the observable behavior of software.
Refactoring (noun): Use a series of refactoring techniques to adjust the structure without changing the observable behavior of the software.
Charm, three reconstruction.
Do not publish the interface prematurely. Please modify your code ownership policy to make refactoring smoother.
When you feel the need to write comments, try refactoring first, and try to make all comments redundant.
Make sure that all tests are fully automated so that they can check their test results.
A set of tests is a powerful bug detector that can drastically reduce The time it takes to find a bug.
Run tests frequently. Every time you compile, take your tests into account-at least once every day for each test.
Whenever you receive a bug report, please write a unit test to expose the bug.
Writing for perfect testing and actually running is better than endless waiting for perfect testing.
Consider the possible error boundary conditions and concentrate the test firepower there.
When things are supposed to go wrong, don't forget to check if the expected exception was thrown.
Do not write tests because the tests cannot capture all bugs , because the tests do capture most bugs.
03 Refactoring _ Improve the design of existing code reading notes of the third