I talked about debugging as binary search in
The bug was the kind which lives in time axis, on which we performed binary search. This time, I would like to talk about a bug that lives in space. And in this case, we cannot do binary search.
Suppose you got a new USB device. You attached to your PC, and the device didn’t work.
PC --- USBdevice
Probably you start to brame the USB device. If you have purchased the device
you may call the customer service. If you have built the device, you might start to debug the device. And this is a typical way to waste time.
In fact, there are two cases you have to look into fairly.
PC --- USBdevice | V PC --- USBdevice2 PC2 --- USBdevice
My point is to swap an element at a time to get OK case. You try to (1) swap USBdevice with the second one, or (2) swap PC with the second one.
You may not have the second USB device, then you cannot do (1). But if you
have the second PC, (2) is easy to do. You should look at those possibilities equally to get OK point.
But is this all? No. If you see the setup in the following way, you may want to swap USB cable, too. By the way, this really happened to me. After tweaking USB device quite a while, I found the bad was the USB cable.
PC --- USBcable --- USBdevice
And that is not the end. For example,
PC --- USBdriver --- USBcable --- USBdevice | ACadapter
Because there are so many elements are involved, binary search is not suitable for this kind of debugging. I usually swap one element at a time. However, one rule is still valid. Get OK and NG cases first.