News for hackers. Stuff that matters.
Re:Don't Look Down on Print Debugging by bloomingkales on Saturday November 23, 2024 @09:01AM (#42220904)
I kinda want to push back against the blanket statement that there are articles pushing back on print debugging. That implies there’s well known mind share thinking about it?

Is it real mind share? Is it bullshit?

Print debugging is the literal pocket knife of debugging.

Re:Don't Look Down on Print Debugging by llm_nerd on Saturday November 23, 2024 @09:09AM (#42220944)
There are loads of articles discouraging print debugging, and it's a very real thing that people fight against (and for). Print style debugging is the first thing most programmers learn, and for some it absolutely becomes a bad habit.

And to be clear, print debugging and pervasive, configurable logging are very different things and the latter is hugely encouraged (even with logging levels), while the former is almost always suboptimal. Being able to have your client turn on "DEBUG" logging and send you the logs after some abnormal behaviour is supremely useful. Doing "prinftf("Here!")" in one's project is not, or at least not remotely as useful as better approaches.

Re:Don't Look Down on Print Debugging by bluGill on Saturday November 23, 2024 @09:57AM (#42221232)
Print'here' is very useful. I get a log of how many times that funcion is called. If I log some data I log how that data changes over time. Those are powerful tools.
Re:Don't Look Down on Print Debugging by llm_nerd on Saturday November 23, 2024 @01:44PM (#42222802)
FWIW, many debuggers have facilities to do precisely this. The JetBrains debuggers allow you to set a breakpoint that -- in a non-stopping way -- simply logs every time it was passed, or logs whatever values you want it to log as an expression. So in one potentially non-stopping run you get an output of all of it.