Incorrect implantation and the wisdom of our ancestors

Source: Internet
Author: User
A Test Engineer sent me an email yesterday asking me the answer to a question given by the software reviewer. The question is about estimating the number of defects in the system. The original question is as follows:

The two groups test the sameProgramThe first group found 25 errors, the second group found 30 errors, 15 of the errors found in the two groups were common, so we can estimate the total number of errors in the program is.

A.25 B .30 C.50 D.60

Of course, any friend who knows the estimation method can calculate 50 results based on the formula, which is no problem. -- However, I will reference this question here, hoping that we can make it more interesting to learn it through analogy.

In fact, how to estimate the number of defects in a system has long been a ready-made method. Believe it or not, please refer to a practical question I found in our ancestor's mathematical monograph: "How can we estimate the number of fish in the pond without knowing how many fish are there?" (Of course, this is not the case in the original text. Please forgive me for failing to find the source at once, so I have to describe it in my language based on my memory ). The answer given by our ancestors is as follows:

    1. First, some fish are fished out from the fish pond (assuming the number is m );
    2. Mark the fish and place them back in the pond;
    3. Wait for a while, wait until the fish are evenly distributed in the pond, and then salvage some fish again (assuming the number is N );
    4. Count the marked person in the second salvage fish (assuming the number is P );
    5. The number of fish in the pond is calculated as S = m/(P/N)

The simplest understanding of this answer is:Assume that the marked fish are evenly distributed in the pond for the first time, and P out of N fish are marked for the second time, it indicates that the density of the marked fish is P/N, and there are m marked fish in the pond. Of course, the total number of fish is S = m/(P/N )..

Back to our original problem, it is easy to make an analogy. The first group found 25 defects (equivalent to the first salvage fish m ), the second group found 30 defects (equivalent to fish N on the second salvage), 15 of which were the same (equivalent to P), so the answer was 50.

Therefore, from now on, do not consider this method as an esoteric Method -- let's see, our ancestors can use it skillfully.

We can come to an end here, but can we further think about this problem?

This method can obviously obtain an estimation result, but in which situations is this method not suitable and there are no precautions when using it?

Let's look back at the example of fish farming. Obviously, the premise of our discussion is that "the marked fish are evenly distributed in the pond." If this condition is not met, our estimation results are obviously quite different. In terms of fish ponds, different types of fish prefer to be distributed at different levels due to different types of food. In this way, you should pay attention to the issue during salvage, if you only focus on a certain water layer, it is obvious that there is a great deviation. In addition, because the temperature on the side of the pond is relatively low, fish prefer to rest at the pond in summer ......, It can be seen that it is still difficult to achieve the "average" condition ...... -- Wait. We have discussed the relationship between fish and our defects for so long?

Don't forget that the distribution of defects in the system is similar to that of fish in the fish pond. Different types of defects (functional defects, performance defects, security defects ......), Distributed in different modules. due to differences in the level of the module design and implementation personnel, and differences in the complexity of the module itself, the distribution of defects in different modules is obviously different. In a system, the efficiency of discovering different types of defects varies depending on the test ...... -- Let's see if this is the same as our fish pond?

If we want to go deep into the stories about fish ponds and defects, we will find that they have many things in common. Of course, you can also propose various methods to correct our simple model-but this is not our focus.The point I want to talk about is: in any case, is thinking on this road more interesting than simply memorizing formulas?

Test engineers often ask how to achieve the highest learning efficiency?

My answer is:Learning and thinking are fun, not a burden. We learn to pursue its own pleasure-the pleasure of acquiring knowledge, the fun of finding, and the pleasure of sharing in our minds-as for "The Gold house in the book, the book has its own face like a jade. "sorry, in general, such learners and I are not one of them.

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.