UML符号 - 链路聚合/组合物VS"香草"协会 [英] UML Notation - Aggregations/Compositions vs "Vanilla" Associations

查看:154
本文介绍了UML符号 - 链路聚合/组合物VS"香草"协会的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近花了很多时间一个很好的协议执行,我写的,因为不同的软件组件的详细UML设计。回顾我所最近完成的和比较,要当我第一次听说UML,我看到,我现在几乎严格使用聚合和组合关系,几乎已经放弃了香草非定向/导演关系。我依然当然使用推广和实现,但这些都是除上述明显不同,并没有考虑过这个问题的一部分。

I've recently spent a good deal of time performing detailed UML designs of various SW components that I have since written. Looking back on what I have recently finished and comparing that to when I first learned UML, I see that I now almost strictly use Aggregation and Composition relationships, and have virtually abandoned "vanilla" non-directed/directed relationships. I still of course use Generalizations and Realizations, but these are distinctly different than those above and are not considered part of this question.

在我看来,那汇聚/作曲意味着香草协会,以及更多的含义相同。聚合和组合自然意味着一个方向,任何现代UML程序仍然会允许你在一个聚合/组合关系定义多重性和应用动词的关系为好。在这一点上,我看不出有什么目的香草协会。

It seems to me that Aggregation/Composition implies the same meaning of "vanilla" associations, and more. Aggregation and Composition naturally imply a direction, and any modern UML program will still allow you to define multiplicity on an Aggregation/Composition relationship and apply a verb to the relationship as well. At that point, I see little purpose to vanilla associations.

我理解一些人很难理解聚合和组合之间的差异。早期,我有一点很难把握它们的区别,我认为,混乱是我用香草协会的部分原因。我在点现在在哪里我看到很少或没有使用了香草协会,居然不喜欢看到他们作为我相信他们留下一些东西的问题(特别是两个对象之间的强或弱周期的关系)。我相信香草协会的唯一实际使用时尚不发达您手头的问题的了解足以确定聚合和组合之间的生命周期不同。在这种情况下,最好是ATLEAST的显示的这种关系的存在,然后你可以回来,并相应地更改它,当你有一个更好的了解手头上的问题。

I understand some people have difficulty understanding the difference between Aggregation and Composition. Early on, I had a bit of difficult grasping how they differ, and I believe that confusion was part of the reason I used vanilla associations. I'm at the point now where I see little or no use for vanilla associations, and actually dislike seeing them used as I believe they leave some things up for question (particularly a strong or weak lifecycle relationship between two objects). I believe vanilla associations' only practical use is when your understanding of the problem at hand isn't yet developed enough to determine the life cycle difference between aggregation and composition. In such a case it is better to atleast show that the relationship exists and you can then come back and change it appropriately when you have a better understanding of the problem at hand.

长话短说,我相信绝大多数人使用的香草协会的时候,他们可以更准确地描述为一个聚集,有时组成。我是可怕的错误在我的信念?我缺少的东西吗?说给我听听!

Long story short, I believe the vast majority of the time that people use vanilla associations, they could be more accurately described as an aggregation, and sometimes as a composition. Am I terribly wrong in my belief? Am I missing something? Let me hear it!

推荐答案

您已经击中头部,当你说的香草协会的唯一实际使用是当你手头上的问题的理解还不是足够的发展来确定生命周期的差异的和的表明关系存在,然后你就可以回来,并相应地更改它,当你手头有一个更好的了解这个问题的

You have hit on the head when you say, 'vanilla associations' only practical use is when your understanding of the problem at hand isn't yet developed enough to determine the life cycle difference and show that the relationship exists and you can then come back and change it appropriately when you have a better understanding of the problem at hand.

借助 UML元模型聚合和组合定义为协会的延伸。一个关联可以被认为域对象之间未精制的关系,以同样的方式,一个域对象是一种粗级。我通常在域建模阶段使用简单的协会,它提炼成组成或者聚集在适当的时候我解决了详细的类模型。

The UML Meta-Model defines Aggregation and Composition as extensions of Association. An Association can be considered an unrefined relationship between domain objects, in the same way that a Domain object is an unrefined Class. I typically use simple Associations at the Domain Modelling stage and refine it into either Composition or Aggregation as appropriate when I resolve the detailed Class Model.

这篇关于UML符号 - 链路聚合/组合物VS"香草"协会的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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