News for hackers. Stuff that matters.
Re:Best practices for writing code comments by masklinn on Friday December 24, 2021 @05:50AM (#29672511)
I think "why not" is one of those things which definitely does not belong in comments, if you regularly write up such justification, your code becomes mostly comments. Even more so than "positive" comments, "negative" comments belong in the commit message.

Possibly unless your entire codebase is literate, and code is secondary to comments.

Re:Best practices for writing code comments by unionpivo on Friday December 24, 2021 @11:45AM (#29675064)
honestly it needs both, but if you only put it in 1 place put it in code.

During the development you are mostly likely looking at commits, or PRs, so that makes sense.

But if its long living piece of code, people will get you your code via following function/method chains or just browsing the source not commits. While you can use git blame, and then figure out the commit, and then read last few commit messages, putting comment on code is easier on everybody.