问题
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!
回答1:
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.
UML Diagrams for NetBeans 7.0
Generating UML From the NetBeans IDE
(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.
回答2:
I just created UML diagrams for my uni project . Sad to see that Netbeans has stopped supporting UML plugin for its newer versions. In case you are also on a newer version like me (7.3 ) then you can make use of a third party tool namely yWorks UML Doclet to generate UML .
Its works really well . At least i am happy . See the way to use it NetBeans 7.0 and 7.1 UML plugin
Hope this helps!
来源:https://stackoverflow.com/questions/15583930/how-to-generate-class-diagrams-and-sequence-diagrams-from-existing-code