Java开发网 |
注册 |
登录 |
帮助 |
搜索 |
排行榜 |
发帖统计
|
您没有登录 |
» Java开发网 » Design Pattern & UML
打印话题 寄给朋友 订阅主题 |
作者 | Aggregation 与 Composition 的区别? |
jameszhang
CJSDN高级会员 发贴: 1594 积分: 111 |
于 2004-11-03 10:08
如题,大家指点 "First they ignore u, then they laugh at u, then they fight u, then u will win Mahatma Gandhi" |
作者 | Re:Aggregation 与 Composition 的区别? [Re:jameszhang] |
floater
Java Jedi 总版主 发贴: 3233 积分: 421 |
于 2004-11-03 12:48
google'd this, the diff is the lifetime. http://www.visualcase.com/kbase/associations.htm The association link indicates that two classes have a relationship: a student attends a school; a student takes courses. Each association link has two ends which are called roles. Each role has a name, a multiplicity, a navigability and a type. Composition indicates that one class belongs to the other. A polygon is made up of several points. If the polygon is destroyed, so are the points. Aggregation is similar to composition, but is a less rigorous way of grouping things. An order is made up of several products, but a product continues to exist even if the order is destroyed. "Any fool can write code that a computer can understand. Good programmers write code that humans can understand." - Martin Fowler, Refactoring - Improving the Design of Existing Code |
作者 | Re:Aggregation 与 Composition 的区别? [Re:jameszhang] |
wes109
以梦为马 CJSDN高级会员 发贴: 857 积分: 60 |
于 2004-11-03 16:24
我觉得这不是代码上的区别 只是概念上的区别 |
作者 | Re:Aggregation 与 Composition 的区别? [Re:jameszhang] |
supertom
发贴: 7 积分: 1 |
于 2004-11-18 09:18
|
已读帖子 新的帖子 被删除的帖子 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |