4 ms·
> I do not condone single-stepping through code to find the bug. Hard to take this post seriously because he offers no clue as to how he actually finds the bug
by apo 8y ago
> I do not condone single-stepping through code to find the bug.
Hard to take this post seriously because he offers no clue as to how he actually finds the bug (being "careful" is ludicrously vague). That would be an interesting read.
- de_watcher 8y agoYou look at the code and think really hard. And it's important to believe that bug has really happened. To never even think that the error is impossible. He also hints about guessing the cause through the higher level instead of going from the lower level with the debugger.
- nickjj 8y agoI can't speak for Linus but I haven't used a debugger since VB6 and most of my debugging process nowadays (web development) is done by print statements. If you're getting unexpected output without syntax errors then it's due to something along the way being set to the wrong value. Print statements are very helpful for uncovering that. As soon as you see where things are going wrong, you know exactly what needs to be changed to fix it. With a bunch of print statements you can see the state of the system in multiple spots at once. Plus with print statements you have the option of keeping them around all the time but tucked behind a DEBUG log level. In development, you can often take the guess work out of things if you're always in a position to see the state of your app at various steps. It can speed up development by preventing bugs / unexpected output before it happens.
- Shish2k 8y ago> With a bunch of print statements you can see the state of the system in multiple spots at once. With a debugger you can see the state of the system in multiple the spots at once, except that you don't need to guess in advance which spots you will care about, and you don't need to recompile / re-run every time you guess wrong
- apo 8y ago> Print statements are very helpful for uncovering that. Yes, I used to do that all the time. It was excruciating, only I didn't realize it. Then I started actually learning how to use a debugger. Efficiency in uncovering bugs went through the roof.
- nickjj 8y agoI don't find it bad at all. I see print / debug statements almost like tests. They are always there. Where as debugging with a debugger is more ad-hoc. Plus, debugging is way less useful for web development where you have a bunch of different levels of technology at play. Also, most editors can't even be configured to work nicely with Docker.