UML Composition
文章推薦指數: 80 %
UML composite aggregation (composition) relationship means that at most one composite object has responsibility for the existence and storage of the ... UMLComposition Compositeaggregation(composition)isa"strong"form ofaggregation withthefollowingcharacteristics: itisbinaryassociation, itisawhole/partrelationship, apartcouldbeincludedinatmostonecomposite(whole)atatime,and ifacomposite(whole)isdeleted,allofitscompositepartsare"normally"deletedwithit. Note,thatUMLdoesnotdefinehow,whenandspecificorderinwhichpartsofthecompositearecreated. Also,insomecasesapartcanberemovedfromacompositebeforethecompositeisdeleted, andsoisnotnecessarilydeletedaspartofthecomposite. Notation Compositeaggregationisdepictedasabinaryassociationdecoratedwithafilledblackdiamond attheaggregate(whole)end. Foldercouldcontainmanyfiles,whileeachFilehasexactlyoneFolderparent. IfFolderisdeleted,allcontainedFilesaredeletedaswell. Whencompositionisusedindomainmodels,bothwhole/partrelationshipaswell aseventofcomposite"deletion"shouldbeinterpretedfiguratively, notnecessarilyasphysicalcontainmentand/ortermination. UMLspecificationneedstobeupdatedtoexplicitlyallowthisinterpretation. Hospitalhas1ormoreDepartments,and eachDepartmentbelongstoexactlyoneHospital. IfHospitalisclosed,soareallofitsDepartments. Note,thatthoughitseemsodd,multiplicityofthecomposite(whole)couldbespecifiedas 0..1("atmostone")whichmeansthatpartisallowedtobea"standalone", notownedbyanyspecificcomposite. EachDepartmenthassomeStaff,andeachStaffcouldbe amemberofoneDepartment(ornone).IfDepartmentisclosed, itsStaffisrelieved(butexcludingthe"standalone"Staff). Mistakes Compositionisasymmetricrelationship-onlyoneendofassociation isallowedtobemarkedassharedorcompositeaggregation. BothUML1.xand2.xdon'tallowadiamondtobeattachedtobothendsofassociationline. Generalization
延伸文章資訊
- 1UML Composition
UML composite aggregation (composition) relationship means that at most one composite object has ...
- 2UML類別圖:Aggregation vs. Composition - 自學程式誌
Aggregation. 圖三. Aggregation範例。左邊:類別圖右邊:原始碼 ...
- 3UML Association vs Aggregation vs Composition
Aggregation implies a relationship where the child can exist independently of the parent. Example...
- 4Aggregation relationships in UML models - IBM
In UML models, an aggregation relationship shows a classifier as a part of or subordinate to anot...
- 5軟體路上不孤單Day17-UML介紹2-關係(1) - iT 邦幫忙
今天就是要跟大家介紹圖形與圖形之間的關係! 接下來要幫大家介紹的是:. Shared aggregation; Composite aggregation; Association; Gener...