3 ms·
I'm not sure I agree with all of that, especially the second paragraph. In my experience, if your comments are English translations of code, you could probably
by icodestuff 16y ago
I'm not sure I agree with all of that, especially the second paragraph. In my experience, if your comments are English translations of code, you could probably be writing the code more clearly. Exceptions are when you're using a particularly hairy API, writing in Perl, building complex regular expressions, or need to document side effects that are not otherwise clear.
Additionally, commenting every bit of the code, especially as you go along, leaves one prone to forgetting the most important reason to comment: explaining the rationale for what you're doing. Explaining the design decisions in comments (and especially why you didn't do the alternative) is invaluable, and much more accessible to a maintainer (such as oneself a few months later) than an external design document.