Commenting Your Code

A great article about commenting and code.  I can’t even begin to describe some of the odd comments I’ve seen in code.  Things like “// Loop through items to find the right one”.  Items?  What items?  What makes it a “right” item?  I would forgo those comments, for some above WHY an item is “right”.

I am all about “self documenting code”.  I feel code should flow, as if reading a story.  I often had talks with other programmers who said “I don’t ever need to use this code again, so why waste time wrapping it in a method/function?”.  Well that may be true for today’s code base, and your code may make sense to you, but think about the next guy coming in after you.  If you write great code, it can live for a long time, even after you’ve left a company.

“Always leave the code base, in a better state than you found it in”.