Two-way smoke debugging--programming debugging kick

Source: Internet
Author: User

Someone said that the procedure is to be transferred out, and do not say whether this sentence is one-sided, it is undeniable that debugging is very important.

The purpose of debugging is to find out the problem, the dichotomy of smoke debugging is the simplest and most effective way to locate large code problems, because this debug method locates the error code line with the time complexity of the logarithmic order.

The name "Binary Smoke Debugging" may be a bit confusing. In fact, it is very simple, the concept of "dichotomy" is taken from our common "dichotomy", this should not be explained, and "smoke" is taken from the "smoke test", whether 3,721 run first to see if it is normal or not.

"Binary smoke Debugging" is ideal for use in dynamic languages such as PHP, Javascript, and many times because of the dynamic nature of language that makes it difficult to locate problem codes.

For example, a project is a custom development based on a third-party PHP system. The system defines its own template mechanism, which can nest PHP code in a template. A row in a hundreds of-line code has a wrong line in the template file, but the error message can only be located to the file.

At this time the two-way smoke debugging can debut:

  • First the file waist cut off half of the code, refresh the browser, wrong?
  • Have, cut off the remaining code of half the code, that is, the total code of 1/4, refresh the browser, error?
  • Yes, it means there's a problem with the code that's at least just deleted.
  • Cut off the existing normal code to just cut off half of the code to stick back, refresh the browser, wrong?
  • ......
  • So repeated, the basic three times can be fixed to the wrong.

Step seems troublesome, in fact, very save time and effort. You can use this method to locate the error code and then analyze the cause of the error.

The idea of dichotomy in the commissioning of a lot of deformation usage, the time is limited today is not discussed in detail, and later if there is time to add it.

Two-way smoke debugging--programming debugging kick

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.