您的位置:首页 > 运维架构 > 网站架构

UML基本架构建模--给关联建模时的注意事项

2015-01-30 18:00 274 查看


When you model relationships in the UML,
lUse dependencies only when the relationship you
are modeling is not structural.
lUse generalization only when you have an
“is-a-kind-of”
relationship; multiple inheritance can often be replaced with aggregation.
lBeware of introducing cyclical generalization
relationships.
lKeep your generalization relationships generally
balanced; inheritance lattices should not be too deep ( more than five levels or so should be questioned ) nor too wide ( instead, look for the possibility of intermediate abstract classes ).
lUse associations primarily where there are structural
relationships among objects. Do not use them to show transient relationships such as parameters or local variables of procedures.

当你在UML中构建关系模型时,
l当你所建的关系模型不是结构型的才能使用依赖.
l当你有一个”是一个种类”的关系时使用泛化;多重继承通常被聚合替换.
l当心引进循环泛化关系.
l让你的泛化关系总体上保持平衡;继承框架不能太深(超过五层左右应该仔细斟酌)也不能太宽(相反,找中间抽象类的可能性).
l使用联合主要是在对象之间存在结构关系.不要用它们来表现临时的关系,如参数或是过程的局域变量.

When you draw a relationships in the UML,
lUse either rectilinear or oblique lines consistently.
Rectilinear lines give a visual cue that emphasizes the connections among related things all pointing to one common thing. Oblique lines are often more space-efficient in complex diagrams. Using both kinds of lines in one diagram is useful for drawing attention
to different groups of relationships.
lAvoid lines that cross unless absolutely necessary.
lShow only those relationships that are necessary
to understand a particular grouping of things. Superfluous relationships ( especially redundant associations ) should be avoided.
当你在UML中画关系时,
l直线或是斜线在使用上的一致性.直线线条给视觉提示,强调相关事物之间的联系都指向同一个事物.斜线通常在复杂图表中更节省空间.在一个图表中使用这两种线条,绘画过程中注意不同群组的关系是有用的,
l除非迫不得以,否则避免交叉线.
l只显示那些有助于理解一个事物的特定群组的关系.应避免多余的关系(尤其是累赘的联合).
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: