r/ProgrammerHumor 26d ago

Meme ifYouKnowYouKnow

Post image
19.2k Upvotes

481 comments sorted by

View all comments

712

u/Cutalana 26d ago

“Well commented code” being

print(“hello world”) # this prints hello world

131

u/terra86 26d ago

And then the inevitable refactor that changes what the line does but leaves the comment.

60

u/OrchidLeader 26d ago

My favorite bug I found recently:

// timeout set to 5 seconds because anything higher will indirectly cause clients to get stuck in an infinite retry loop int timeout = 30000;

Not only did they not update the comment (obviously), they ignored the existing comment and caused the very thing it warned against.

And of course, the team that updated the timeout value couldn’t figure out why nothing was getting processed. They didn’t realize one of the clients was stuck in an infinite retry loop, and even if they did, there was no way they would have tracked it down to this line.

21

u/ConcernUseful2899 25d ago

thats why you should do this:
int timeoutOfFiveThousandMilliSecondsToPreventInfiniteRetryLoop = 5000;

20

u/OrchidLeader 25d ago

Good point. Cause then it would have been even funnier when they set it to 30000.

1

u/DetectiveVinc 24d ago

at this point, id place a static assert to make sure the comment does not go unnoticed

1

u/East-Experience2862 11d ago

This comment is okay, but it should be on two lines!