Search code examples
javanetbeansreverse-engineeringclass-diagramsequence-diagram

How to generate class diagrams and sequence diagrams from existing code?


I have a Java code which I need to generate the class diagrams and sequence diagrams. I am using netbeans, but the code is 100% pure hand coded. How can I generate the class diagrams and sequence diagrams for existing code using netbeans?

The code is separated into packages, so I need to generate class diagrams package wise. Which means, for an example, diagram 1 for package 1, diagram 2 for package 2 etc. Finally I need to take the generated GUI as an image.

Please help!


Solution

  • IMO, generating UML diagrams for code that you have written yourself is kind of pointless. The value of UML is as a design aid and to a lesser extent as a reverse engineering aid. If you are intent on generating code documentation for existing well-understood code, Javadoc is probably better value than UML, and a lot less work.

    The other problem is that generated UML class diagrams tend to be ugly because they tend to include more detail than is necessary, and because you need a human eye to lay things out decently. The same probably goes for sequence diagrams.

    But if that hasn't convinced you, these links should help you do it.

    (Disclaimer: scraped from this closed Question - UML automated generation for Netbeans 7.1)

    Finally I need to take the generated GUI as an image.

    Take a screen shot of the GUI using the tools provided by your OS.