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."
Yeah, sample for how to do it exactly *wrong*. Do you *really* need to tell people you're incrementing i by one when the line is "i++"?! Honestly, people... code, written well, is nearly self-documenting. Comments should exist to *augment* the code... clarify the tricky bits, outline complex algorithms, provide explanation for why things are done how they are. They should not simply re-express the code in words...
Example, in the above code, I'd probably have a block at the top which said something like: "If i is less than 3, then <some condition> has been satisfied, so print out 'hello world'".