views:

1101

answers:

11

HI All I am at the end of the release of my project.So in order to keep working our manger asked us to generate Class Diagrams for the code we had written.Its medium project with 3500 java files .So I think we need to generate class diagrams.First I need to know how reverse engineering works here. Also I looked for some tools in Google(Green, Violet) but not sure whether they are of any help.Please suggest me how to proceed.Also a good beginning tutorial is appreciated.

A: 

There are some tools available that will help you generate these diagrams. These cost money.

Otherwise you could to try to parse your Java files. This could be as simple to create a simple parser that reads the Java files and writes the name of the class and all the import statements to a file and generates a class diagram from there, graphviz can help you there.

Peter Stuifzand
You could combine this approach with the free http://yuml.me UML diagram generator. People are [already doing this](http://yuml.me/wildthing) for Powershell classes and Ruby on Rails domains.Since you have so many classes, you'd need to break the diagrams down a bit to show 10-50 classes.
Tobin Harris
+2  A: 

This is more a toolchain than a tool and I haven't tried it out by myself. But it maybe a starting point. Using UMLGraph, ant and GraphViz. Explained step by step: in this article.

The MYYN
A: 

Visual Paradigm for UML Standard Edition (or Better) will reverse engineer Java files in to Class Diagrams.

Nick
+4  A: 

The tool you want to use is Doxygen. It's similar to Javadoc, but works across multiple languages. If figures out the dependencies, and can call graphviz to render the class diagrams. Here's an example of a few Java classes run through Doxygen.

brianegge
WOW. Works great.
Epaga
A: 

I ve used Visual Paradigm for UML for what you want to do and it was quite good.

See here for details.

Just go Tools -> Instant reverse and select your packages.

anna
A: 

I guess if your boss just wants to keep you busy until the next project starts then there's no harm in it, but you will find pretty quickly that creating a class diagram with 3500 classes will tell you exactly NOTHING about your system. In fact, you don't really want a diagram with more than about 10 classes on it. So once you have reversed all the code into your modelling tool, you will want to start organizing and arranging to find the meaning. Create a new diagram, drop a single important class onto it and bring in all the classes that are directly related to that class. Repeat for maybe the 300 most significant classes. Don't worry, it isn't as horrible as it sounds, maybe a week's work.

For the record, my modelling tool of choice is Enterprise Architect by Sparx Systems. It will reverse java sources or .jar files. There is a free 30 day trial edition.

chimp
I agree that generating to all classes is a painful job.This exercise is to keep the folks in good spirt.:_)
GustlyWind
A: 

I've been using Enterprise Architect for a number of years. A JBoss developer suggested it to me. It works very well for all types of UML modeling including the reverse engineering of class models (Java, C# and others). The basic version is currently $120 per seat, but it has most of the capabilities of much more expensive tools and it is much easier to learn. I particularly like its ability to generate HTML and RTF documentation.

It is very easy to synchronize code between the tool and your source code. Even bi-directional if you want.

Your PM may also like the activity and sequence diagrams that it can create. I also frequently use the deployment diagrams. It's very helpful to have all of this in one tool.

A: 

You may be able to reverse engineer class diagrams with the open source modelleing tool ArgoUML http://argouml.tigris.org/

crowne
+2  A: 

I strongly recommend BOUML. Its Java reverse support is absolutely ROCK SOLID.

BOUML has many other advanteges:

  • it is extremely fast (fastest UML tool ever created, check out benchmarks),
  • has rock solid C++, Java, PHP and others import support,
  • it is multiplatform (Linux, Windows, other OSes),
  • has a great SVG export support, which is important, because viewing large graphs in vector format, which scales fast in e.g. Firefox, is very convenient (you can quickly switch between "birds eye" view and class detail view),
  • it is full featured, impressively intensively developed (look at development history, it's hard to believe that such fast progress is possible).
  • supports plugins, has modular architecture (this allows user contributions, looks like BOUML community is forming up)
It's nice, and really easy to use. However, the diagrams are a tad ugly.
billynomates
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
A: 

Hierarchy can do this, too.

http://www.whitemagicsoftware.com/software/java/hierarchy/

Dave Jarvis
Wow!! its amazing this question is asked exactly an year ago but still finding responses.Thanx
GustlyWind
@GustlyWind: Apologies for the delay; it took some time to implement. ;-) See also: http://stackoverflow.com/questions/1168753/application-to-generate-java-class-hierarchy-diagram
Dave Jarvis