生成类图
大家好,我的项目发布即将结束。因此,为了继续工作,我们的经理要求我们为我们编写的代码生成类图。它是一个中等项目,包含 3500 个 java 文件。所以我认为我们需要生成类图。首先我需要知道逆向工程是如何工作的。 我还在谷歌中寻找了一些工具(绿色,紫色)但不确定 他们是否有任何帮助。请建议我如何继续。也感谢一个好的开始教程。
HI All I am at the end of the release of my project.So in order to keep working our manager 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
我强烈推荐 BOUML。 它的Java反向支持绝对是坚如磐石。
BOUML 还有许多其他优点:
I strongly recommend BOUML. Its Java reverse support is absolutely ROCK SOLID.
BOUML has many other advanteges:
您要使用的工具是 Doxygen。 它与 Javadoc 类似,但适用于多种语言。 如果弄清楚了依赖关系,就可以调用graphviz来渲染类图。 下面是一些通过 Doxygen 运行的 Java 类的示例。
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.
这与其说是一个工具,不如说是一个工具链,我自己还没有尝试过。 但这也许是一个起点。 使用 UMLGraph,ant 和 GraphViz。 逐步解释:本文。
This is more a toolchain than a tool and I haven't tried it out myself. But it maybe a starting point. Using UMLGraph, ant and GraphViz. Explained step by step: in this article.
我已经使用 Visual Paradigm for UML 来完成你想做的事情,它非常好。
有关详细信息,请参阅此处。
只需转到“工具”-> 即时反向并选择您的包裹。
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.
您可以使用开源建模工具 ArgoUML 对类图进行逆向工程 http://argouml.tigris.org/< /a>
You may be able to reverse engineer class diagrams with the open source modelleing tool ArgoUML http://argouml.tigris.org/
ObjectAid 非常好。 您可以将类拖到图表中并按照您想要的方式排列它们。
ObjectAid is pretty nice. You can drag classes into a diagram and arrange them the way you want.
Visual Paradigm for UML 标准版(或更好)会将 Java 文件逆向工程为类图。
Visual Paradigm for UML Standard Edition (or Better) will reverse engineer Java files in to Class Diagrams.
我想,如果你的老板只是想让你忙到下一个项目开始,那么这并没有什么坏处,但你很快就会发现,创建一个包含 3500 个类的类图不会告诉你关于你的系统的任何信息。 事实上,您并不真正想要一个包含超过 10 个类的图表。 因此,一旦您将所有代码反转到建模工具中,您将需要开始组织和安排以查找含义。 创建一个新图,将一个重要的类放入其中,并引入与该类直接相关的所有类。 对也许 300 个最重要的类重复此操作。 别担心,这并不像听起来那么可怕,也许一周的工作。
根据记录,我选择的建模工具是 Sparx Systems 的 Enterprise Architect。 它将反转 java 源或 .jar 文件。 有 30 天免费试用版。
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.
有一些工具可以帮助您生成这些图表。 这些都是要花钱的。
否则你可以尝试解析你的 Java 文件。 创建一个简单的解析器可以很简单,该解析器读取 Java 文件并将类的名称和所有导入语句写入文件,并从那里生成类图,graphviz 可以帮助您。
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.
我使用 Enterprise Architect 已经很多年了。 一位 JBoss 开发人员向我推荐了它。 它非常适合所有类型的 UML 建模,包括类模型(Java、C# 等)的逆向工程。 基本版本目前每个席位 120 美元,但它具有更昂贵的工具的大部分功能,而且更容易学习。 我特别喜欢它生成 HTML 和 RTF 文档的能力。
在工具和源代码之间同步代码非常容易。 如果你愿意的话,甚至可以是双向的。
您的产品经理可能还喜欢它可以创建的活动图和序列图。 我也经常使用部署图。 将所有这些功能都集中在一个工具中非常有帮助。
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.