3 ms·
It's nice to see that yet one more person has come to their senses. Not much new in that post, but sometimes that's ok. The code itself is always the first, be
by dwc 16y ago
It's nice to see that yet one more person has come to their senses. Not much new in that post, but sometimes that's ok.
The code itself is always the first, best, and final authority on how it works. Comments should add something beyond that, or they should not be there at all. The Thou Shalt Comment mindset is responsible for most bad comments. Ignore it and only comment when it will do the reader a service.
- knieveltech 16y agoIn theory everything you've said is accurate. In practice it's usually really hard (if not impossible) to know exactly who "the reader" will be in six months. Nothing says "prima dona" to me quite like encountering a few thousand lines of someone else's code that they couldn't even be bothered to document the major functions.
- dwc 16y agoI comment for "me in six months" and that works ok. Not perfect, but ok. Nothing says "unthinking clod" to me like a few thousand lines of code with comments where I'm told that i is a loop index.
- knieveltech 16y agoI don't think anyone is advocating for comments explaining that $i is a loop index.
- dwc 16y agoI don't think so either. But that's what comes out of Thou Shalt Comment. And yes, I have seen loop index comments. Haven't you? I think we'd both agree if we saw a good comment. I just want to focus on the 'good' part rather than the 'comment' part.
- knieveltech 16y agoOf course I've seen loop index comments, and redundant variable declaration comments, and all manner of bad commenting. Thing is, I'll take a bad comment over blank code any day. Crap comments warn me ahead of time that I'm dealing with a developer who's either too inexperienced to know how to comment well or too sloppy to do a good job at it and in either case I need to be paying closer attention to their code than I might otherwise.