UML Composition

文章推薦指數: 80 %
投票人數:10人

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



請為這篇文章評分?