帮助快速解决 UML 混淆问题
我想知道如果我有一个包含一个 TicketType 的 Ticket,但一个 Ticket 类型可以是多个 Ticket 的一部分,那会是什么情况。
该关系是聚合(其中空心菱形位于 Ticket 类)还是关联(其中箭头指向 TicketType)?
I want to know what it would be if I had a Ticket that holds one TicketType but a ticket type can be part of many Tickets.
Would the relationship be an Aggregation, where the open diamond is at the Ticket class, or is it an association where the arrow is pointing to the TicketType?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的第一个想法是“谁在乎呢?”您正在尝试为自己或其他开发人员表达两个对象之间的关系。你甚至无法清楚地表达出其中的区别;其他人能够做到这一点的机会有多大?
与开放菱形的关联表示票证拥有票证类型,但如果票证消失,该类型不会被删除。
我不确定除了简单的关联箭头之外,这还提供了哪些附加信息。
我认为重要的是不要太沉迷于这些事情。不要对 UML 太着迷。
My first thought was "Who cares?" You're trying to express a relationship between two objects for yourself or other developers. You can't even articulate the difference; what are the chances that others will be able to do it?
The association with open diamond says the Ticket owns a TicketType, but the type isn't deleted if the Ticket goes away.
I'm not sure what additional information this provides over and above the simple arrow for association.
I think it's important not to be too hung up on these things. Don't get too carried away with UML.