views:

148

answers:

2

I just noticed that Intellij has a UML diagram drawer. I am attempting to use it to figure out what is going on in some code that is new to me.

Is there anyway to show the dependencies between all of the classes/interfaces on the screen? Is this a useful feature? It seems to be missing somethings but it might just be that I am not that familiar with UML.

Anyone have any observations?


Is there anyway to show has-a relationships?

A: 

See http://www.reversejava.com for a dynamic reverse engineering application which generates UML Sequence diagram and view of Participating Class diagram from any Java Application at runtime All you have to do is just run your application and sit back. Reverse Java runs in background tracing all the activities happening inside your application and creates UML diagram for you.

You also have options for, excluding packages,editing the Sequence diagram and exporting the diagrams as PDF or Image.

And its not expensive !

Rajesh Jadhav
Wow, that is pretty interesting.
sixtyfootersdude
A: 

You can manually add "has-a" relationships by right clicking on a class in the UML diagram, select "Show classes from signature" (or press Ctrl+Alt+U) and choose the class you want to add. Then you can select "Show dependencies" to let Intellij fill in the dependencies.

Tiny fabricated example (omitted the obvious empty definitions of A, B and I)

class Test implements I {
    List<A> a;
    B b;

    Test(A a, B b) {
        this.a = Arrays.asList(a);
        this.b= b;
    }
}

will result in the following diagram after adding A, B and "Show dependencies":

http://i33.tinypic.com/o8cw36.png (was not allowed to post the image as this is my first post :))

jch

related questions