4 ms·
Do not agree. Commit messages can be more expansive than comments, because comments bitrot more readily: they are not rooted in a time and change to the code.
by fdr 7y ago
Do not agree. Commit messages can be more expansive than comments, because comments bitrot more readily: they are not rooted in a time and change to the code.
I use commits for the largest bulk of explanation, particularly "why," which can be rather detailed and not of much interest to someone skimming the code rapidly.
Comments I use for pointers that are unlikely to bitrot and/or important to prevent error. Except for the most timeless design elements in a project, I do not commit long documentation.
- stinos 7y agoI do follow your reasoning, bad comments are worse then no comments, but in this particular case it really feels to me like the meat of the commit body should also be a comment. Just so that when someone looks at the code and wonders, hmm, why is this flag here, he/she can figure it out without having to do a blame/log on the file. (Don't get me wrong, great tool, but has it's own problems). Judging whether or not comments are permitted on the bitrot-ability of a piece of code seems hard to begin with, and even then a bit arbitrary. In this case, the whole comment would be just for that flag. So if someone really just gets rid of the flag but not the comment, especially on code like this, and that also passes code review then I think there are more pressing problems then bitrot.