I think everybody hates comments like "getFoo: Get the value of Foo", and huge blocks of commented-out code. However, I _love_ seeing the following types of comments: 1. The high-level overview of how things fit together: This class represents a compiled method at the VM level. It does not contain the actual native code. If native code exists, it is handled using class Blah instead. 2. What should work, but doesn't:…
Exactly. Code is for expressing how things are done.* Comments are for expressing why. * Or if you're not into the whole imperative languages bit, what things are done.
My Case Against Code Comments
11–20 of 23 posts
Re: My Case Against Code Comments
#12Earlier quoted context omitted.
In 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.
I 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.
Re: My Case Against Code Comments
#13My actual argument for that style sans appeals to authority: http://stackoverflow.com/questions/499890/what-is-your-perso...
Re: My Case Against Code Comments
#14Earlier quoted context omitted.
Exactly. Code is for expressing how things are done.* Comments are for expressing why. * Or if you're not into the whole imperative languages bit, what things are done.
Totally OT: How are you managing to use an asterisk as a footnote indicator and not ending up with the two asterisks invisible and the text in between in italic? I've seen this before and I've tried to replicate it and I can't do it. :-/
Re: My Case Against Code Comments
#15Earlier quoted context omitted.
Totally OT: How are you managing to use an asterisk as a footnote indicator and not ending up with the two asterisks invisible and the text in between in italic? I've seen this before and I've tried to replicate it and I can't do it. :-/
An asterisk followed by whitespace doesn't begin italics, so you get * word * rather than word .
Re: My Case Against Code Comments
#16I think everybody hates comments like "getFoo: Get the value of Foo", and huge blocks of commented-out code. However, I _love_ seeing the following types of comments: 1. The high-level overview of how things fit together: This class represents a compiled method at the VM level. It does not contain the actual native code. If native code exists, it is handled using class Blah instead. 2. What should work, but doesn't:…
Re: My Case Against Code Comments
#17I think everybody hates comments like "getFoo: Get the value of Foo", and huge blocks of commented-out code. However, I _love_ seeing the following types of comments: 1. The high-level overview of how things fit together: This class represents a compiled method at the VM level. It does not contain the actual native code. If native code exists, it is handled using class Blah instead. 2. What should work, but doesn't:…
Exactly. Code is for expressing how things are done.* Comments are for expressing why. * Or if you're not into the whole imperative languages bit, what things are done.
Re: My Case Against Code Comments
#18Re: My Case Against Code Comments
#19Earlier quoted context omitted.
I 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.
I don't think anyone is advocating for comments explaining that $i is a loop index.
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.
Re: My Case Against Code Comments
#20I think everybody hates comments like "getFoo: Get the value of Foo", and huge blocks of commented-out code. However, I _love_ seeing the following types of comments: 1. The high-level overview of how things fit together: This class represents a compiled method at the VM level. It does not contain the actual native code. If native code exists, it is handled using class Blah instead. 2. What should work, but doesn't:…
http://submain.com/products/ghostdoc.aspx
Write a function like "getFoo" and it generates that as the description. Similar situation example: http://www.youtube.com/watch?v=yPaNRaub8N4#at=40