java 生成类图

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/909346/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 14:18:38  来源:igfitidea点击:

Generating Class Diagram

javaclassumldiagrams

提问by GustyWind

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.

嗨,我的项目发布结束了。所以为了继续工作,我们的经理要求我们为我们编写的代码生成类图。它的中等项目有 3500 个 java 文件。所以我认为我们需要生成类图。首先我需要知道逆向工程在这里是如何工作的。另外我在谷歌(绿色,紫色)中寻找了一些工具,但不确定它们是否有任何帮助。请建议我如何继续。也感谢一个好的开始教程。

采纳答案by GustyWind

I strongly recommendBOUML. Its Java reverse support is absolutely ROCK SOLID.

我强烈推荐BOUML。它的 Java 反向支持绝对是坚如磐石

BOUML has many other advanteges:

BOUML 还有许多其他优点:

  • it is extremely fast (fastestUML tool ever created, check out benchmarks),
  • has rock solid C++, Java, PHP and others import support,
  • it is multiplatform (Linux, Windows, other OSes),
  • has a great SVG export support, which is important, because viewing large graphs in vector format, which scales fast in e.g. Firefox, is very convenient (you can quickly switch between "birds eye" view and class detail view),
  • it is full featured, impressively intensively developed (look at development history, it's hard to believe that such fast progress is possible).
  • supports plugins, has modular architecture (this allows user contributions, looks like BOUML community is forming up)
  • 它非常快(有史以来最快的UML 工具,请查看基准测试),
  • 拥有坚如磐石的 C++、Java、PHP 和其他导入支持,
  • 它是多平台的(Linux、Windows、其他操作系统),
  • 具有强大的 SVG 导出支持,这一点很重要,因为以矢量格式查看大图,例如在 Firefox 中可以快速缩放,非常方便(您可以在“鸟瞰”视图和类详细信息视图之间快速切换),
  • 它功能齐全,开发密集程度令人印象深刻(看看开发历史,很难相信如此快速的进步是可能的)。
  • 支持插件,具有模块化架构(这允许用户贡献,看起来 BOUML 社区正在形成)

回答by brianegge

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.

您要使用的工具是Doxygen。它类似于 Javadoc,但适用于多种语言。如果搞清楚依赖关系,就可以调用graphviz来渲染类图。下面是通过 Doxygen 运行的几个Java 类的示例。

回答by miku

This is more a toolchain than a tool and I haven't tried it out myself. But it maybe a starting point. Using UMLGraph, antand GraphViz. Explained step by step: in this article.

这与其说是一个工具,不如说是一个工具链,我自己还没有尝试过。但这可能是一个起点。使用UMLGraphantGraphViz。一步一步解释:在这篇文章中

回答by miku

I ve used Visual Paradigm for UML for what you want to do and it was quite good.

我已经将 Visual Paradigm for UML 用于您想做的事情,它非常好。

See herefor details.

有关详细信息,请参见此处

Just go Tools -> Instant reverse and select your packages.

只需转到工具 -> 即时反向并选择您的包。

回答by aditsu quit because SE is EVIL

ObjectAidis pretty nice. You can drag classes into a diagram and arrange them the way you want.

ObjectAid非常好。您可以将类拖到图表中并按照您想要的方式排列它们。

回答by crowne

You may be able to reverse engineer class diagrams with the open source modelleing tool ArgoUML http://argouml.tigris.org/

您可以使用开源建模工具 ArgoUML http://argouml.tigris.org/对类图进行逆向工程

回答by chimp

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.

我想如果你的老板只是想让你忙到下一个项目开始,那么这没有什么坏处,但是你很快就会发现,创建一个包含 3500 个类的类图不会告诉你关于你的系统的任何信息。事实上,您并不真正想要一个包含超过 10 个类的图表。因此,一旦您将所有代码都反转到您的建模工具中,您将需要开始组织和安排以找到含义。创建一个新图,将一个重要的类放到它上面,并引入与该类直接相关的所有类。对 300 个最重要的类重复此操作。别担心,它并不像听起来那么可怕,也许一周的工作。

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.

作为记录,我选择的建模工具是Sparx Systems 的Enterprise Architect 。它将反转 java 源或 .jar 文件。有一个免费的 30 天试用版。

回答by Nick

Visual Paradigm for UML Standard Edition (or Better) will reverse engineer Java files in to Class Diagrams.

Visual Paradigm for UML Standard Edition(或更高版本)会将 Java 文件反向工程为类图。

回答by Peter Stuifzand

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, graphvizcan help you there.

否则您可以尝试解析您的 Java 文件。这可能就像创建一个简单的解析器一样简单,该解析器读取 Java 文件并将类的名称和所有导入语句写入文件并从那里生成类图,graphviz可以帮助您。

回答by Peter Stuifzand

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.

我已经使用 Enterprise Architect 多年了。一位 JBoss 开发人员向我推荐了它。它适用于所有类型的 UML 建模,包括类模型(Java、C# 和其他)的逆向工程。基本版本目前每个座位 120 美元,但它具有更昂贵工具的大部分功能,而且更容易学习。我特别喜欢它生成 HTML 和 RTF 文档的能力。

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.

您的 PM 也可能喜欢它可以创建的活动图和序列图。我也经常使用部署图。将所有这些都集中在一个工具中是非常有帮助的。