尝试更好地理解 UML 图关系
这是我为学生记录系统创建的第一个 UML 图。我一直在阅读有关依赖关系、关联和聚合等关系类型的文档。有什么意见吗?
This is my very first UML diagram for a Student Record System I have created. I've been reading documentation on the types of relationships such as dependency, Association and Aggregation. Any opinions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以下是我的一些想法:
尝试将其排列成一棵树,依赖性箭头从上到下。它使其更具可读性,并允许您查看可以改进的地方。
我认为您混淆了箭头方向。如果 A 类调用 B 类,那么 A 类依赖于 B 类,并且箭头应该从 A 指向 B。
如果任何类要保留另一个类的实例,则需要使用实线来指示那。例如,类 A 有类 B 的实例,然后使用带有从 A 到 B 的箭头的实线。
Here are some, of the top of my head:
Try to arrange it like a tree with dependency arrows going top to bottom. It makes it more readable and allows you to see where improvements can be made.
I think you have mixed up arrow direction. If class A makes calls to class B then class A is dependent on class B and arrow should be pointing from A to B.
If any class is going to keep an instance of another class then you need to use solid lines to indicate that. e.g. Class A has an instance of class B then use a solid line with arrow from A to B.
如果您的关系意味着一个类引用另一个类,则通常使用实线。虚线表示较弱的依赖性。
如果您使用 UML 作为文档的一部分,则仅包含感兴趣的类/方法会使 UML 更具可读性。
If your relationships mean that a class references another class, typically solid lines are used. Dotted-lines indicate a weaker dependency.
If you are using UML as part of documentation, including only the classes/methods of interest makes UML much more readable.