Debugging skill level:

🟢 Beginner: print statements
🟔 Intermediate: debugger
šŸ”µ Expert: taking a shower

@fribbledom Absolutely.

Best debugging tips:

* Take a shower
* Go for a walk
* Eat/drink something healthy (no, sugar _won't_ help)
* Chat with a rubber duck about it
* Chat with a friend/coworker about it
* Take a nap

@psa @fribbledom The best one is describing the bug to your coworker in great detail and suddenly realizing the obvious solution before your coworker ever says a word.

@tbh @fribbledom Yes, of course, before describing it to a friend/coworker, describe it to a rubber duck.

Have edited to add.

@psa @fribbledom FWIW these tips also work great for performance regressions, where both print statements and debuggers mess up the timing.
@psa @fribbledom Print statements + shower > debugger

@fribbledom All of the above, plus:

* Take a peace of paper and write down all the details you know
* Ask yourself if the problem might be somewhere else entirely
* Go through the process from start to finish, step by step (don't skip the obvious ones)

@fribbledom Yeah, I got my big programming problem of the day debugged by trying to stay awake through an hourlong 'short agenda' meeting I didn't actually need to take any notes on.

@fribbledom
🟣[unknown] - using print statements to debug a small program because I’m too lazy to bother setting up the debugger.

I’ll still use the debugger for larger projects, although one of my pet peeves is getting the debugger to work for the first time on a project.

(My other pet peeve is getting stuff to compile, especially in C or C++)

@enoch_exe_inc @fribbledom what's worse: getting it to compile in C or C++, or debugging it in a scripting language because the interpreter just runs anything that wouldn't have compiled in another language?
@DerPumu @fribbledom Good question. I’d say C and C++’s horrendously complicated compilation process is more of an actual pain in the ass to get to work properly compared to the mild inconvenience of setting up the debugger, especially since unlike most languages, compilation actually takes a while (and a lot of memory; I have 16 GB and it still regularly eats it all).
@enoch_exe_inc @fribbledom I have a different experience, but then again I'm biased with ~20 years of experience in C++ as my main language. C++ compile errors are rarely a headscratcher, especially when IDE tooling points them out while typing. I realize that may very well be "Stockholm syndrome" and that I probably ignore a huge pain because I'm used to it and my aversion against the debugger is bigger than it should be.
A compiler eating >16GB is something I've rarely seen though, unless I start to compile a huge project, using parallel compilation on all cores at once.

@DerPumu @fribbledom Finally getting round to learning Python hit the unexpected learning curve of it being dynamically-typed…and I’ve only ever used statically-typed languages. I guess VB6 is technically dynamically-typed, but I’ve always just put ā€˜Option Explicit’ at the top of every program and just not thought about it.

Type hints are just that: hints. Turns out they only tell me (and the IDE) what type a variable’s supposed to be and doesn’t affect runtime.

@enoch_exe_inc @fribbledom Python is great - if you use mypy to actually enforce the correctness of those hints and have some discipline in providing the hints so you don't have Any for everything. I enjoy it for smaller things.
@fribbledom ⚪ greybeard: print statements
@fribbledom oh yeah I remember walking to beach during Covid each time I couldn't figure out the issue and I would start writing diagrams and data flow chart on sand.. And invariably it would click why something was failing. Or better code to write!
@fribbledom what level is becoming so obsessed with something that you dream a solution?
@harborsec @fribbledom
I had a cold after finishing a project and all the future issues were laid out before me in a fever dream.
@dontreportme @fribbledom awesome. I just remember waking up at like 5am and running to the computer. My wife looked at me like I was insane.
@harborsec @fribbledom
Lol those two statements happen in my life but they are rarely related to each other

@fribbledom

Beginner: print statements
Intermediate: debugger
Expert: print statements

@megatronicthronbanks
@fribbledom
This.
Though these days you can use dtrace / bpftrace to insert print statements at runtime, which is IMO a much better experience than adding them in the source codex rebuilding, and restarting the program
@fribbledom super expert: print statements again
@fribbledom master: print statements again

@fribbledom

šŸ’”

ah, that's why it's called a shower. because it SHOWs you the truth of the matter?

@fribbledom works only in writing, I'm afraid
@fribbledom and then there is debugging, where when an environment change breaks your code and the ops department makes a request to update libraries and runtimes supported in the code. That’s where the ā€œit works on my computerā€ excuse comes in play . So instead of being a good developer you just invent docker, lift your developer environment and stick it into the container and ship that to the ops people. Like who gives a damn about updated libraries and runtimes when you can be lazy! šŸ˜‰
@jakeobsen @fribbledom The ops department (if it still exists) should dig into container images too.
@fribbledom
All trust lost mode: Throw printf strings as exceptions instead to make sure your code is actually running and to avoid stdout being swallowed by something.

@fribbledom

🟢 Beginner: print statements
🟔 Intermediate: debugger
šŸ”µ Expert: print statements

@phreakmonkey @fribbledom

This is the truth and a hill I will die (or core dump) on; as good as your debugging tools are, there is absolutely no substitute for error level driven debug and trace statements.

@tezoatlipoca @fribbledom For me, it's that I eventually reached a sort of zen realization that adding the complexity / layers of a "debugger" actually increases both the entropy and time needed to find most problems.

In many cases, simple trace / print statements / code instrumentation puts you "closer to the problem".

Debuggers do have their place though.

@fribbledom
How about the stack trace?

I will use all of them, but the stack trace is my first step because it's right there (if there is one, that is).

(Except in C because the stack trace will contain several lines of ????? which I can only use to conclude that I may have a bad pointer, but I'm not even sure that's the only source of question marks in the stack trace).

@fribbledom
debugger is beginner level.

Expert is: taking a shower while your print logging runs until it reproduces.

@fribbledom I found it really interesting that in The Practice of Programming (1999) the grandmaster-level programmers Brian Kernighan and @robpike wrote that they mostly debug by intserting print statements.
@fribbledom FPGA Dev: "Ich habe noch Pins für zwei LED frei gehabt. Muss reichen"

@fribbledom A bike ride can also help!

Disclaimer: As a german fediverse member, I am obliged to turn every topic into a discussion about bikes and hating cars :-P

@words_number @fribbledom I came here to say bike ride!

@WildEyedBoyFromFreecloud @words_number @fribbledom ugh.. _Europeans_. Take your functional public transit and cyclling/pedestrian friendly cities and go #flarhgunnstow out of here.

-jealous Canadian who doesn't live in one of the few cities with passable transit and cycling infrastructure

@fribbledom Adjusting my self-development plan for 2026: Start taking showers to become an expert.
@fribbledom So this effectively means taking a shower are billable hours.

@fribbledom

Expert: taking a shower

Adept: walking the dog in park land