this post was submitted on 10 Jun 2024
282 points (94.9% liked)

Programmer Humor

19166 readers
1016 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
282
submitted 3 months ago* (last edited 3 months ago) by [email protected] to c/programmer_humor
 

Comment from my group project teammate. You don't need to comment every line lol

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] -4 points 3 months ago (1 children)

Do comment the why

In this day and age of source control I don’t think this is fully necessary. If you want to know the why, you can look into the commit history and see which ticket is connected to it. There you might even see the discussions around the ticket as well. But this requires good source control discipline.

It has helped me many times.

[–] [email protected] 11 points 3 months ago* (last edited 3 months ago) (2 children)

Why not put the "why" in a comment and save people the job of dredging through old commits and tickets to figure out what the code is for? I'd thank someone for saving me the hassle.

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

In any modern IDE "dredging through old commits" means clicking a single button to see who last changed the line. From there it often makes sense to go look at the PR to see a higher level of what was changed. You cannot include all of that context in a single comment.

[–] [email protected] -1 points 3 months ago

You can also do that if you think it’s useful.

Going back to the original ticket can offer far more info than what any “why” comment can give. You can see how old it is, if there are any connected tickets, who were involved with it, step by step instructions how to reproduce the bug, etc.