Topic 2 of 12

Clean Code

Code is read far more often than it's written. Practical principles to keep code readable, simple and easy to change.

What to study

  • Use meaningful names
  • Keep classes, methods and files small
  • The Boy Scout rule
  • Comment only what's necessary
  • Code formatting and style
  • Avoid premature abstractions and refactor constantly
  • Be consistent
  • Minimize cyclomatic complexity
  • Prefer exceptions to returning error codes
  • Avoid passing booleans and nulls
  • What pure functions are
  • What unit tests are

Videos1

Books1