UML角色名称是否应反映在类属性中? [英] Should UML role names be reflected in class attributes?

查看:73
本文介绍了UML角色名称是否应反映在类属性中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当类与另一个类相关联时,例如链接图像中的Flight(与飞行相关联)具有零个或一个Plane,是否应该将其不反映在类的属性中?也就是说,在此示例中,不应将Flight类别与它的flightNumber,delightTime等旁边有一个AssignedPlane字段...否则,如何说Flight可以知道"其关联的Plane?

When class is associated with another, like Flight in the linked image, which has zero or one Plane associated with it, should this not be reflected in the class' attributes? That is, shouldn't class Flight in this example have an assignedPlane field alongside its flightNumber, departureTime and so on... otherwise how can Flight be said to 'be aware' of its associated Plane?

推荐答案

否.

在图中显示关联等效于具有特定类的属性.如果存在关联(具有角色),则该角色是相应类的属性.

Showing an association in diagram is equivalent to having an attribute of a specific class. If there is an association(with a role) then this role is an attribute of respective Class.

作为参考,请参阅UML 2.5规范的9.5.5节中的图9.12(带有描述).

For reference please see the Figure 9.12 (with description) in section 9.5.5 of UML 2.5 specification.

这篇关于UML角色名称是否应反映在类属性中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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