Search code examples
software-designcode-metricscyclomatic-complexity

Guidelines for permissible maximum linearly-independent cyclomatic complexity?


For software engineering metrics, what are some guidelines on the maximum permissible linearly-independent cyclomatic complexity? For a properly designed module, what is the upper-bound on cyclomatic complexity?


Solution

  • The recommendation in the documentation of the tool NDepend concerning method Cyclomatic Complexity is:

    • Methods where CC is higher than 15 are hard to understand and maintain.

    • Methods where CC is higher than 30 are extremely complex and should be split into smaller methods (except if they are automatically generated by a tool).

    For a properly designed module, what is the upper-bound on cyclomatic complexity?

    CC applies well on methods because a method is a unit of code flow understanding. There are other metrics to estimate the classes and modules (as a grape of classes) design and complexity like for example:

    Disclaimer: I work for NDepend