5 ms·
A little off topic but I'm curios if most devs use debugging tools? My main debugging tool has been printf and it's stdlib equivalents on other languages for 20
by eknkc 10y ago
A little off topic but I'm curios if most devs use debugging tools? My main debugging tool has been printf and it's stdlib equivalents on other languages for 20 years of coding. I used to do some C# dev and used VS debugger, I feel like it is less efficient than print statements / assertions.
Am I missing out a lot?
- rahkiin 10y agoIn node and browser I mainly use 'console' debugging because of the async mess. Same when I need to know what branches are called etc. On native software I sometimes use breakpoints when stuff crashes. I don't think you miss a lot
- noir_lord 10y agoI wonder if that's an age thing, I'm 36, I've been programming since I was 7 and seriously since I was 14 (I say seriously since that's when I started doing stuff people would pay for) and I rarely use a debugger. These days I mostly program in PHP (it's where the money is locally and I actually don't mind the language, it's come along well) and use the excellent FirePHP (it allows you to put fp_log($foo) (fp_log is a wrapper around it I wrote for terseness - it also checks local context so that I don't leak debug stuff out into the wild accidentally) and $foo is then passed to the browser via headers (you need a browser extension to make it work but it integrates into the console) that does for 99% of the debugging I need to do, the 1% is when I fire up XDebug, I like XDebug but I've found over the years that printf debugging solves the vast amount of problems since they nearly always trace back to a faulty assuming about what $foo contains at a given point and it's (at least in interpreted languages) way quicker to just whap a print(foo) etc in there and see.
- nullxone 10y agoIn some respects yes. In my mind the debugger is a last resort tool, when other feedback loops don't provide enough information. Where it really shines though, is when debugging rather terrible spaghetti like code, where a debugger really helps by allowing you to step through code, and see the whole state change. I guess most cases are in between the ideal and that. Another nice thing is to be able to set a breakpoint and then actually mess with the variables at that point. That actually tightens the feedback loop because you can test out different states without having to go back, edit, and run the code path again.
- barrystaes 10y agoDebugging can save you time, depending on what you want to do. When using scripting (js/php) i tend to type a print() with what i want to know and hit F5. But thats not always an option, or practical. When things get more complex (which to me typically happens in compiled software, say a Windows or Android app or embedded) triggering a breakpoint and stepping through the code works faster than refreshing a page. I would not have to sit though recompiling the program and reproducing the exact same situation before seeing a print() show me something "thats also not it".
- wingerlang 10y agoFor me they can serve different purposes. Printing is effective, but I use it mostly when doing pre-emptive things like logging while coding. Or when I need more data in the log, since printing is persisted in the console. That way you can go back and inspect it. Debugging is when you really want to take your time on each step of the execution and double check each value. It is also great if you quickly need to stop the code at a specific step without having to recompile. And while in the debugger you can also change values, execute code to some degree and so on. So it just depends on what I want to do.