Association, Aggregation, Composition
来源:互联网 发布:网站seo技巧 编辑:程序博客网 时间:2024/04/27 07:32
Association, Aggregation, Composition
When we have only one relationship between objects, that is called Association. Aggregation and Composition both are specialized form of Association. Composition is again specialize form of Aggregation.
Association is a relationship where all object have their own lifecycle and there is no owner. Let’s take an example of Teacher and Student. Multiple students can associate with single teacher and single student can associate with multiple teachers but there is no ownership between the objects and both have their own lifecycle. Both can create and delete independently.
Aggregation is a specialize form of Association where all object have their own lifecycle but there is ownership and child object can not belongs to another parent object. Let’s take an example of Department and teacher. A single teacher can not belongs to multiple departments, but if we delete the department teacher object will not destroy. We can think about “has-a” relationship.
Composition is again specialize form of Aggregation and we can call this as a “death” relationship. It is a strong type of Aggregation. Child object dose not have their lifecycle and if parent object deletes all child object will also be deleted. Let’s take again an example of relationship between House and rooms. House can contain multiple rooms there is no independent life of room and any room can not belongs to two different house if we delete the house room will automatically delete. Let’s take another example relationship between Questions and options. Single questions can have multiple options and option can not belong to multiple questions. If we delete questions options will automatically delete.
In next post I’ll try to define how they are represent in UML.
Feel free to post your comments and I hope your post will helps to understand better for me and as well as others.
http://geekswithblogs.net/mahesh/archive/2006/11/03/95960.aspx
- Association, Aggregation, Composition
- association & composition & aggregation & generalization
- ODX - Aggregation, Composition, Association
- association,aggregation,composition有什麼差別?
- association,aggregation,composition,dependency
- association,aggregation,composition差别
- [转]association,aggregation, composition 区别
- Understanding Association, Aggregation, and Composition
- association中aggregation和composition说明
- association中aggregation和composition说明
- Association, Aggregation, Composition, Abstraction, Generalization, Realization, Dependency
- Association, Aggregation, Composition, Abstraction, Generalization, Realization, Dependency
- UML Dependency Association Aggregation Composition Generalization Realization
- association中aggregation和composition说明
- 设计模式之composition,association和aggregation
- Association, Aggregation, Composition, Abstraction, Generalization, Realization, Dependency
- UML的关联(Association), 聚合(Aggregation), 组合(Composition)区别
- 面向对象编程中Association、Aggregation和Composition的区别
- 将DataGrid中的数据导出为Excel的方法
- VC调试篇
- Notes.ini参数索引
- blog索引
- 经典名言
- Association, Aggregation, Composition
- 在ls中列出文件的绝对路径
- SQL2005中大数据量检索的分页
- 项目经理
- Linux(posix) 系统下压力测试工具stress.
- C# 将数据导出到Execl汇总(很全面)
- cygwin.reg
- 创建d3d设备只有一个组合
- Camera: Brew中的龙潭虎穴