←back to thread

214 points Brajeshwar | 2 comments | | HN request time: 0.419s | source
Show context
lpapez ◴[] No.45087294[source]
This article goes completely against my experience so far.

I teach at an internship program and the main problem with interns since 2023 has been their over reliance on AI tools. I feel like I have to teach them to stop using AI for everything and think through the problem so that they don't get stuck.

Meanwhile many of the seniors around me are stuck in their ways, refusing to adopt interactive debuggers to replace their printf() debug habits, let alone AI tooling...

replies(8): >>45087363 #>>45087929 #>>45088042 #>>45088074 #>>45088303 #>>45088412 #>>45088809 #>>45090665 #
lordnacho ◴[] No.45087363[source]
> Meanwhile many of the seniors around me are stuck in their ways, refusing to adopt interactive debuggers to replace their printf() debug habits, let alone AI tooling...

When I was new to the business, I used interactive debugging a lot. The more experienced I got, the less I used it. printf() is surprisingly useful, especially if you upgrade it a little bit to a log-level aware framework. Then you can leave your debugging lines in the code and switch it on or off with loglevel = TRACE or INFO, something like that.

replies(4): >>45087621 #>>45089223 #>>45089326 #>>45089878 #
cbanek ◴[] No.45087621[source]
This is absolutely true. If anything, interactive debuggers are a crutch and actual logging is the real way of debugging. You really can't debug all sorts of things in an interactive debugger, things like timing issues, thread problems, and you certainly can't find the actual hard bugs that are in running services in production, you know, where the bugs actually happen and are found. Or on other people's machines that you can't just attach a debugger. You need good logging with a good logging library that doesn't affect performance too much when it's turned off, and those messages can also provide very useful context to what things are going on, many times as good if not better than a comment, because at least the log messages are compiled in and type checked, as opposed to comments, which can easily go stale.
replies(4): >>45088133 #>>45089694 #>>45090079 #>>45091555 #
TheRoque ◴[] No.45088133[source]
Both are valid, if your code is slightly complex it's invaluable to run it at least once with a debugger to verify that your logic is all good. And using logs for this is highly inefficient. E.g. if you have huge data structures that are a pain to print, or if after starting the program you notice that you forgot to add some print somewhere needed.

And obviously when you can't hook the debugger, logs are mandatory. Doesn't have to be one or the other.

replies(1): >>45088620 #
twodave ◴[] No.45088620[source]
> verify your logic

This is what unit tests are for.

replies(1): >>45088774 #
1. compiler-guy ◴[] No.45088774[source]
And no one has ever written a buggy unit test.
replies(1): >>45089645 #
2. ch4s3 ◴[] No.45089645[source]
That’s what the code is for.