The Parable of the Undefined Variable
A certain developer had a function, and the function had a variable, and the variable was
undefined. And she looked upon the variable and said, this cannot be, for I declared
it. And she declared it again, more firmly, and it was still undefined.
So she added a log. And the log printed nothing, for the code did not reach it. And she added a second log, above the first, and it printed. And she moved the second log down one line, and it printed. And she moved it down one more line, and there was silence.
And in that silence she saw it: the early return, seven lines above, added by herself, on a Tuesday, for a reason that had been urgent and was now forgotten.
And she did not curse the code. She deleted the early return, and she wrote one sentence above the guard that remained, saying why it was there. And her colleague read that sentence eleven months later, at 2am, and was spared.
The teaching The bug was never in the line you were staring at. It was in the assumption that got you to that line. Move the log, not the logic.