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

感情迁移 提交于 2019-12-23 18:24:17

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!