Recently I had a conversation with a friend that had had a very interesting question from a Manager during an interview. After I figured out the answer, I realized that the same concept can be used for finding defects in Project output, and that it is the most efficient way to narrow down failure in either code or process. Since I know you are all wondering, here is the question:
You have 20 red marbles, all of which weigh the same except for 1 which is 1 ounce lighter. You only have a balance scale and you have to identify which marble is lighter. You are only able to use the scale 4 times. How do you do it with 100% accuracy?
So, when there’s a bug in a process and you don’t know where is, what do you do? Well, we know we have to isolate what area of the process (or code) it resides, so that we can fix it. Rather than just fish around in what could be thousands of moving parts, the “Rule of Half” will help. All you need to do is isolate the process and half it testing the pieces independently. I realize that this sounds easy and it’s not, but it certainly will help to narrow down where the failure doesn’t reside. Let’s say that we have a process that is 100 steps long. Let’s start by looking at step 50 and gauging quality. It we already have a defect, we cut it in half again (now at 25) which will tell us which 12 steps are causing the issue. So, through six iterations of this process, in theory you should be able to identify the individual step causing the failure, because each step has been isolated. I realize that with Software Development that isolating functions is difficult, but using the concept of testing chunks and isolating pieces is a lot easier than starting at the very beginning and going through each step - how much time would be wasted if the error resided at step number 99? I don’t know about you, but I would rather be as effective and efficient as possible, so when bug hunting and you have doubt where to start, I say start in the middle, not the beginning!
Although I know you have already figured out that marble brain teaser, I’ve included a visual to outline how to use that balance scale only 4 times to isolate the weight of every single marble. As long as you follow the branch that weighs more you are guaranteed to know which one is different. Happy Bug Hunting!