3 ms·
Hello, author here! I agree with your sentiment. I was referring more to wonky edge cases in the post such as "if you're rendering a webpage on Windows with a s
by codelikeawolf 5y ago
Hello, author here! I agree with your sentiment. I was referring more to wonky edge cases in the post such as "if you're rendering a webpage on Windows with a scrollable div, add 10px to the right padding because the scrollbar is wider in Windows than macOS", not "if age < 21, user cannot buy alcohol". You should try to avoid stating the obvious in comments (obviously). I was trying to convey that sometimes it's OK to include information in comments that might rot, if it helps you remember why you did it in the first place. I've found that most of these edge cases are "set it and forget it", so it's more likely that your memory would rot before the comment did.
I'm in the same boat when it comes to knowing when to leave a comment. I might suck at it, but I subscribe to the belief that it's better to look like an idiot than an a$$hole. I might look dumb by stating the obvious in a comment, but it beats being someone who didn't bother explaining themselves because "good code is self-documenting" [eye roll].