Comment on how programmers can ensure that their programs have no bugs"

Source: Internet
Author: User

Comment on how programmers can ensure that their programs have no bugs"

Is code review intended to find errors? Can I see logic errors in the code?
No, no errors can be found when running the test program. How can I see the code?
The purpose of the code review is:
* Check whether the code is standardized, such as naming rules and comments.
* Ensure that at least two people are familiar with a piece of code and can change it by any one.
* Check whether the design idea is actually implemented and how the code expresses the design.
* Examine the detail design that is not documented, that is, the design that is expressed directly by the code, which is dictated by the code owner and compared with the code
* Check whether the defects of the original design are exposed and need to be re-designed?

Do Programmers think their programs are wrong?
Self-confidence, no errors, and doubts about code errors. Which one is the right attitude?
I think programmers will never have 100% confidence.
Even if the program has been released and has been accepted by users for a long time, it is still not possible to confirm whether there are any errors.
It can only be assumed that errors are permanent and they are always there, but they do not break out in conditions.
What a programmer can do is to eliminate all superficial errors, increase the chance of hidden errors, and find them,
Use error-tolerant code to reduce possible errors and reduce the probability of program outbreaks after release.

The purpose of the test is to discover errors,
However, in unit tests, how high is the functional test coverage?
No 100% coverage tests. That is to say, there are always some States that cannot be tested.
The Code personnel think that errors are inevitable and need to be tested. The tester thinks that the test coverage cannot be 100%, so the code should be careful.
This is a headache and there is no perfect program.

Unit testing is a white box test, which can focus on the most critical part based on code implementation.
But it is still not covered by 100%.
Unit tests generally target the boundary data and do not require coverage, but are more effective.
The main purpose is to ensure that code changes do not undermine the original correctness. It is to provide assurance rather than to find faults.

The only way to ensure no errors is to stop writing code. The best way to reduce errors is to write less code.
Simple design and implementation are the best way to reduce errors. Few simple code errors are required.
Superfluous functionality is the biggest source of errors

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/jq0123/archive/2006/07/07/890147.aspx

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.