News for hackers. Stuff that matters.
Re:The unreasonable effectiveness of print debugging by xyzzy123 on Saturday April 24, 2021 @07:23PM (#26929064)
Linus used to be against kernel debugging for the longest time.

The core of his position (as I understand it) was that regularly needing a debugger is a sign that your software has "gotten away from you". You've let the software get to a state where it cannot easily be understood from the architecture and program text alone.

I do think debuggers can be useful when building up comprehension - particularly of other people's software.

It's very time consuming though, and at each "trace" you're only seeing one path through the program. Good architecture and documentation lets you understand all the possible paths at once.

Re:The unreasonable effectiveness of print debugging by aszen on Saturday April 24, 2021 @08:16PM (#26929308)
I hold the very same opinion, interactive debugging in general should be a rare need.

If it's being used too often then it points to the fact that the software has to be run in order to understand it. It's representation is not sufficient to convey it's run time behaviour.

Also would like to point that dynamic languages in general require more debugging than statically typed one's since one can't be certain of the data flow within functions.

Re:The unreasonable effectiveness of print debugging by lumost on Sunday April 25, 2021 @12:36AM (#26930374)
I usually find that debuggers are more useful in dynamic languages. As an example in python many bugs are due to an incorrect structure being passed into a method due to the method or input being underspecified/abused.

In such a case it's difficult to decide what to print or more particularly how to print it if it's type/shape is unknown.

Re:The unreasonable effectiveness of print debugging by mumblemumble on Sunday April 25, 2021 @12:16PM (#26933857)
I find that it's not specifically the kind of programming language, so much as the way the data is structured. Passing around big generic heterogeneous data structures makes it harder to just reason about state. That's a lot more common in dynamic languages, but I also see it happen plenty in, e.g., enterprise Java code.

In those situations, it's often just so much easier to set a breakpoint and take a peek than it is to waste brain cycles on thinking about what exactly you should even be printing in the first place.

Re:The unreasonable effectiveness of print debugging by zamfi on Saturday April 24, 2021 @08:29PM (#26929362)
I’ve felt the same way about IDEs in general.

We need more tooling to help people understand and mitigate necessary complexity, not tools that help one muddle through or — I shudder to think — extend complexity.

I’ve changed my mind on this recently only because some IDEs have indeed become good at the latter.

Re:The unreasonable effectiveness of print debugging by dnautics on Saturday April 24, 2021 @09:15PM (#26929546)
Once you traipse into concurrency land, too, debuggers get much more tricky. You now have to consider the state of the thread you are in, plus all the others.
Re:The unreasonable effectiveness of print debugging by mason55 on Saturday April 24, 2021 @09:19PM (#26929563)
And whether the act of debugging has changed how everything works
Re:The unreasonable effectiveness of print debugging by wrycoder on Saturday April 24, 2021 @08:44PM (#26929430)
Agreed. The only time I've found a debugger useful is when the print statements aren't immediately giving clarity, and cognitive dissonance is settling in.
Re:The unreasonable effectiveness of print debugging by porknubbins on Sunday April 25, 2021 @12:55AM (#26930423)
I think its the same as cognitive dissonance but I always find debuggers help when my code appears to be doing something impossible- like I’ll be thinking how could if(true) ever fail then remember oh this whole function isn’t even getting called and I had fixated on the wrong place. Debuggers will sort it out faster than a bunch of print statements.