Rob Pike on debugging
Rob Pike needs no introduction. He gave an interview in 2012 where he shared a story about debugging and what he learned from Ken Thompson:
If you dive into the bug, you tend to fix the local issue in the code, but if you think about the bug first, how the bug came to be, you often find and correct a higher-level problem in the code that will improve the design and prevent further bugs.
I agree with this, with some comments. It’s tempting to dive right in. There are also times when you don’t know enough yet so have to gather more information about the bug and system first.
What do you think?