5 ms·
And how should someone write a comment about that they intentionally forgot about some corner-cases? Or if they did add a similar comment and in the meantime s
by eXpl0it3r 6y ago
And how should someone write a comment about that they intentionally forgot about some corner-cases?
Or if they did add a similar comment and in the meantime someone implemented it, but didn't remove the comments, how many people will only read the comment and not look at the code?
- KMag 6y agoIf the explanation of intended behavior left out the corner case, then it would be much more likely that the author hadn't considered the corner case. More insight into the author's thought process gives you more confidence in your assessment.
- em-bee 6y agocorner-cases should either be mentioned in the comments or be handled in the code. if they are neither, then the author missed them. a future developer potentially forgetting to update a comment is not an excuse to avoid commenting.
- slowmovintarget 6y agoIn a perfect world... You'd find that in the commit log for the code. Comments aren't the right place for things you forgot to do, or things that occur to you after the code sort of works. The commit message, and unit tests, are where those ideas can be best captured. I tend to point my team at this as a practice: https://chris.beams.io/posts/git-commit/ https://chris.beams.io/posts/git-commit/