There’s a universal experience that every programmer has had (and likely continues to have throughout their programming life). Some part of the code isn’t working how you expect it to—perhaps it’s crashing, or a test is failing, or it’s producing bad output—and you spend hours or days tearing the code apart. You add print statements and breakpoints, you run a sometimes-failing test 100 times in a loop, you blankly stare at the code, you pull out every debugging technique you know trying to isolate the issue.
And finally, after you’ve climbed the mountain and come down again and then gone back up to just check you didn’t forget anything, you see it. And it’s the simplest, dumbest, most obvious mistake. You swapped two arguments to a function. You typed ‘true’ where you obviously meant to type ‘false’. And the longer you spent debugging, the dumber the mistake turns out to be.
What is it about programming that gives rise to this experience? I think there are a couple of necessary conditions:
- indirection: it can be obvious what’s wrong, but non-obvious why, and
- control: it is up to you to get it right.
Are there other fields of construction that share these properties? Do they also exhibit the “I’m so dumb” effect?