Successful Strategies for Commenting Your Code
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."
These comments you speak of, they seem foreign and strange to me.
I was doing some maintenance on someone else's code and came across this nasty set of like 8 nested if/elses. It was a bloody horrible hack. But the best part of all was the comment right at the top: /* Oh, fuck */
-- (Score:i , Imaginary)
Don't EVER comment your code if you work for a company. That's a sure fire way to lose your job! If you don't comment your code then you are the only person who can understand it, making you indispensible.
In summary, DON'T COMMENT!
/* no */
/*This loop starts at x is equal to 1 and continues while x is less then 5. x is incremented by 1 each time.*/ for( int x=1; x5; x++ ) { printf("Hello World\n");/*Prints "Hello World"*/ }
I viewed the source on the site and nothing was commented :)
Finance tutorials and more! Understandfinance
Comments are more important than Code?
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 at all, and just run it thru The Commentator!
http://www.cenqua.com/commentator/
Don't blame me, I voted for Kodos
No, that first one should be something like:
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...
The AACS key is NOT 0xF606EEFD628B1CA427BEA93A9CA9773F
1. Never spelchezk. /* magic occurs */
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.
-- Tigger warning: This post may contain tiggers! --
# 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
-"...bad old ideas look confusingly fresh when they are packaged as technology" - Jaron Lanier (Digital Maoism on Edge.o
Successful Strategies for Crashing Your Website
This post expresses my opinion, not that of my employer. And yes, IAAL.
This kind of reviews are really destructive for my goal of winning the obfuscated code contest (http://www.ioccc.org/ can not read any further.
My wife's sketchblog Blob[p]: Gastrono-me