UML基本架構建模--給關聯建模時的注意事項



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只顯示那些有助於理解一個事物的特定羣組的關係.應避免多餘的關係(尤其是累贅的聯合).

 

 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章