Successful Strategies for Commenting Your Code 500
LilG writes "Over at Particletree, Ryan Campbell writes about Successful Strategies for Commenting Your Code. His essay gives advice and examples on proper commenting, and details some different strategies."
Huh? (Score:5, Funny)
My favorite code comment not written by me (Score:5, Funny)
Don't do it! (Score:0, Funny)
In summary, DON'T COMMENT!
Gotta say it (Score:2, Funny)
Example (Score:4, Funny)
Practice what you preach (Score:5, Funny)
Comments are more important than Code? (Score:5, Funny)
I once tried writing code that was completely made up of comments. It was easy to write and all, but didn't work very well.
Don't comment (Score:5, Funny)
http://www.cenqua.com/commentator/ [cenqua.com]
Re:Huh? (Score:3, Funny)
Was that some form of early DMCA or IP lockdown?
No (Score:5, Funny)
This loop starts at 1, and to 5 it counts. It doesn't count to 6, nor it does count to 8. It does not count to 3 or 4, except in passage to 5. When it reaches number 5, the fifth number...
Re:Huh? (Score:3, Funny)
Things to always remember when commenting (Score:4, Funny)
2. Use randomly chosen variable names, or objects that resemble your favorite Orcs and Trolls from LotR - after all, everyone knows that a Lothlorien object will have farseeing ability, so it's obvious.
3. When instantiating something for the first time, never explain it - real programmers read the original object source.
4. If you do something complex, write a short pithy comment like
5. If you do something easy but you were drinking too much hot cocoa, write a long verbose description, and also mention how good the hot cocoa was.
6. Always include song lyrics to what you're listening to while you wrote the code.
7. Object inheritence means never having to explain the code.
8. Repetition is the best way to reinforce obvious things - so repeat the obvious thing since it's the best way to reinforce it.
9. If you break up with your girl/boyfriend, write about it in the comments - people really want to know.
10. If you're updating or modifying code, write your opinion about the original code in the comments. Use nasty words if you can.
All Depends... (Score:4, Funny)
# The main function starts here
or...
# This is a loop and it will run while a certain
# condition exists.
or...
# Don't forget to remove this section after
# I'm gone - Dan - 04/25/1995
Think about the children! ;P
Re:Comments are more important than Code? (Score:5, Funny)
Re:My favorite code comment not written by me (Score:5, Funny)
I was in a similar spot a month or two ago and found some other company's comments - unhelpful as always - in the form of typed out sound effects.
# This function goes vroooooooommm-pop!
I have no idea why the developers put such comments there other than to entertain themselves as they sifted through their horribly written Perl.
Re:Huh? (Score:2, Funny)
* slashdot comment comment
* 1.0.0 - torpor - init.
*/
#pragma KARMA_HACK
Next on his list of things to write about (Score:3, Funny)
Obfucksucated code contest (Score:3, Funny)
Re:Huh? (Score:5, Funny)
*ducks*
Re:No (Score:2, Funny)
Re:No (Score:4, Funny)
Re:Huh? (Score:2, Funny)
A true Klingon warrior does not duck.
A true Klingon warrior would have nothing to do with such a weak waterfowl.
Re:Huh? (Score:2, Funny)
Re:Klingons and code documentation (Score:3, Funny)
Re:Things to always remember when commenting (Score:3, Funny)
Re:Huh? (Score:2, Funny)