Comments

Comments can be used appropriately to introduce classes and provide docu- mentation, but used incorrectly, they mask readability and process problems by further obfuscating already unreadable code.

Symptoms

ā€¢ Comments within method bodies. ā€¢ More than one comment per method. ā€¢ Comments that restate the method name in English. ā€¢ TODO comments. ā€¢ Commented out, dead code.

Solutions

  • Introduce Explaining Variableā­ to make obfuscated lines easier to read in pieces.
  • Extract Methodā­ to break up methods that are difficult to read.
  • Move TODO comments into a task management system.
  • Delete commented out code, and rely on version control in the event that you want to get it back.
  • Delete superfluous comment s that donā€™t add more value than the method or class name.