I'd ask the reverse of you. Why do you spend time in a debugger at all? For 99% of the bugs logical thinking and a few printfs work faster and better ran blindly running around setting breakpoints and examining values.
I'd ask the reverse of you. Why do you spend time in a debugger at all? For 99% of the bugs logical thinking and a few printfs work faster and better ran blindly running around setting breakpoints and examining values.
I agree that printf works better than "blindly running around setting breakpoints", but so does pounding a 12-pack of beer and then hitting yourself in the face with a mallet until the solution comes to you.
On the other hand, learning to use a modern, advanced debugger and then applying that skill along with some of that logical thinking can be extremely effective in finding the cause of bugs as quickly as possible.
For languages like Objective-C or Java, I think the 'real men don't need a debugger bro' attitude is nuts. It is different for a lot of newer and/or more dynamic programming languages, which simply don't have debuggers anywhere close to as powerful as those of IntelliJ or Xcode/lldb.
Though learning how to use the debugger is a good skill to learn, these days I don't know anyone around me who has ever used a debugger, or even finds a use for it. I think the best tools of our age are really REPL's, which allows you to test out your guesses/hypothesis in the form of snippets.
Personally I have probably used a debugger 5-6 times in my whole programming career, these days I hardly find a use for it.
On the other hand, I find tools like these very useful: https://metacpan.org/module/Devel::NYTProf
Once you learn how to use a debugger properly it is infinitely better than printfs.
I've been programming professionally for nearly 20 years, in languages ranging from Perl to C/C++ to Javascript, and the only times I've used GDB in the last 15 years have been when C/C++ code is segfaulting and I want a stack trace. The rest of the time I use print/printf statements. I've built some pretty successful software this way, some of which you've probably heard of or used.
On the other hand if I were coding exclusively in C/C++, or Java, or using an IDE for my work, I might use a debugger more.
I'm getting up there too. And I know lots of older programmers with very bad habits. Many who have also working on household names. Age+popularity != skill/quality.
Doing that in anything but interpreted and micro applications seems like a massive waste of time and effort(both placing the printfs, recompiling, removing them recompiling.
We've all done it. It doesn't mean its a good way to do it.
And like I said above it can introduce bugs into your code doing so. I remember one case where a printf for debugging changed the memory in such a way as to make an uninitialized variable work. After testing when the printfs were removed the application would stop working.
Introducing code into your code base with the intention of removing it later when there is an easy way to not do so is asking for trouble.
Memory stomp bugs. Race conditions.
And some Entrprise OO problems - inspecting 260 layer stacktrace and exploring very complicated structures.
Also I hate writing prints over and over. Sometimes it is imply faster to put a breakpoint, look at the value and then pop it away. As opposed to manually writing the print, then check, and then removing it.
Thats just my opinion though.