UML - Class Diagram - Tutorialspoint

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

Class diagram describes the attributes and operations of a class and also the constraints imposed on the system. The class diagrams are widely used in the ... Home CodingGround Jobs Whiteboard Tools Business Teachwithus UMLTutorial UML-Home UML-Overview UML-BuildingBlocks UML-Architecture UML-ModelingTypes UML-BasicNotations UML-StandardDiagrams UML-ClassDiagram UML-ObjectDiagram UML-ComponentDiagram UML-DeploymentDiagram UML-UseCaseDiagram UML-InteractionDiagram UML-StatechartDiagram UML-ActivityDiagram UML-Summary UML2.0Overview UML2.0-Overview UMLUsefulResources UML-UsefulResources UML-KnowledgeTest Utilities UML-Tools&Utilities UML-Discussion SelectedReading UPSCIASExamsNotes Developer'sBestPractices QuestionsandAnswers EffectiveResumeWriting HRInterviewQuestions ComputerGlossary WhoisWho UML-ClassDiagram Advertisements PreviousPage NextPage  UMLOnlineTraining 77Lectures 6.5hours ArnabChakraborty MoreDetail UMLClassDiagrams 37Lectures 2hours FelixTuna MoreDetail Object-OrientedAnalysis,DesignandProgrammingwithUML 122Lectures 10hours PacktPublishing MoreDetail Classdiagramisastaticdiagram.Itrepresentsthestaticviewofanapplication.Classdiagramisnotonlyusedforvisualizing,describing,anddocumentingdifferentaspectsofasystembutalsoforconstructingexecutablecodeofthesoftwareapplication. Classdiagramdescribestheattributesandoperationsofaclassandalsotheconstraints imposedonthesystem.TheclassdiagramsarewidelyusedinthemodelingofobjectorientedsystemsbecausetheyaretheonlyUMLdiagrams,whichcanbemappeddirectlywithobject-orientedlanguages. Classdiagramshowsacollectionofclasses,interfaces,associations,collaborations,and constraints.Itisalsoknownasastructuraldiagram. PurposeofClassDiagrams Thepurposeofclassdiagramistomodelthestaticviewofanapplication.Classdiagramsaretheonlydiagramswhichcanbedirectlymappedwithobject-orientedlanguagesandthuswidelyusedatthetimeofconstruction. UMLdiagramslikeactivitydiagram,sequencediagramcanonlygivethesequenceflowoftheapplication,howeverclassdiagramisabitdifferent.ItisthemostpopularUMLdiagraminthecodercommunity. Thepurposeoftheclassdiagramcanbesummarizedas− Analysisanddesignofthestaticviewofanapplication. Describeresponsibilitiesofasystem. Baseforcomponentanddeploymentdiagrams. Forwardandreverseengineering. HowtoDrawaClassDiagram? ClassdiagramsarethemostpopularUMLdiagramsusedforconstructionofsoftware applications.Itisveryimportanttolearnthedrawingprocedureofclassdiagram. Classdiagramshavealotofpropertiestoconsiderwhiledrawingbutherethediagramwillbeconsideredfromatoplevelview. Classdiagramisbasicallyagraphicalrepresentationofthestaticviewofthesystemandrepresentsdifferentaspectsoftheapplication.Acollectionofclassdiagramsrepresentthewholesystem. Thefollowingpointsshouldberememberedwhiledrawingaclassdiagram− Thenameoftheclassdiagramshouldbemeaningfultodescribetheaspectofthesystem. Eachelementandtheirrelationshipsshouldbeidentifiedinadvance. Responsibility(attributesandmethods)ofeachclassshouldbeclearlyidentified Foreachclass,minimumnumberofpropertiesshouldbespecified,asunnecessarypropertieswillmakethediagramcomplicated. Usenoteswheneverrequiredtodescribesomeaspectofthediagram.Attheendofthedrawingitshouldbeunderstandabletothedeveloper/coder. Finally,beforemakingthefinalversion,thediagramshouldbedrawnonplainpaperandreworkedasmanytimesaspossibletomakeitcorrect. ThefollowingdiagramisanexampleofanOrderSystemofanapplication.Itdescribesaparticularaspectoftheentireapplication. Firstofall,OrderandCustomerareidentifiedasthetwoelementsofthesystem.Theyhaveaone-to-manyrelationshipbecauseacustomercanhavemultipleorders. Orderclassisanabstractclassandithastwoconcreteclasses(inheritancerelationship)SpecialOrderandNormalOrder. ThetwoinheritedclasseshaveallthepropertiesastheOrderclass.Inaddition, theyhaveadditionalfunctionslikedispatch()andreceive(). Thefollowingclassdiagramhasbeendrawnconsideringallthepointsmentionedabove. WheretoUseClassDiagrams? Classdiagramisastaticdiagramanditisusedtomodelthestaticviewofasystem.Thestaticviewdescribesthevocabularyofthesystem. Classdiagramisalsoconsideredasthefoundationforcomponentanddeploymentdiagrams.Classdiagramsarenotonlyusedtovisualizethestaticviewofthesystembuttheyarealsousedtoconstructtheexecutablecodeforforwardandreverseengineering ofanysystem. Generally,UMLdiagramsarenotdirectlymappedwithanyobject-orientedprogramminglanguagesbuttheclassdiagramisanexception. Classdiagramclearlyshowsthemappingwithobject-orientedlanguagessuchasJava,C++,etc.Frompracticalexperience,classdiagramisgenerallyusedforconstructionpurpose. Inanutshellitcanbesaid,classdiagramsareusedfor− Describingthestaticviewofthesystem. Showingthecollaborationamongtheelementsofthestaticview. Describingthefunctionalitiesperformedbythesystem. Constructionofsoftwareapplicationsusingobjectorientedlanguages. PreviousPage PrintPage NextPage  Advertisements



請為這篇文章評分?