4 ms·
I feel like this doesn’t really make a case for why (or how) print debugging should go away. I absolutely buy the argument that debugging tools can do the same
by dahart 6y ago
I feel like this doesn’t really make a case for why (or how) print debugging should go away. I absolutely buy the argument that debugging tools can do the same job, and that they can improve, but that’s not a reason to avoid prints at all costs.
For me, the biggest hurdle to using a debugger is having to stop and re-learn how to use it. I reach for print sometimes only because I can’t remember the command line for the python debugger off the top of my head, or I can’t remember how to inspect a hex value in gdb. Yes it’s only a quick Google search away, but I can try the print without searching Google. Perhaps irrationally, having a long list of good debuggers I’ve never used like rr and Pernosco and others actually semi-consciously causes me to want to use them less because of the time investment required to figure them out (and repeatedly, like it has in the past with other debuggers.) There are hundreds of tools that I’m not using to their full potential for my job.
Anyway, it’s silly to pretend we can’t have both. I land heavily on the side of using a good debugger whenever I can, and yet I still use prints all the time for quick & easy debugging. It’s silly to suggest that print debugging could ever go away; it can’t unless you want to remove print statements.
One thing both this article and the one on print debugging the other day completely fail to address is debugging embedded systems and GPUs, where both types of debugging are much harder. Try debugging your shader on ShaderToy.com - neither method is available.
- throwaway894345 6y agoWith some discipline, you can also make those debug statements bonafide log statements, which you will likely need for production anyway. You can't do this with a debugger (although you can attach a debugger in certain circumstances, it is rare in production, it's not a complete solution, and it may violate compliance).
- dahart 6y agoAbsolutely, once a project hits a certain size, I can attest to the value of taking some time to establish a logger with a verbosity knob and command line control. Making it as easy to use as a print statement, but with a default quiet setting, means I can more easily plan and multiply the value of my efforts printing things. Plus, a good logging system works in release builds where a debugger might not.