Solution 1:

I'm not aware of a deeper concept. I believe it's generally considered in the context of a maintainability index. The more branches there are within a particular method, the more difficult it is to maintain a mental model of that method's operation (generally).

Methods with higher cyclomatic complexity are also more difficult to obtain full code coverage on in unit tests. (Thanks Mark W!)

That brings all the other aspects of maintainability in, of course. Likelihood of errors/regressions/so forth. The core concept is pretty straight-forward, though.

Solution 2:

Cyclomatic complexity measures the number of times you must execute a block of code with varying parameters in order to execute every path through that block. A higher count is bad because it increases the chances for logical errors escaping your testing strategy.

Solution 3:

Cyclocmatic complexity = Number of decision points + 1

The decision points may be your conditional statements like if, if … else, switch , for loop, while loop etc.

The following chart describes the type of the application.

  • Cyclomatic Complexity lies 1 – 10  To be considered Normal applicatinon

  • Cyclomatic Complexity lies 11 – 20  Moderate application

  • Cyclomatic Complexity lies 21 – 50  Risky application

  • Cyclomatic Complexity lies more than 50  Unstable application