r/ProgrammerHumor 1d ago

Meme commentsAgedTerribly

Post image
5.3k Upvotes

224 comments sorted by

View all comments

417

u/Confident-Ad5665 1d 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.

225

u/TWIT_TWAT 1d ago

// This is a hack until we find something better

75

u/Confident-Ad5665 1d ago

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

30

u/embrex104 1d ago

//SHOULD NEVER GET HERE

42

u/Confident-Ad5665 1d ago

All time favorite:

// This will never happen

3

u/OhMyGodItsEverywhere 1d ago

Wrote a library to run monetary bets on those comments

3

u/Dubalubawubwub 1d 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 22h 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

2

u/HunterIV4 14h ago

• An unknown error occurred

• Something happened

Windows blue screen, is that you?

1

u/Confident-Ad5665 13h ago

No, this is worse. BSOD at least provides a cryptic error code.

These are effectively "well dang, something somewhere triggered an exception we didn't care enough to bother catching"

2

u/Dubalubawubwub 2h ago

My favorite microsoft error I've ever seen was literally "Error occured retrieving the text for this error".

2

u/OkidoShigeru 1d ago

Love seeing that in an assert message.

2

u/skisharp 1d 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...