UML Association vs Aggregation vs Composition | EdrawMax
文章推薦指數: 80 %
Aggregations Represented in a UML Diagram ... Aggregation is an association in which the entities are configured together to create a more complex object. A group ... Backtoschool,backontrack!-Upto70%OffandBestPriceGuarantee.Check>> Knowledge UMLAssociationvsAggregationvsComposition KnowitAllaboutAssociation&Aggregation&Composition TwitterShareCopy Linkcopied! UMLdiagramsareahandywayofunderstandingandlinkingbetweenthestructuralorgroupingentities.Goodknowledgeofallthetechnicalitiesandathoroughunderstandingofthelogicalrelationshipconceptsareimportantforexecutingobject-orientedprogramming. UMLhelpsinfiguringouthowoneormorethingsareassociatedwitheachother.ThemostcommontypeofrelationshipisAssociation.Let’shavealookatitindetail. Inthisarticle 01WhatisanAssociationRelationship? 02AggregationvsComposition 03IsCompositionBetterthanAggregation? 04UseEdrawMaxforUMLDiagramCreation WhatisanAssociationRelationship? Inlayman’slanguage,associationrelationshipsaredefinedastherelationshipbetweentwoseparateunits.Thecommonalityissearchedbetweenentitiesandlinksaremadebetweenthem.Theassociationallowsmakinglogicalconnectionsthroughacontinuousreference. AssociationsarerepresentedinaUMLdiagrambyasinglesolidlineconnectingthesameordifferentclasses.Theassociationcanbeshownbetweenone-to-one,one-to-many,many-to-manyclasses.Sinceassociationrelationshipsmarkacommunicationlinkbetweentwoentities,theyshouldnotbeambiguousandlabeledclearly.Thelabelingisfollowedbyasmallarrowheadforabetterunderstandingoftherelationship. Asseenintheexamplepicturebelowtheassociationrelationshipisrepresentedbetweenabankanditsemploy.Multiplesolidlinesoriginatefromthemainclass,i.e:bank,thisdiagramshowsaone-to-manyassociationrelationship. GeneralizationVSAssociation Asthenamesuggests,generalizationisawayofclassifyingsimilarobjectsinamoregeneralizedmanner.Theentitiesshowaparent-childrelationshipbetweenageneralentityandauniqueonewiththelatterbeingaspecializedformofthegeneralclass.Incomparison,theassociationlinksdifferententitiesandrepresentshowoneclassusesthefunctionalityoftheotherlinkedobject. Thegeneralizationrepresentsthe‘kind-of’relationships,whiletheassociationhelpsshowthe‘has-a’relationship.Thismeansthatgeneralizationislinkedwithdisplayingtheinheritanceswhiletheassociationshowsthelinkingbasedoncommonalities. EdrawMax All-in-OneDiagramSoftware Createmorethan280typesofdiagramseffortlessly Startdiagrammingwithvarioustemplatesandsymbolseasily Superiorfilecompatibility:Importandexportdrawingstovariousfileformats,suchasVisio Cross-platformsupported(Windows,Mac,Linux,Web) TRYITFREE SecurityVerified|SwitchtoMac>> TRYITFREE SecurityVerified|SwitchtoLinux>> TRYITFREE SecurityVerified|SwitchtoWindows>> TypesofAssociationRelationships Dependingonthelinking,theassociationisfurtherdividedintofourmaintypes.Itisclassifiedasbelow: 1. Multiplicity Multiplicityassociationreferstocaseswhenalinkedclassappearsmultipletimes.Insteadofrestatingtheentity,wespecifythemaximumandminimuminstancesthatitcanbelinked.Therefore,insuchrelationships,wemarkanasteriskwiththeassociationline.Theasteriskrepresentsanintermediatedmaximum. Theimagebelowassistsinunderstandinghowmultiplicitycanbeexpressedindifferentcircumstances. Source:www.cems.uwe.ac.uk/ 2. DirectedAssociation Asthenameindicated,directedassociationreferstothedirectionofcommunicationflowwithinanassociationrelationship.Bydefault,theassociationrelationshipsarenavigablebilaterally;however,thedirectedassociationhelpsindirectingtheflowinonedirectiononly.Thedirectedassociationisrepresentedbyapresenceofasolidlinewithanarrowhead. Here,aunidirectionalassociationisshownbetweenaserverandtheclient.Thearrow’sdirectionshowsthataservercanprocesstherequestsofaclient. 3. ReflexiveAssociation Thereflexiveassociationisdescribedastherelationshipbetweentheinstancesofthesameclass.Suchanassociationisfurtherclassifiedintotwotypes:SymmetricalandAsymmetricalAssociationReflex.Thereisnospecificsymbolallottedtoit;however,therelationpointsbacktothesameclass. AggregationVSComposition AggregationandCompositionaretwosubsetsofassociation;however,thecompositionisafurthersubsetoftheaggregationrelationship.Insimplewords,aggregationcanbedefinedaswhentheobjectsofoneclasscanaccesstheentitiesofanotherclass.Whereasthecompositionrepresentsabilateralrelationshipandtheobjectispartofonlyonecompositeatatime. AggregationsRepresentedinaUMLDiagram Aggregationisanassociationinwhichtheentitiesareconfiguredtogethertocreateamorecomplexobject.Agroupofobjectsandtheircommonlinkingisdescribedthroughit.Itdefinesasinglepointofcontrol,calledtheaggregateandthegroupofobjectsrepresentingtheassembly. InaUMLdiagram,thedataflowsfromtheaggregate(parentclass)towardstheassembly(childclass)withadiamondshape(unfilled)neartheformerclass.Thepartclassifier,ortheassemblyentities,canbelinkedtomorethanoneaggregateandexistindependently. Thisexampleshowsthatthecaralwaysneedsawheelandanenginetoworkcorrectly,whereastheengineandwheeldonotalwaysneedacar.Theycanbeusedwithabus,abike,machines,lawnmower,andmuchmore.Similarly,theengineisnecessaryforanengineinspection,buttheenginecanexistasanindependententityandbeassociatedwithothervehiclesaswell. CompositionsRepresentedinaUMLDiagram Compositionsarealsoatypeofassociationrepresentingatwo-way,highlydependantrelationshipbetweentwodifferentclasses.Ifthecompositeisdeleted,theotherentitieslinkedwithitarealsodeleted. Itdepictsdependencybetweentheparentandchild.InaUMLdiagram,drawalinebetweentheparentandchildclasswithafilleddiamondshapeneartheparentclass. Asillustratedinthisexample,apersonhaslegs,aheart,andabrain.Ifthefocalpointofthisdiagram,thepersonishurtandkilled,allthecompositeentitieswillalsobediscarded.Unlikeaggregation,theentitiescannotexistindependentlyandarea‘partof’theperson. Aggregation Composition Asubsetofassociation Asubsetofaggregation. Aweaktypeofassociation. Astrongtypeofassociation Linkedobjectsareindependentofeachother. Linkedobjectsarehighlydependantoneachother. Representedwithasolidlineandanemptyarrowhead. Representedbyasolidlinewithafilledarrowhead. Aggregationisdefinedasa‘has-a’relationship. Compositionisdefinedasa‘part-of’relationship. IsCompositionBetterthanAggregation? Compositionisstrongerthanaggregation.Arelationshipbetweentwoobjectsiscitedasanassociation,andbothofthesetermsareasub-typeofit. Iftwoobjectsexistindependentlyofeachotheranddonotimplyanyownershipofeachother,theyarereferredtoastheaggregationassociation.However,iftwoobjectsinasystemneedtocoexistanddependoneachother,theyarelabeledascomposition.Suchanassociationistermed‘strong’sincewhentheowningobjectisdestroyed,soarethelinkedobjects.Onthecontrary,aggregationrepresentsaweakassociationbecausethelifeofthecontainedobjectdoesnotdependonthecontainerobject. UseEdrawMaxforUMLDiagramCreation Associationisthemostbasicyetthemostimportanttypeoflinkingrelationshipthatallowsyoutoconnectobjectsofasystem.Itisessentialthatwedifferentiatebetweenitstwotypes,aggregation,andcomposition,foranerror-freeimplementationandthecreationoftheirUMLdiagrams. CreatingtheUMLdiagramsforassociationissuper-easyifyouhaveauser-friendlyandtoolabundantsoftwarelikeEdrawMax.Withanextensiverangeofeditingtools,ahighlycustomizablelibrary,andmultipletemplateoptionscreatingagoodUMLinjustafewclicksisjustafive-fingerthing.Whetheryouareanewbieortech-savvy,understandingandhandlingthesoftwareissuper-easy.Downloadittostartcreatingthemostmeaningfulandinnovativediagramsinjustago! FreeDownload FreeDownload FreeDownload RelatedArticles WhatisaMoodBoard? Cat5WiringDiagram:ACompleteTutorial AlternatorWiringDiagram:ACompleteTutorial DoorbellWiringDiagram:ACompleteTutorial 3WaySwitchWiringDiagram:ACompleteTutorial CreateaUMLDiagramwithEdrawMax. FreeDownload FreeDownload FreeDownload PopularNow FlowchartSymbolsandTheirUsage ACompleteGuideforPersonalSWOTAnalysiswithExamples BasicElectricalSymbolsandTheirMeanings 7BestElectricalDrawingSoftwarein2021 FreeMindMapSoftware WondershareMindMasterHasNowBeenRebrandedAsWondershareEdrawMind HowCanEdrawMaxAddValueToYourWork? What'saProgramFlowchart?|Definition&Examples ExplainAlgorithmandFlowchartwithExamples
延伸文章資訊
- 1Aggregation relationships in UML models - IBM
In UML models, an aggregation relationship shows a classifier as a part of or subordinate to anot...
- 2【UML】Class Diagram 類別圖(下):Relationships 關係
Relationships 關係. Instance-level 物件層級. Dependency 依賴; Association 關聯; Aggregation 聚合; Composition...
- 3軟體路上不孤單Day17-UML介紹2-關係(1) - iT 邦幫忙
今天就是要跟大家介紹圖形與圖形之間的關係! 接下來要幫大家介紹的是:. Shared aggregation; Composite aggregation; Association; Gener...
- 4UML Association vs Aggregation vs Composition - Javatpoint
Aggregation is a subset of association, is a collection of different things. It represents has a ...
- 5UML Composition
UML composite aggregation (composition) relationship means that at most one composite object has ...