- Association
(1)擁有自己的生命周期(LifeTime)
(2)物件本身並沒有Owner的觀念
(3)物件為各自獨立關係(independent)
(4)UML表示圖為單一箭頭 - Aggregation
(1)擁有自己的生命周期(LifeTime)
(2)擁有Owner(例如:"Manager" object will own "Workers" object.)
(3)
(4)UML表示圖為空心菱形 - Composition
(1)若Owner生命週期結束,則另一方也結束
(2)擁有Owner
(3)關係為緊密相依(dependent)
(4)UML表示圖為實心菱形
關係請參考下列圖例:(擷取自3 Important Concepts: - Association, Aggregation and Composition)
關係表:
Association
|
Aggregation
|
Composition
| |
Owner
|
No Owner
|
Single owner
|
Single Owner
|
Life time
|
Have their own life time.
|
Have their own life time.
|
Owners life time
|
Child object
|
No Child objects all are independent
|
Child objects belong to single parent.
|
Child objects belong to single parent.
|
沒有留言:
張貼留言