3 ms·
Printf Debugging and Srinivasa Ramanujan
- vanusa 5y agoThe most effective debugging tool is still careful thought, coupled with judiciously placed print statements. Brian Kernighan, “Unix for Beginners” Finally someone has the courage to tell the truth. s/debugging/testing/g and watch much of the current hype over TDD/CICD evaporate before your very eyes.
- omegalulw 5y agoI agree and disagree. When you are familiar or at lease somewhat familiar with a code base printf + careful thought is King. It also has the added benefit of forcing your to think through related edge cases you are missing or will miss if you fix the bug in a certain way. But when you are working on a massive codebase with significant state being maintained, a debugger will go a looong way.
- vanusa 5y agoRight - it's am 80/20 thing. Sometimes debuggers are more useful.
- thrower123 5y agoI tend to not use debuggers because I've done so much work on real-time, asynchronous, multi-threaded and multi-process systems. If you stop the world in a debugger to poke at things, that tends to mask problems that do exist and create problems that don't really. Besides, you've got to have decent logs to be able to debug issues that happened in production. Printf, logging, debuggers, repls, they are all tools in the toolbelt that you use when it is appropriate. And don't use when it isn't appropriate.
- rramadass 5y agoHeadline is somewhat click-baity but the author makes the point well. Reading and Thinking through a program (i.e. playing Computer) is a mandatory skill for all Programmers. Yes it is time-consuming, tedious and maybe not always Optimal, but there really is no other way. All Debuggers/IDEs/Analysis tools are an adjunct to actual Thinking through the code since the use of any of the above presupposes some understanding of the code.