如何从现有代码生成类图和序列图? [英] How to generate class diagrams and sequence diagrams from existing code?

查看:581
本文介绍了如何从现有代码生成类图和序列图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Java代码,需要生成类图和序列图.我正在使用netbeans,但是代码是100%纯手工编码的.如何使用Netbeans为现有代码生成类图和序列图?

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?

代码被分成包,所以我需要明智地生成类图.例如,这意味着包1的图1,包2的图2等.最后,我需要将生成的GUI作为图像.

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.

请帮助!

推荐答案

IMO,为您自己编写的代码生成UML图是毫无意义的. UML的价值是作为设计辅助,在较小程度上是反向工程辅助.如果您打算为现有的易于理解的代码生成代码文档,那么Javadoc可能比UML更好,而且工作量也要少得多.

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.

另一个问题是,生成的UML类图趋于丑陋,因为它们趋向于包含比必要更多的细节,并且因为您需要人眼才能合理地布置事物.序列图可能也是如此.

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.

从NetBeans IDE生成UML

(免责声明:从此已关闭的问题中删除- UML自动生成对于Netbeans 7.1 )

最后,我需要将生成的GUI作为图像.

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

使用操作系统提供的工具对GUI进行截屏.

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

这篇关于如何从现有代码生成类图和序列图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆