Cognitive load is how much a developer needs to think in order to complete a task.

🧠: fresh working memory, zero cognitive load
🧠++: two facts in our working memory, cognitive load increased
🤯: working memory overflow, more than 4 facts

Common reasons for cognitive overload

  1. Complex conditionals - introduce meaningfully named intermediate variables
  2. Nested ifs - prefer early returns
  3. Inheritance nightmare - prefer composition over inheritance
  4. Too many small methods, classes or modules
  5. Shallow modules
  6. Shallow micro-services
  7. Abusing the DRY principle

Refs

  1. https://zakirullin.md/cognitive#long