3 ms·
"Print statements are a valid way to debug code." In 30+ years of programming, vast majority of bugs I've fixed were diagnosed with a few strategically placed
by f2000 6y ago
"Print statements are a valid way to debug code."
In 30+ years of programming, vast majority of bugs I've fixed were diagnosed with a few strategically placed print statements.
"I just print values. When I’m developing a program I do tremendous amount of printing. And by the time I take out, or comment out the prints it really is pretty solid. I rarely have to go back." — Ken Thompson in the book Coders at Work by Peter Seibel
- toast0 6y agoI call this the 'printf' school of debugging. It works a lot of the time (but not always, not great for debugging locks on stdout, for example). If you only have time to learn one debugging technique, this is the one to learn.
- Supermancho 6y agoPrint statements can generally be thought of as unit tests that require 1 line of boostrapping code.