this post was submitted on 06 Jan 2024
88 points (98.9% liked)

Programmer Humor

19512 readers
314 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
 
top 9 comments
sorted by: hot top controversial new old
[–] [email protected] 7 points 10 months ago

Whos the fucking idiot that wro.. oh it was me.

[–] [email protected] 5 points 10 months ago (2 children)

Writing really good comments is an under-appreciated skill.

[–] [email protected] 3 points 10 months ago (2 children)

Even though comments are very helpful, often it's even enough to name variables and methods/functions really good. At least do that. You don't want i, j and value. Believe me. You want rowCount, colCount and deliveryOption instead. You just may not know it now, but you will, when it has to be changed in a few months.

[–] [email protected] 2 points 10 months ago

Comments are good when you're doing something weird to handle an edge case or something. But yeah most of the time clear variable names, and extracting complicated code to a dedicated and clearly named function, are enough.

There are only two hard things in Computer Science: cache invalidation and naming things.

Phil Karlton

[–] [email protected] 1 points 10 months ago

Where comments are useful most is in explaining why the implementation is as it is. Otherwise smart ass (your future self) will come along, rewrite it just to realize there was indeed a reason for the former implementation.

[–] [email protected] 1 points 10 months ago* (last edited 10 months ago)

// don't know anymore, just leave this block alone

[–] [email protected] 1 points 10 months ago* (last edited 10 months ago) (1 children)

I was once like "🤨... what drugs was I on when I wrote this 🤨". Comments didn't help, I must've been under the influence of something, it didn't make any sense.

The weird thing is, it works 😂.

[–] [email protected] 2 points 9 months ago (1 children)

You gotta comment what drugs you were on when you wrote the code

[–] [email protected] 1 points 9 months ago

Darn, forgot to do that.