UML Extension

Classes Relationship in UML

Association

"Association" on behelf of the reference between Class A and Class B.  Association allows one class to know the methods and attributes of referenced class.

Normally, referenced Class is attribute of host Class.

One-direction asscociation:

Class A know methods and attributes of Class B, but class B does not know the existing of Class A.

Bi-direction asscociation:

Both Class A and Class B know methods and attributes of each other.

 

Dependance and Association

"Dependance" is another kind of "Association",  the difference is that:

 

  • The referenced Class in Dependance is not global level filed/attribute/property of host Class.

 

Aggregation and Composition

"Aggregation" and "Composition" descript a relationship between "Entire" object and its "Sub Elements":

 

  • The "Entire" is a composite of all the sub elements.

Difference between Aggregation and Composition

  • Composition manage the life cycle of sub-elements: Sub-Elements initialized along with Entire Objet initialization and they are cleaned along with Entire Objet destroied.
  • "Entire" part in Aggregation do not manage the life cycle of "sub-elements" part.

Aggregation and Association

Referenced Class/Classes in both Aggregation and Association are implemented as class' attributes. The atttibute could even be implemented as a collection:

Car.java:

List<Wheel> wheels;

People.java:

List<Car> car;

 

We can say: car is aggregated by wheels. But we cannot say People is composited by cars.

 

 

 

UML in my projects

Descript how I use UML in every day's development.

To Be updated.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值