C ++到UML(逆向工程/往返工程) [英] C++ to UML ( Reverse engineer / Round-trip engineering )

查看:346
本文介绍了C ++到UML(逆向工程/往返工程)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个工具,可以逆向工程C ++到UML(反之亦然)。然而,关键的要求是它可以正确地解析方法(成员函数)主体,以便正确地识别依赖关系。



更多细节:



在下面的代码中,ClassA依赖于ClassB,因此UML工具需要用虚线显示。似乎很少有工具可以做到这一点。我试过Enterprise Architect,UMLStudio,Visual Paradigm,Borland Together,IBM Rational Architect等。

  class ClassB 
{
static void methodStatic(){}
void method(){}
};

class ClassA
{
void method()
{
ClassB :: methodStatic();
ClassB c;
c.method();
}
};

编辑:我也试过StarUML。
注意,Enterprise Architect几乎是完美的;它正确地识别从方法参数类型和字段类型的依赖性,并且往返工程的所有其他功能似乎工作良好。

解决方案

有几个工具允许一个图形表示您的代码。但是,C ++代码(C ++是一个多范式语言)通常与UML中描述的典型习语不匹配。所以很可能你的C ++代码不适合典型的UML图。我认为这解释了为什么没有真正好的UML工具的C ++。至少我还没有找到。


I am looking for a tool that can reverse engineer C++ to UML (and vice-versa). However, the crucial requirement is that it can correctly parse method (member function) bodies so that dependencies are correctly identified.

More Detail:

In the following code, ClassA is dependant on ClassB, so the UML tool needs to show this with a dashed line. There appear to be very few tools which can do this. I have tried Enterprise Architect, UMLStudio, Visual Paradigm, Borland Together, IBM Rational Architect and others.

class ClassB
{
 static void methodStatic() {}
 void method() {}
};

class ClassA
{
 void method()
 {
   ClassB::methodStatic();
   ClassB c;
   c.method();
 }
};

Edit: I have also tried StarUML. Note that Enterprise Architect is almost perfect; it correctly identifies dependencies from method parameter types and field types and all other features of the round-trip engineering seem to work well. However, it simply does not identify dependencies from method bodies, as in the example.

解决方案

There are a few tools that allow a graphical presentation of your code. Doxygen for example does a good job.

However, C++ code (C++ being a multi-paradigm language) often does not match the typical idioms described in UML. So chances are that your C++ code doesn't fit in a typical UML diagram. I think this explains why there are no really good UML tools for C++. At least I haven't found any yet.

这篇关于C ++到UML(逆向工程/往返工程)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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