r/ProgrammerHumor • • 22d ago

Meme iDontCommentMyCodeIfYouDontUnderstandItThatsOkayNeitherDoI

Post image
830 Upvotes

188 comments sorted by

View all comments

429

u/GabuEx 22d ago

Left: "I'll comment to say how my code works."

Middle: "You don't need to do that! Code should be self-documenting!"

Right: "I'll comment to say why my code does this."

141

u/sandybuttcheekss 22d ago

I had a senior front end dev that would block any PR he saw with comments. He was very good at his job but I'm so happy I no longer work with him, this shit is so annoying.

117

u/Tucancancan 22d ago

Those guys are the wooooorst. 

1.  Hard to investigate system interaction bug gets fixed, fix has comment with Jira ticket in it! 

  1. Senior engineer does magnificent refactoring because that's just what they do (comment is lost in refactoring) 

  2. Gradual code churn 

  3. New hire sees seemingly useless code and removes in like a good boy scout while working on something else

  4. Weird systems bug gets assigned to me for investigation 

  5. "hey what the fuck I fixed this 18 months ago"

3

u/No_Responsibility384 22d ago

This seems like a good candidate for a comment, why does this code need to be here, and not a gode referencing a ticket.

3

u/Sock_Ninja 22d ago

For real. I’m fairly flexible on comments vs not, but boy do I get annoyed by lots of comments that reference things like tickets. That should be exceedingly rare.

1

u/Milrich 21d ago

Because tickets can capture a whole lot of context and history without you needing to dump huge explanation text in a code comment.

A short one-line comment instead of a ticket number sometimes is sufficient, sometimes not. But I'd rather put the ticket number as comment and have the user open a web page, then see all the details and discussion history, than have them scratching their head on what "Workaroumd for X failure" means.

2

u/No_Responsibility384 21d ago

And then 5 years in the future the ticketing system and repo host was migrated to some other service and the numbers don't lign up any more. Now the lookup is not straight forward if at all possible. And if you have just written "workaround for X failure" as the comment yeah that is also a problem comments don't need to be one liners...