UML Association vs Aggregation vs Composition | EdrawMax

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

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



請為這篇文章評分?