7 comments

[ 4.1 ms ] story [ 30.6 ms ] thread
Rule #1 - Comments lie
Agree. Never trust them.
So can variable and function names, but comments are easier to update.
If you want to, yes.

If you don't, I feel sorry for whoever has to maintain your code.

Commenting code only works if other people who change the code also bother to change the comments
Leaving aside code documentation (aka dockblocks), I can think of dozen of examples where you MUST comment you code..

  - strict order of execution
  - math formulas in the code (or its results)
  - external systems requirements/hacks
  - non-explicit side effects
  - legacy or costly known issues
  - intention of cryptic code
  - design choices (and its tradeoff)
  - ..
This obviously implies you actually care about who will maintain such best
Comments are an act of kindness towards the person who will be doing the maintenance on the code you have written. It's doubly kind when that code maintainer is yourself.