03 Refactoring _ Improve the design of existing code reading notes of the third

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.