>When thinking slowly, you should never take an action (e.g. running a test or interacting with your program) without predicting what will happen and why. Do this even with the most obvious predictions: this empty test should pass, or when I visit my local app I should see the main page in my browser. Be as specific as possible. Don’t predict “I should get an error here”, predict the specific type of error. This is particularly important when debugging, because a buggy program always reflects a lack of understanding, and a lack of understanding always causes failed predictions about how the software should behave. If you can find the spot where you fail to predict the software, you’re well on your way to debugging it.
Yeah, it's like the Feynman technique — explaining a subject in your own words — but with external feedback from reality.
The empty test thing in particular... I often break out of extensive, frustrating debugging sessions by getting annoyed and adding debug statements everywhere, and suddenly realizing that none of the code I was looking at was even running in the first place. Perhaps I would have saved time by testing that assumption first, rather than last!
>When thinking slowly, you should never take an action (e.g. running a test or interacting with your program) without predicting what will happen and why. Do this even with the most obvious predictions: this empty test should pass, or when I visit my local app I should see the main page in my browser. Be as specific as possible. Don’t predict “I should get an error here”, predict the specific type of error. This is particularly important when debugging, because a buggy program always reflects a lack of understanding, and a lack of understanding always causes failed predictions about how the software should behave. If you can find the spot where you fail to predict the software, you’re well on your way to debugging it.
Yeah, it's like the Feynman technique — explaining a subject in your own words — but with external feedback from reality.
The empty test thing in particular... I often break out of extensive, frustrating debugging sessions by getting annoyed and adding debug statements everywhere, and suddenly realizing that none of the code I was looking at was even running in the first place. Perhaps I would have saved time by testing that assumption first, rather than last!