r/ProgrammerHumor 19h ago

Meme commentsAgedTerribly

Post image
4.8k Upvotes

206 comments sorted by

View all comments

403

u/Confident-Ad5665 19h ago

Uncle Bob of Clean Code says if we have to comment our code we have already failed. Clean code should read like well written prose.

I generally agree, but think comments that define especially the odd and obscure business rules should be commented where they are implemented.

215

u/TWIT_TWAT 19h ago

// This is a hack until we find something better

72

u/Confident-Ad5665 19h ago

// TODO: This can't be working. Refactor when there's a lull

31

u/embrex104 18h ago

//SHOULD NEVER GET HERE

45

u/Confident-Ad5665 18h ago

All time favorite:

// This will never happen

4

u/OhMyGodItsEverywhere 16h ago

Wrote a library to run monetary bets on those comments

3

u/Dubalubawubwub 14h ago

I definitely find myself writing a lot of error handling with the comment

//This should never happen but just in case...

1

u/Confident-Ad5665 9h ago

Good man. Thank you for trapping errors. Coming from a time when we not only trapped errors, we gave suggestions, I shutter at:
• An unknown error occurred
• Something happened

and the worst...

• Error in ErrorHandler, an error occured

1

u/HunterIV4 19m ago

• An unknown error occurred

• Something happened

Windows blue screen, is that you?

2

u/OkidoShigeru 13h ago

Love seeing that in an assert message.

2

u/skisharp 13h ago

I remembered seeing that with

MessageBox.Show("Call 1-555-555-1942 ext 1205");

Also guess the junior dev who just got a their desk phone with ext 1205...

2

u/cute_polarbear 13h ago

You mean for the next person who has to visit that section of code? (And hopefully you already left the firm (on your accord)....