Uncle Bob Clean Code Checklist Comments, Naming

  • Add flashcards / review ✅ 2022-11-01

  • Comments

    • Most of the time [[comments]] are code smell
      • They tend to compensate for bad code
      • They deteriorate over time and can lie
      • Most of the time are useless
    • There really should be following comments:
      • Legal / copyright comments
      • Comments when you cannot use a more descriptive name due to a design pattern
      • Hard to understand lines like [[regex]] query
    • When writing comments
      • Should reveal intent
      • Are applied to local [[scope]] only
  • Naming names
    • Should reveal intent
    • Variable name length should be proportional to the scope that contains it.
    • Function and class name length should be inverse proportional to the scope. The larger scope - the shorter it should be, more abstract.
    • Avoid using names with "data", "info".

Color comments red - read them - if useless, delete them.>

Red column bar that shows you if you have too much of line-width.


flashcards

Why are comments considered a code smell? ? - They tend to compensate for bad code - They deteriorate over time and can lie - Most of the time are useless

These are the comments that should be allowed: ? - Legal / Copyright comments - Comments when you cannot use a more descriptive name due to a design pattern - Hard to understand lines like regex query

When writing comments you should: ? - Reveal intent - Apply them to the local scope only

Variable names should reveal intent.

Variable name length should be proportional to the scope that contains it.

Function and class name length should be inverse proportional to the scope. The larger scope - the shorter it should be, more abstract.

Avoid using names with::"data", "info"