http://qs1969.pair.com?node_id=460566


in reply to Re^2: Interactive scripting with DB
in thread Interactive scripting with debugger

You can count me in the "rarely use the debugger" school. I've always found using the Perl debugger is a process of frustration, I use win32 so it tends not to play nicely, but even when it isn't playing silly-buggers I still find it annoying. Its like inspecting a house through a keyhole, you never quite know how what you are looking at fits into the big picture. Ive also had far to much experience with code that has been "patched" from the debugger, and not well.

I think the issue is that the debugger tells us "what" and usually the real problem involves a lot of "why". Debugging with print statements IMO tends to promote a holistic view of the program. Its necessary to have a good understanding of the program flow and processes to debug this way, and I think overall this promotes a better quality of programming. If you need to step through your code in a debugger to understand why it isnt doing the right thing then I think its not unreasonable to argue that your code is too complex and needs to be rethought. And such rethinking wont happen while you are in the debugger.

I leave you with a quote by a famous programmer about why he doest much like debuggers. Admittedly the debugger/debugging he is talking about is kernal debugging, which is a somewhat specialized area but i think the points are valid nonetheless.

I happen to believe that not having a kernel debugger forces people to think about their problem on a different level than with a debugger. I think that without a debugger, you don't get into that mindset where you know how it behaves, and then you fix it from there. Without a debugger, you tend to think about problems another way. You want to understand things on a different _level_.

It's partly "source vs binary", but it's more than that. It's not that you have to look at the sources (of course you have to - and any good debugger will make that _easy_). It's that you have to look at the level _above_ sources. At the meaning of things. Without a debugger, you basically have to go the next step: understand what the program does. Not just that particular line.

which is an excerpt from this posting by Linus Torvalds.

---
$world=~s/war/peace/g

Replies are listed 'Best First'.
Re^4: Interactive scripting with DB
by data64 (Chaplain) on May 26, 2005 at 21:23 UTC

    You can count me in the "rarely use the debugger" school.

    Me too, but for entirely different reaons. I work with a number of different languages and environments. Not all of them will have debuggers (eg: javascript on AvantGo browser). Even if a debugger is available, each language will have its own debugger model with its own quirks and idiosynchrancies. I found that using print statements and conditional statements (eg: print $foo if $DEBUG>3 ) to be good enough in most cases, and more importantly cross platform and cross language (ie. the technique is, the syntax will not be).