0

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.

kc2001
  • 5,008
  • 4
  • 51
  • 92

4 Answers4

4

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.

Alistair A. Israel
  • 6,417
  • 1
  • 31
  • 40
  • The Dependency Structure Matrix looks close to what I'm looking for. They seem to have a matrix for the file level; however, their example matrix has no entries that are greater than one. Based on this example and their description, I'm guessing that they aren't actually counting the dependencies (e.g. method calls) between the files. Do you know? – kc2001 Aug 12 '11 at 20:36
2

I have found PMD to be a simple and effective tool for static analysis and it also measures coupling between Java classes. See here

Nathan
  • 8,093
  • 8
  • 50
  • 76
Suresh Kumar
  • 11,241
  • 9
  • 44
  • 54
0

You can use CodePro . It have a lot of metrics and dependency graphs

Roger Garzon Nieto
  • 6,554
  • 2
  • 28
  • 24
0

You can use CQL (SQL like) in JavaDepend , for example this request

SELECT TOP 100 TYPES ORDER BY TypeRank DESC, TypeCa DESC

Gives you the most 100 used classes in your project.

TheEvilPenguin
  • 5,634
  • 1
  • 26
  • 47
  • How does this tell me which pairs of classes are highly coupled? – kc2001 Nov 23 '11 at 19:58
  • what you can do is to search the class highly coupled with a specific other class. For that you can execute a CQL request like this: SELECT METHODS WHERE IsDirectlyUsedBy "mynamespace.Myclass" , and in the result you have for each class the number of methods concerned, and the class with the high number of methods is highly coupled with the one specified in the request. and in the new version CQL will be improved and it will use Linq to request the code base, and you can easilly search all highly coupled classes, without specify a class in the request. – James from CppDepend Team Nov 23 '11 at 21:30
  • another alternative is to navigate into the dependency matrix, and detect all cells with high dependency weight – James from CppDepend Team Nov 25 '11 at 17:34