Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm suprised "Using debugger for daily coding" is an anti-pattern.

Using the debugger and variable watching much more has been the most productive change i've made in my workflow in the last 5 years.

In fact if you get good with a debugger, you don't need to log anything, as you can just view it's value at any point in the program. And with a good system in place you are seconds away from inspecting any single part of the program state at any moment, even being able to edit it while the program is paused to force the program to be in the state you want to debug.



Debuggers are indeed powerful tools.

The usual argument against using a debugger is that, arguably, you should already have a reasonably accurate mental model of your program. Therefore, you should not need a debugger, just a printf here and there to confirm your mental model is correct.

However, when you don't quite understand how the program works, especially when you think you do but really don't, a debugger is invaluable. It's useful like printfs, only exponentially more so. You can learn so much of your tech stack with a debugger it's not even funny how few people ever bother with them.


But even in your first case, why printf when you can see that variable's value, and scope, and stack, and everything else by using the debugger, all without having to modify the program at all.

I'm in the javascript world for the most part now, so it could be a much bigger pain in other languages/ecosystems, but for me a debugger is always there, and always running, and in my opinion not used nearly enough.

Although I think we are in agreement that trying to assume you know what the code is doing while debugging is going to lead to pain.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: