Sometimes we feel confusion going through the code. Confusion costs time and money. Confusion is caused by high cognitive load. It's not some fancy abstract concept, but rather a fundamental human constraint or a concept in psychology.
Cognitive load is how much a developer needs to think in order to complete a task.
The average person can hold roughly 4 such chunks in working memory.
Once the cognitive load reaches this threshold, it becomes much harder to understanding things.
Cognitive Load & Interruptions
We should reduce the cognitive load in our tasks as much as possible.
🤔
Intrinsic
Extraneous
🔻
Example: Cognitive Complexity In SonarQube
Inheritance nightmare
Too many small methods, classes or modules
Too many shallow microservices
...
To sum up, we should reduce the cognitive load in our tasks as much as possible. Especially extraneous cognitive loads, which we can try to control.
🥹