Java Code Structure and Dependencies Analysis Tools for Eclipse

One of my first assignments at the new company (remember, I left Zend previous week), was analysing existing projects structure. Which means distribution of classes into packages, package dependencies, libraries usage etc.

The results, I would say, were far from being perfect, but I can bet, most of large (and especially proprietary) projects would look similar or even worse. But this is not what I was going to say.

What I am going to say, is for this purpose I evaluated several analysis tools and I want to share my opinion about them.

Here they are (in order of evaluation).

1. Eclipse Metrics(1) (CPL)

Pros: Runs fast, provides tangle detector.

Cons: Dependencies graph is not usable with large projects. No text output of dependencies is available.

2. Eclipse Metrics(2) (CPL)

Pros: no.

Cons: Does not analyze dependencies.

2. JDepend

Pros: Nice and simple UI, fast analysis.

Cons: Provides neither graph nor detailed dependency cycles information, doesn’t provide links to source.

3. eDepend (Commercial)

Pros: Fully featured graphic dependency analyzer, allows filtering on dependency kind

Cons: Commercial, creates disproportedly wide graphs for large projects that are hard to maintain, very slow analyzing and graph creation, doesn’t provide info on elements which depend on selected element.

4. stan4j (Free Beta)

Pros: Fully featured graphic dependency analyzer, very cute GEF based UI, cycles and tangles visualizer, very convenient eclipse integration, report/graphics export ability.

Cons: Does not provide recursive dependency paths on selected elements, does not provide inter-package class dependencies information, non graphical views improvement is suggested.

Conclusion

In the end, in order to perform my task I’ve mostly used stan4j, sometimes switched to eDepend and once or twice times executed JDepend - each of them has its specific advantages.

9 Responses to “Java Code Structure and Dependencies Analysis Tools for Eclipse”

  1. Patrick Roumanoff Says:

    Hi,

    did you try iSpace at http://ispace.stribor.de/
    I find it pretty good to expose package dependencies and cycles.

    Seva: If I would try, I would write about it, so the answer is - no :) But I will defenitely do. Thank you very much!

  2. S. Correia Says:

    Hi,

    Did you try the “Plug-in Dependency Visualization tool”?
    http://blog.ianbull.com/2007/10/plug-in-dependency-visualization.html
    Pros: very light, nice graphs, exportable as jpeg, highlight paths between plugins.
    Cons: only works for plug-in dependencies.

    Also, there is Creole: http://www.thechiselgroup.org/creole
    Pros: nice graphics, different kind of dependencies (inheritance, relationships such as calls, accesses…), allows overview and to dig into details (to get back and forth as you want ). Analyze Java code, not only plug-ins, Can analyze package(s), project(s).
    Cons: on complex code, the user needs to learn a bit how to use the tool to extract useful information (use filters…).

    Hope this helps.

    Seva: The first one doesn’t match my needs, but the second I will definitely try. Thank you very much!

  3. Seva Lapsha Says:

    Another one to try - SA4J (IBM)

  4. Yves YANG Says:

    Regard to the Cons of eDepend “doesn’t provide info on elements which depend on selected element”, we do provide all information about the detail information. Please look at this screenshot: http://www.soyatec.com/euml2/screenshots/package-dependence.png
    Seva: This works only when you analyze the whole package. I’m interested in selecting just one package/class and see which ones depend on it.

  5. Channing Walton Says:

    FYI The link to the second eclipse metrics should be http://eclipse-metrics.sourceforge.net/
    Seva: Oops. You’re right. Fixed.

  6. Christoph Beck Says:

    You wrote about stan4j:
    >Does not provide recursive dependency paths on selected elements
    Seva, could you please explain what you mean here?
    Seva: I mean that I want to select an element and to get a filtered graph of all the elements it depends on, the elements that these elements depend on and so on recursively. And another graph of the same, but with backward dependencies.
    >does not provide inter-package class dependencies information
    It does! Just select an edge in a graph to have all the code dependencies listed in the Dependencies View.
    Seva: Yes, I saw that, but I wanted to see all the classes relations on graph, including other packages - eDepend gives me this functionality, but just one way: it shows elements on which the selected element depends.

  7. Christoph Beck Says:

    stan4j…
    >>does not provide inter-package class dependencies information
    >It does! Just select an edge in a graph[…]
    >Seva: Yes, I saw that, but I wanted to see all the classes relations on graph, including other packages[…]
    Ah, OK. The Couplings View does your job. It shows all incoming/outgoing dependencies for the selected artifact. See http://stan4j.com/dependencies/couplings.html.

  8. Yves YANG Says:

    >Seva: This works only when you analyze the whole package. I’m interested in selecting just one package/class and see which ones depend on it.

    eDepend supports what you need exactly. You select a class/package in package explorer, call the context menu eDepend->Class Dependency explorer. You can do it from a diagram as well. Here is an example based on log4j.
    http://www.soyatec.com/euml2/screenshots/class-dependence.png
    Seva: This shows only one classes my class depends on and not ones which depend on it.

  9. maarten meijer Says:

    Hi,

    I found CAP very useful and fast as well for dependecy analysis:
    http://cap.xore.de/

    Not updated for some time though…
    Seva: I will try it too. Thank you!

Leave a Reply

You must be logged in to post a comment.