What is Cognitive Complexity and how to use it ?

Introduction

In the domain of software development, the Cognitive Complexity could be approximately defined as “the difficulty for a human being to understand some code snippet”. This definition seems to be clear and without ambiguities, but it is not.

The main problem is in the word “difficulty”: what does it mean and how to measure it ? That’s why, in this article, I will use a more precise definition, which uses a notion which could be measured in the real world: the time.