Good comments, bad comments

As developers from our first years we are taught by our masters: “Comment your code you should, my young apprentice”. I even found this article, that outlines 13 rules, on how you should comment your code. I only have two rules for that:

  1. Don’t comment what your code is doing. If you find it necessary, it’s a code smell, and you should start thinking about refactoring it, so that it’s obvious.
  2. Do comment why your code does what it does.

Other than that, merry Christmas and happy new year everybody.

Technorati Tags:

Comments

Thomas Gal says:

Awesome! I came across your blog when I was looking for an open source SVN SCC Provider. Then I saw the headline about automation and this post, and I though ” this guy gets it!” Must be eastern European.

-Tom (unamericanized:Tamás Gál) Gal