Search code examples
javacode-metrics

Which tools indicate pairs of highly-coupled Java classes?


I'm aware of a few tools that indicate which individual classes are coupled to many other classes. For example, several tools implement Coupling Between Objects (CBO), which tells which classes are coupled to many other classes. (For a class CBO is the count of the number of other classes to which it is coupled.) I'm not interested in tools that implement metrics like CBO.

Instead, I'd like to know which pairs of classes are highly coupled, e.g. there are many method calls between classes A and B. If you know of any such tools, please respond.


Solution

  • I haven't used it, but I found ckjm which claimns to be able to measure CBO (coupling between objects) metrics. Unfortunately, it doesn't look to have a very easy-to-use UI (it's largely command-line driven) and while it seems possible to designate which classes to analyze, that process isn't straightforward.

    On a package level, Sonar provides a Dependency Structure Matrix view to help you analyze coupling between packages. The Isotrol Metrics Analytics plugin lets you integrate JDepend and ckjm metrics into Sonar, which can help analyze coupling at the class level. But it still lacks the 'click to drill down' convenience Sonar provides overall.