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.