What does package tangle index data indicate in Sonar?

Inquisitive picture Inquisitive · Mar 10, 2013 · Viewed 12.7k times · Source

I have the following data on one of the 7 axes (See the second picture) after running a Sonar analysis on my project. What information can be decoded from this data? Also which of the axes in the diagram below does this data pertain to?

enter image description here

enter image description here

Answer

Neville Kuyt picture Neville Kuyt · Mar 10, 2013

It means that there are cyclical dependencies between packages and files.

Ideally, you want dependencies to flow in one direction - this allows you to make changes and predict their impact. For instance, if your "user interface" package depends on the "business logic" package, but nothing depends on the "user interface" package, you should be able to make changes to the user interface without breaking anything outside that package. A cyclical dependency means (for instance) the user interface package depends on the business logic package, but the business logic package also depends on the user interface package. Now if you change the user interface, you might break the business logic layer - which in turn might affect something totally unrelated in the user interface.

The idea of "layering" software, and having dependencies flow in a single direction between layers is designed to remove this tangle.

You can very often reduce this tangling by moving classes from one package to another.

Tangling is usually an architecture/design problem.