维西奥 UML - 显示向量
我需要为我的一项 C++ 作业生成 UML 图。 我正在使用 Visio 2007,但在表示 C++ 向量时遇到问题。 我看到这项工作的唯一方法是创建一个自定义 C++ 数据类型或在我的项目中创建一个向量类,然后对于 UML 中向量的每个实例,我需要深入研究属性并添加
进入后缀字段。
基本上,我试图获取 vector
我几乎一直使用微软软件来制作图表和编码,所以请不要建议我使用其他软件。 然而,如果 Visual Studio 2003 支持以比 Visio 更轻松的方式制作 UML 图,我不会反对使用 Visual Studio,但请告诉我该选项在哪里。
I have the requirement of generating UML Diagrams for one of my C++ assignments. I'm using Visio 2007 and I'm having trouble representing C++ vectors. The only way I can see this working is creating a custom C++ datatype or creating a vector class in my project, then for each instance of a vector in the UML, I need to dig into the properties and add <Class>
into the suffix field.
Basically I'm trying to get vector<Object>
without digging into the properties and adding <Class>
to the suffix field every time.
I'm pretty much stuck with Microsoft software for making diagrams and coding so please don't suggest I use different software. However, if Visual Studio 2003 supports making UML Diagrams in a less painful way than Visio, I wouldn't object to using Visual Studio but please tell me where that option is.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你不需要规定它是 UML 图上的向量。
在您给出的示例中,一个类与另一个类之间存在一对多关系。 这是您需要沟通的重要信息。
您选择将其实现为向量:这是一个不需要在图表上显示的实现细节 - 只需显示一对多关联。
如果出于某种原因,您需要将其更改为 std::list、std::deque 或任何其他 stl 容器,则无需更新图表,因为一对多概念是还是一样。
请记住,您正在显示代码的抽象。 如果您想要传达所有类在概念上如何相互关联,UML 类图是理想的选择。
如果有人想了解其实现的细节,他或她总是可以使用该图作为起点,然后再查看源代码本身。
有关使用 UML 显示的一对多关系的示例,请单击此处
You don't need to stipulate that it's a vector on the UML diagram.
In the example you're giving, there is a one-to-many relationship between one class and another. That's the significant information you need to communicate.
You've chosen to implement this as a vector: this is an implementation detail that doesn't need to go on the diagram - just display a one-to-many association.
If, for some reason, you need to change this to a std::list, or a std::deque, or any other stl container, you won't need to update the diagram, because the one-to-many concept is still the same.
Remember that you are displaying an abstraction of the code. If you want to convey how all the classes conceptually relate to eachother, a UML class diagram is ideal.
If somebody wants to know the details of how it's implemented, he or she can always use the diagram as a starting point before looking at the source code itself.
For an example of one-to-many relationships displayed using UML, click here
UML 有参数化类的表示法。 参数类型进入右上角的重叠框中,例如 this< /a> 你的工具是否支持它是另一回事......
UML has a notation for parameterized classes. The parameter type goes into an overlapped box in the top right corner like this Whether your tools support it is another matter...