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

Programmer Humor

21016 readers
1975 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 2 years ago
MODERATORS
 
top 11 comments
sorted by: hot top controversial new old
[–] [email protected] 28 points 2 years ago* (last edited 2 years ago) (1 children)

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

[–] [email protected] 7 points 2 years ago* (last edited 2 years ago) (2 children)

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

[–] [email protected] 15 points 2 years ago (1 children)

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

[–] [email protected] 3 points 2 years ago

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

[–] [email protected] 2 points 2 years 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.

[–] [email protected] 21 points 2 years ago (2 children)

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.

[–] [email protected] 6 points 2 years ago* (last edited 2 years ago) (1 children)

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.

[–] [email protected] 4 points 2 years ago

Been there, done that

[–] [email protected] 2 points 2 years 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.

[–] [email protected] 4 points 2 years ago
var num =0
...
console.log("Here " + num++)
...
console.log("Here " + num++)
[–] [email protected] 3 points 2 years ago

console.count()