UML Association vs Aggregation vs Composition - Javatpoint

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

Aggregation is a subset of association, is a collection of different things. It represents has a relationship. It is more specific than an association. It ... ⇧SCROLLTOTOP Home Java UML Pandas Python Java SQL Android Cloud JavaScript Servlet JSP Struts2 Spring Quiz Projects InterviewQ Comment Forum Training UMLTutorial UMLTutorial UMLBuildingBlocks UMLArchitecture UMLDiagrams UMLRelationship AssociationvsAggregationvsComposition UMLAssociation UMLDependency UMLGeneralization UMLRealization UMLClassDiagram UMLObjectDiagram UMLComponentDiagram UMLDeploymentDiagram UMLInteractionDiagram UMLUseCaseDiagram UMLSequenceDiagram UMLCollaborationDiagram UMLStateMachineDiagram UMLActivityDiagram UMLTimingDiagram UMLTools next→ ←prev UMLAssociationvs.Aggregationvs.Composition InUMLdiagrams,relationshipsareusedtolinkseveralthings.Itisaconnectionbetweenstructural,behavioral,orgroupingthings.FollowingarethestandardUMLrelationshipsenlistedbelow: Association Dependency Generalization Realization Association Associationrelationshipisastructuralrelationshipinwhichdifferentobjectsarelinkedwithinthesystem.Itexhibitsabinaryrelationshipbetweentheobjectsrepresentinganactivity.Itdepictstherelationshipbetweenobjects,suchasateacher,canbeassociatedwithmultipleteachers. Itisrepresentedbyalinebetweentheclassesfollowedbyanarrowthatnavigatesthedirection,andwhenthearrowisonbothsides,itisthencalledabidirectionalassociation.Wecanspecifythemultiplicityofanassociationbyaddingtheadornmentsonthelinethatwilldenotetheassociation. Example: 1)Asingleteacherhasmultiplestudents. 2)Asinglestudentcanassociatewithmanyteachers. Thecompositionandaggregationaretwosubsetsofassociation.Inbothofthecases,theobjectofoneclassisownedbytheobjectofanotherclass;theonlydifferenceisthatincomposition,thechilddoesnotexistindependentlyofitsparent,whereasinaggregation,thechildisnotdependentonitsparenti.e.,standalone.Anaggregationisaspecialformofassociation,andcompositionisthespecialformofaggregation. Aggregation Aggregationisasubsetofassociation,isacollectionofdifferentthings.Itrepresentshasarelationship.Itismorespecificthananassociation.Itdescribesapart-wholeorpart-ofrelationship.Itisabinaryassociation,i.e.,itonlyinvolvestwoclasses.Itisakindofrelationshipinwhichthechildisindependentofitsparent. Forexample: Hereweareconsideringacarandawheelexample.Acarcannotmovewithoutawheel.Butthewheelcanbeindependentlyusedwiththebike,scooter,cycle,oranyothervehicle.Thewheelobjectcanexistwithoutthecarobject,whichprovestobeanaggregationrelationship. Composition Thecompositionisapartofaggregation,anditportraysthewhole-partrelationship.Itdepictsdependencybetweenacomposite(parent)anditsparts(children),whichmeansthatifthecompositeisdiscarded,sowillitspartsgetdeleted.Itexistsbetweensimilarobjects. Asyoucanseefromtheexamplegivenbelow,thecompositionassociationrelationshipconnectsthePersonclasswithBrainclass,Heartclass,andLegsclass.Ifthepersonisdestroyed,thebrain,heart,andlegswillalsogetdiscarded. Associationvs.Aggregationvs.Composition Association Aggregation Composition Associationrelationshipisrepresentedusinganarrow. Aggregationrelationshipisrepresentedbyastraightlinewithanemptydiamondatoneend. Thecompositionrelationshipisrepresentedbyastraightlinewithablackdiamondatoneend. InUML,itcanexistbetweentwoormoreclasses. Itisapartoftheassociationrelationship. Itisapartoftheaggregationrelationship. Itincorporatesone-to-one,one-to-many,many-to-one,andmany-to-manyassociationbetweentheclasses. Itexhibitsakindofweakrelationship. Itexhibitsastrongtypeofrelationship. Itcanassociateonemoreobjectstogether. Inanaggregationrelationship,theassociatedobjectsexistindependentlywithinthescopeofthesystem. Inacompositionrelationship,theassociatedobjectscannotexistindependentlywithinthescopeofthesystem. Inthis,objectsarelinkedtogether. Inthis,thelinkedobjectsareindependentofeachother. Herethelinkedobjectsaredependentoneachother. Itmayormaynotaffecttheotherassociatedelementifoneelementisdeleted. Deletingoneelementintheaggregationrelationshipdoesnotaffectotherassociatedelements. Itaffectstheotherelementifoneofitsassociatedelementisdeleted. Example:Atutorcanassociatewithmultiplestudents,oronestudentcanassociatewithmultipleteachers. Example:Acarneedsawheelforitsproperfunctioning,butitmaynotrequirethesamewheel.Itmayfunctionwithanotherwheelaswell. Example:Ifafileisplacedinafolderandthatisfolderisdeleted.Thefileresidinginsidethatfolderwillalsogetdeletedatthetimeoffolderdeletion. NextTopicUMLAssociation ←prev next→ ForVideosJoinOurYoutubeChannel:JoinNow Feedback SendyourFeedbackto[email protected] HelpOthers,PleaseShare LearnLatestTutorials Splunk SPSS Swagger Transact-SQL Tumblr ReactJS Regex ReinforcementLearning RProgramming RxJS ReactNative PythonDesignPatterns PythonPillow PythonTurtle Keras Preparation Aptitude Reasoning VerbalAbility InterviewQuestions CompanyQuestions TrendingTechnologies ArtificialIntelligence AWS Selenium CloudComputing Hadoop ReactJS DataScience Angular7 Blockchain Git MachineLearning DevOps B.Tech/MCA DBMS DataStructures DAA OperatingSystem ComputerNetwork CompilerDesign ComputerOrganization DiscreteMathematics EthicalHacking ComputerGraphics SoftwareEngineering WebTechnology CyberSecurity Automata CProgramming C++ Java .Net Python Programs ControlSystem DataMining DataWarehouse JavatpointServicesJavaTpointofferstoomanyhighqualityservices.Mailuson[email protected],togetmoreinformationaboutgivenservices.WebsiteDesigningWebsiteDevelopmentJavaDevelopmentPHPDevelopmentWordPressGraphicDesigningLogoDigitalMarketingOnPageandOffPageSEOPPCContentDevelopmentCorporateTrainingClassroomandOnlineTrainingDataEntryTrainingForCollegeCampusJavaTpointofferscollegecampustrainingonCoreJava,AdvanceJava,.Net,Android,Hadoop,PHP,WebTechnologyandPython.Pleasemailyourrequirementat[email protected]Duration:1weekto2weekLike/Subscribeusforlatestupdatesornewsletter



請為這篇文章評分?