Chapter 9. Analyzing Complexity and Design

In this chapter, we will discuss how Sonar reports on complexity and the measures it supports. Firstly, we will clarify how complexity in Java programs is calculated and then look into the concepts of coupling, cohesion, and dependencies.

Finally, we will review how Sonar reports on those measures and especially detail the design matrix, which is an essential component to manage dependencies in complex software pieces.

In this chapter we will cover:

  • Measuring software complexity
  • Cohesion and coupling
  • Sonar code complexity metrics
  • The Response for Class metric
  • Lack of cohesion and the LCOM4 metric
  • Locating and eliminating dependencies

Measuring software complexity

Software and its complexity could be described as ...

Get Sonar Code Quality Testing Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.