欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
[讀書(shū)筆記](méi)UML基本概念---Representing Relationships - ...
 

Representing Relationships

UML and Java may be languages for software development, but they exist in different planes of reality.  UML occupies the visual world, whereas Java is textual in nature. 

UML is also richer than Java in the sense that it offers more abstract and powerful ways of expressing a particular concept or relationship.  However, there is generally only one way to represent that concept or relationship in the Java language.

 

1.     Inheritance

The UML concept of generalization is analogous to inheritance in Java.  Generalization maps directly to the extends keyword and is shown visually via a line with a triangle at the end nearest the super class.

 

 

2.     Realization

In Java, a class may implement one or more interfaces.  The Java keyword implements maps to the concept of realization in UML.

 

 

3.     Dependency

Anytime a class uses another class in some fashion, a dependency exists between the two (classes---add by Fitzwilliam,也就是說(shuō),dependency類(lèi)之間的關(guān)系). 

In the UML, a dependency is shown via a dotted line with an arrow touching the class that is causing the dependency.

A dependency exists if a class:

l         Has a local variable based on another class

l         Has a reference to an object directly

l         Has a reference to an object indirectly, for example, via some operation parameters

l         Uses a class’s static operation

 

Dependency relationships also exist between packages containing classes that are related.  Dependencies between packages are shown via a dotted line with an arrowhead. 

 

 

4.     Association

Conceptually, an association between two classes signifies that some sort of structural relationship exists between the classes. 

 

 

1)     Unidirectional Association

Unidirectional association is shown with an arrow on a simple line’s end.

A unidirectional association implies that an object (not a class--- add by Fitzwilliam) of the class from which the arrow is originating may invoke methods on the class towards which the arrow is pointing.  In Java, this manifests itself as an instance variable on the class that may invoke methods.

 

2)     Bi-directional Association

Bi-directional association is shown with a simple line.

A bi-directional association simply means that either object in the association may invoke methods on the other.  In Java, this results in an instance variable on each class based on the type of the other class.

 

 

Each end of the association is a role in UML terminology and may be named.

 

注:原書(shū)的圖如下圖所示,但是我用的軟件(JUDE)畫(huà)出的效果如上圖所示,我認為都可以。軟件的區別,注意一下。

 

 

Multiplicity

Of course, objects in a class may have multiple associations with objects in another class.

In terms of Java implementation, multiplicity manifests itself as a multivalued instance variable.

 

注:同上所注

3)     Aggregation

Aggregation is a stronger form of association (this also means it is still an association---add by Fitzwilliam).  It is used to show a logical containment relationship, that is, a whole formed of parts.  Although the parts may exist independently of the whole (different from composition here---add by Fitzwilliam), their existence is primarily to form the whole.

Aggregation is modeled as an association with a hollow diamond at the class forming the whole.  In terms of implementation in Java, an aggregation maps to instance variables on a class.

Unlike association instances, instances of an aggregation cannot have cyclic links.  That is, an object may not directly or indirectly be part of itself.  For example, if an instance of A aggregates an instance of B, then that instance of B cannot itself aggregate that same instance of A.

In general, unless you believe that using aggregation adds value or clarifies something, you should use association or composition.

 

4)     Composition

Composition is another form of association and is similar to aggregation to some degree.  However, it is less ambiguous.

Composition is appropriate for modeling situations that call for physical containment.  It implies a much stronger whole-part coupling between the participants such that parts cannot exist without the whole.  That is, parts are share the life cycle of the whole.  They are created when the whole comes to life and destroyed when the whole ceases to exist.

Composition is shown in the same way as aggregation except that the diamond is filled in.

 

5)     Reflexive Relationships

A class may have an association with itself.  For example, if a person employs another person, the Person class may have an association with itself with the role names of employer and employee.  Such a relationship is called a reflexive relationship.

This notation can be considered a modeling shorthand.  Only one class icon rather than two is used to illustrate the relation.  It would be perfectly acceptable to show two separate Person icons with the relation drawn between them.  However, to do so consumes space on a diagram.

 

 

 

 

 

 

 補注1:

關(guān)聯(lián)關(guān)系(association)描述了給定類(lèi)的對象個(gè)體之間的語(yǔ)義連接。關(guān)聯(lián)提供了不同交互對象間的連接。剩余的關(guān)系則相關(guān)于分類(lèi)本身的描述,而非它們的實(shí)例。

摘自:The Unified Modeling Language Reference Manual

By James Rumbaugh, Ivar Jacobson, Grady Booch

Interpreted by Adams Wang

所以說(shuō),如果沒(méi)有對象,那么就沒(méi)有關(guān)聯(lián)關(guān)系。在程序中,如果只是調用了類(lèi)的靜態(tài)方法,而沒(méi)有產(chǎn)生這個(gè)類(lèi)的實(shí)例,那么這兩個(gè)類(lèi)的對象之間就沒(méi)有關(guān)聯(lián)關(guān)系。但是這兩個(gè)類(lèi)之間是有依賴(lài)關(guān)系的。

 



Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=668050

本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
UML Class Diagram Explained With C++ samples | CPP Code Tips
UML Association
Association, Composition and Aggregation in UI5, CRM, S/4HANA and C4C
Class Diagram Relationships UML | Examples Relationships Class Diagram
C++基礎
從PowerDesigner概念設計模型(CDM)中的3種實(shí)體關(guān)系說(shuō)起 - 北溟有瑜,其名為琨 - 博客園
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久