this post was submitted on 12 Dec 2023
807 points (99.0% liked)

Programmer Humor

19817 readers
89 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 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 10 points 1 year ago (1 children)

Don't just summarize the content though, summarize the rationale or how things connect. I can read your diff myself to see what changed, I want to know the logical connections, the reason you did X and not Y, etc.

Or just say "stuff" and provide that context in the PR description separately, no need to overdo the commit log on a feature branch if you're using squash merges from your PR.

[–] [email protected] 8 points 1 year ago* (last edited 1 year ago) (1 children)

P1000x this.

I can read a diff.

I need to know why.

No, a code comment isn't good enough, it's out of date after the next commit.

[–] [email protected] 1 points 1 year ago (1 children)

Code comments for "why"s that persist. Commits for why's that are temporary.

If you need to run X before Y, add a comment. If you added X before why because it was easier, leave it in a commit

[–] [email protected] 2 points 1 year ago

If you need to run X before Y...

Add a test that asserts that.