4 ms·
That's quite a judgement when you have no idea what kinds of tools the language the person you're responding to is using has. Frankly, even when I'm using a la
by danaris 6y ago
That's quite a judgement when you have no idea what kinds of tools the language the person you're responding to is using has.
Frankly, even when I'm using a language that has a stellar GUI debugger, there are times when print debugging is vastly more effective. Why? Because I have a loop that iterates thousands of times, and crashes on some indeterminate but high iteration. A simple line-based breakpoint requires me to manually continue the code thousands of times, then take note of what state the variables were in the time just before it crashes. Even the ability to set a more complex variable-value-based breakpoint doesn't help that much when I don't know what the values are where it breaks.
Printing out the loop variables every time lets me just check the last printout, and say, "Ah, it's when it hits i=37129", then follow that to the array value it corresponds to, with a substring in it that just happens to trip an edge case of one of the calculations. Or whatever.
- scoutt 6y agoI totally agree. I also use print message sometimes for the case you mention. Or for example when doing audio applications, to monitor the rate of buffers being filled under different loads. Generally high rate stuff, happening later in time. The difference I believe is that in both cases the problems are circumscript. It's not random "hello1", "hello2" messages to understand the program flow, guessing where the problem could be. That's what I called desperate. But it's true I don't know which language we are talking about.
- db48x 6y agoYou should give RR or Pernosco a try. They both make it easy to record the program, stop execution at the crash, and then step backwards to see what went wrong. But honestly, even an ordinary debugger would let you print the value of the iteration variable at the point of the crash, along with all the other variables. I think your example was much too simplified.
- danaris 6y agoThose tools sound cool, but they appear to be specific to a few languages on Linux, none of which has ever significantly applied to me (I've been a Mac user my whole life). As for the other, that's sometimes true, and sometimes not; depends on what GUI debugger you're using. To be honest, it's been long enough since I was regularly working on languages with a non-terrible GUI debugger that I don't recall off the top of my head whether theirs did allowed that or not. These days, I'm mostly working in PHP, and unless something's changed quite recently, the only GUI debugging tools available for it require using Eclipse or similar godawful monstrosities. I will gladly eschew the benefits of such tools, and suffer the slings and arrows of snooty and judgmental developers like yourself (which I already get in plenty just for staining my hands with PHP), if it means that I don't have to use those lumbering behemoths every time I go to write or debug some code.
- db48x 6y ago> Those tools sound cool, but they appear to be specific to a few languages on Linux, none of which has ever significantly applied to me (I've been a Mac user my whole life). Correct. The author’s premise is that if we didn’t neglect our tools so much, all debuggers for all languages on all platforms could be that cool.