292
submitted 1 year ago* (last edited 1 year ago) by alphacyberranger@lemmy.world to c/programmer_humor@programming.dev
top 14 comments
sorted by: hot top controversial new old
[-] Haus@kbin.social 28 points 1 year ago* (last edited 1 year ago)

Bad variable names and then awful "temporary" log lines... I feel attacked this morning. ;)

[-] Button777777@lemmy.world 7 points 1 year ago* (last edited 1 year ago)

It blows my mind how often i see people using temp logs for debugging when breakpoints exist

[-] deegeese@sopuli.xyz 14 points 1 year ago

When the issue is only seen after hours of runtime, logging is more practical.

[-] Chreutz@lemmy.world 7 points 1 year ago

I recently had an issue that happens on one out of between ten thousand and a hundred thousand interactions between two embedded processors. Thank god for logging!

[-] o11c@programming.dev 6 points 1 year ago

Even logging can sometimes be enough to hide the heisgenbug.

Logging to a file descriptor can sometimes be avoided by logging to memory (which for crash-safety includes the possibility of an mmap'ed file, since the kernel will just take care of them as long as the whole system doesn't go down). But logging from every thread to a single section of memory can also be problematic (even without mutexes, atomics can be expensive and certainly have side-effects) - sometimes you need a separate per-thread log, and combine in the log-reader tool.

[-] marcos@lemmy.world 3 points 1 year ago

Well, conditional breakpoints exist.

But use whatever is easiest. People trying to micromanage how others use computers are the worst. And on the most popular languages by job count, your debuggers isn't all that more powerful than a well-constructed log anyway. (Hell, the people insisting that others adopt better tools should start with the language.)

[-] Omgpwnies@lemmy.zip 3 points 1 year ago

Or when the overhead of the debugger causes the issue to never happen

[-] XTornado@lemmy.ml 2 points 1 year ago

Idk... I had problems in the past with weird bugs where the breakpoints do not match the right line although using sourcemaps and all that so sometimes you end up doing stuff like this. Or if you want to know how many times something executes without well having to "continue" on each breakpoint or similar.

[-] sebi@lemmy.world 21 points 1 year ago

This is a professional debug techique, what are you talking about? But I rather use 'Hii' with various (but not ascending) amounts of i's.

[-] andrew@lemmy.stuart.fun 6 points 1 year ago* (last edited 1 year ago)

Sometimes I use various swears. Depends on how long I've had to debug. Also depends on whose work I'm debugging and whether they're in earshot. Usually it's just my own sketchy code though.

[-] alphacyberranger@lemmy.world 4 points 1 year ago

Been there, done that

[-] dbilitated@aussie.zone 2 points 1 year ago

I've used a regex to add a console log to the top of every method with the method name before.

the things you do when you're desperate.

[-] elxeno@lemm.ee 4 points 1 year ago
var num =0
...
console.log("Here " + num++)
...
console.log("Here " + num++)
[-] pastelmind@programming.dev 3 points 1 year ago

console.count()

this post was submitted on 10 Sep 2023
292 points (94.2% liked)

Programmer Humor

19488 readers
648 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS