Implement the application specification - UML Designer
文章推薦指數: 80 %
From the existing application UML definition, Bob defines the application at a lower level. ... Define the implementation structure. The class diagram is ... Togglenavigation Overview Download Tutorials Gettingstarted Createproject Createrepresentation Importmodel Openexample UserGuide Dashboard ActivityDiagram ClassDiagram ComponentDiagram CompositeStructureDiagram DeploymentDiagram PackageDiagram ProfileDiagram SequenceDiagram StateMachineDiagram UseCaseDiagram DeveloperGuide Contribute Build Test Release Documentation Documentation Presentation Definethesystem Definetheapplication Implementtheapplication Writetheapplicationdocumentation Refactoranapplication Validateanapplication NonGoals Usage Generators InstallUMLcomponents Support FAQ Implementtheapplicationspecification WhenJohnhasfinishedthespecificationoftheapplication,hegivesittoBob.FromtheexistingapplicationUMLdefinition,Bobdefinestheapplicationatalowerlevel. Atthispoint,Bobbreaksthecomponentsoutintoclassesandobjects. Definetheimplementationstructure Theclassdiagramisusedtodescribethestructureofthesystembyshowingtheclasses,theinterfaces,theirattributes,theiroperationsandtheirrelationships. Theclassdiagramisanunsynchronizeddiagramwhichmeansthattheuserhastoaddexistingelementsmanuallyonthediagramtoseethem. Manageelements Createelement Itispossibletocreateanelementbyselectingthetypecreationtoolfromthepaletteandthenclickingonthediagramoranelement. AdiagramisassociatedtoapackageandwhentheuserclicksonthediagrambackgroundtheelementiscreatedunderthecorrespondingpackageintheUMLmodel. Iftheuserselectsacontainer,theelementwillbecreatedunderthecorrespondingsemanticelementintheUMLmodel. Tooltiptoolsarealsoavailabletocreateanykindofelements.So,youhavetheabilitytocreateelementsinacontextualwayrelatedtothecurrentlyselectedelements. Ifyourpointerisonthediagrambackground,afterafewsecondsyoushouldseethefollowingassistant: Ifyourpointerisonaclasstheassistantwillbe: Creationtoolsareavailableintheclassdiagramforthefollowingtypes: Element Representation Comments Class Representationofobjects Enumeration Adatatypesetofvalues Interface Contractthatimplementersagreetomeet Datatype Allcopiesofaninstanceofadatatypeareconsideredassameinstance Primitivetype Defaultdatatype Package Organizethemodelcontent GenericClass TodefineaGenericClass,usethedirectedittool: TodefineaBinding,usethecreateedgetoolcalled“Binding”fromaClasstoaGenericClass. Youmaynoticethat“?”referstoanundefinedactualtype: Tospecifythebindingassociationfromtheformaltotheactualtypeusealsothedirectedittool: Deleteelement Theusercanalsodeleteanelement(seeDiagrameditor/Editortab-bar/Deleteelement/frommodel). Importingprimitivetypes ThecontextualmenuImportprimitivetypescanimportpredefinedtypeslibrariesfromaright-clickonthebackgroundofaclassdiagram.Thismenuallowstoimportprimitivesfor: UML Java XML Ecore Then,theimportedtypescanbeusedintheproperty’sdefinition. Anotherwaytoimportprimitivetypesisjustbyeditingapropertyonaclass(bytypingdirectlyontheselectedpropertyorbyhittingF2)andtypethewanteddatatype.Ifit’saknowntype,asStringforexample,thecorrespondinglibraryisautomaticallyimported:thislibraryisvisibleinthemodelexplorerwhentheprojectdependenciesentryisexpanded. Thecaseisnottakenintoaccount,soitispossibletotype“string”andthe“String”datatypeofUMLPrimitivetypeslibrarywillbeused. Managefeatures Itispossibletocreateafeaturebyselectingthefeaturecreationtoolfromthepaletteandthenclickingonthediagramoranelement. Iftheuserselectsacontainer,thefeaturewillbecreatedunderthecorrespondingsemanticelementintheUMLmodel. Tooltiptoolsarealsoavailabletocreateanykindoffeatures. Creationtoolsareavailableintheclassdiagramforthefollowingfeatures: property:Canbecreatedunderclasses,interfaces,datatypes,primitivetypes,enumerations. typedproperty:Canbecreatedunderclasses,interfaces,datatypes,primitivetypes,enumerations.Whentheuserselectsacontainer,awizardisopenwhichlistalltheavailabletypesexistingintheemodelingprojectinorderthattheuserselectsatypeforthepropertytocreate. operation:Canbecreatedunderclasses,interfaces,datatypes,primitivetypes,enumerations. literal:Canbecreatedunderenumerations. qualifier:Canbecreatedunderassociationend.Whentheuserselectsanassociation,awizardisopenwhichlisttheendsoftheassociation.Thequalifierwillbecreatedundertheselectedend. Itispossibletoaddandedit: thepropertytype: thankstodirecteditbyspecifyingthetypeas:myProperty:PropertyType.Weaddedafewacceleratorssothatyoucanquicklyeditpropertiesinaclassjustbytypingthelabel.Typing: aNewNamewillupdatetheattributename. aNewName:SomeTypewillupdatetheattributenameandwilllookforthedatatypewiththegivenname.Iffounditwill /someNamewillsettheAttributeasderived. =someValuewillsetthedefaultvalueoftheAttribute. [0..1]willsetthemultiplicityoftheattributeto0forthelowerboundand1fortheupperbound. [0..*]willsetthemultiplicityoftheattributeto0forthelowerboundandunboundedfortheupperbound. fromtheGeneraltabofthepropertiesview theparametersofanoperation: thankstodirecteditbyspecifyingtheparameteras:myOperation(param1:Param1Type,param2:Param2Type) fromParameterstabofthepropertiesview Theusercanalsodeleteafeature(seeDiagrameditor/Editortab-bar/Deleteelement/frommodel). Managerelationships Createrelationships Itispossibletocreatearelationshipbyselectingtheedgecreationtoolfromthepaletteandthenclickingonasourceelementandatargetelement. Thefollowingedgecreationtoolsexistinthepalette: association:isrepresentedbyasolidlinkwithstartandendlabelsandcanbecreatedbetweentwoclasses.Accordingtotheassociationnavigabilityanarrowwillbevisibleatthestartorendofthelink.N-aryassociationwithmorethantwoendsaredrawnedwithadiamondandsolidlinesconnecteachendtothediamond. reference:isrepresentedbyasolidlinkwithstartandendlabelsandcanbecreatedbetweentwoclasses.Accordingtothereferencenavigabilityanarrowwillbevisibleatthestartorendofthelink. composition:isrepresentedbyasolidedgewithfilldiamonddecoratorandwithstartandendlabels,itcanbecreatedbetweentwoclasses.Accordingtothecompositionnavigabilityanarrowwillbevisibleatthestartorendofthelink. aggregation:isrepresentedbyasolidedgewithdiamonddecoratorandwithstartandendlabels,itcanbecreatedbetweentwoclasses.Accordingtotheaggregationnavigabilityanarrowwillbevisibleatthestartorendofthelink. associationclass:isrepresentedbyadashededgewithstartandendlabelsandaclasslinkedtothedashededge,itcanbecreatedbetweentwoclasses. generalization:isrepresentedbyasolidedgewithoutlabel,itcanbecreatedbetweentwoclassifiers(class,interface,datatype,enumeration…). interfacerealization:isrepresentedbyadashededgewithoutlabel,itcanbecreatedbetweenaclassandaninterface. dependency:isrepresentedbyadashededgewithoutlabel,itcanbecreatedbetweenanyclassifiers. usage:isrepresentedbyadashededgewithuseaslabel,itcanbecreatedbetweenanyclassifiers. nestclassifier:isrepresentedbyasolidedgewithanoutputfillclosedarrowatstart,itcanbecreatedbetweenanyclassifiers. Reconnectrelationships Andfinally,hecanreconnectrelationships.Itispossibletoreconnectthesourceandthetargetofanykindofedgeintheactivitydiagram: association composition aggregation associationclass generalization interfacerealization dependency usage nestclassifier SupportforBrokenAssociations ItmighthappenthatforsomereasonyouhaveanAssociationinstanceinyourpackagewhichdoesn’thavetheproperends.Inthatcase theclassdiagramwillshowthebrokenassociationsasnodes: !../images/features/class_pics/brokenassociationsClassDiagram.jpg! YoucanusetheAssociationtoolsinthepalettetore-attachtheAssociationtoaclassifier. Manageexistingelements Asthediagramisunsynchronized,theuserneedstoaddmanuallytheelementsalreadyexistinginthesemanticmodelthatshouldappearontherepresentation. Itispossibletoaddexistingelementsby: selectingtheaddtoolfromthepaletteorthetooltipandthenclickingonthediagramoranelement.Theaddtoolopensaselectionwizard. draganddropinganelementfromthemodelexplorer. Thefollowingelementscanbeaddedonaclassdiagram: class package interface datatype primitivetype enumeration component Theusercanseethatanelementisnotcomingfromthecurrentpackage: theelementborderislighterthantheelementborderofelementsdefinedinthecurrentpackage atooltipshowsthecontainerpackageoftheelementiftheelementisnotcontainedbythecurrentpackage Andfinally,hecanremoveanexistingelementfromadiagram.InthiscasetheelementisonlydeletedfromtherepresentationbutitisnotremovedfromtheUMLmodel.ThisRemovetoolexistsintheExistingelementssectioninthepalette( seeDiagrameditor/Editortab-bar/Deleteelement/frommodel). Addrelatedelements Intheclassdiagramacontextualactionisavailabletoshowonthediagramtheelementrelatedtotheselection. Theaddrelatedelementsactionisavailablefrom: aclass,aninterface,apackage,anenumeration,adatatype,aprimitivetype:showsalltheelementsthatdefinearelationship(dependency,association,composition…)withtheselectedelement aclassdiagram:showsalltheelementscontainedinthepackageassociatedtothediagram. Editlabels Intheclassdiagram,itispossibletoedittheelementslabels( seeDiagrameditor/Editormaingraphicalarea/Directedit).Thisactionsallowstoedit: class,interface,package,enumeration,datatype,primitivetypelabels relationshipslabels UsingUMLincolors UMLincolorsisanobjectmodelingtechniqueproposedbyPeterCoad,EricLefebvre,andJeffDeLucainaseriesofarticlesin1999. AnArchetypeslayerisavailableintheUMLDesignerclassdiagram. Whenthelayerisselected,newtoolsareavailableinthepalette: Themodelingincolorpatternsandstrategiesarebuiltaroundtheideaofclassarchetypes. Itexistsfourdifferentkindofarchetypes: moment-intervalandmi-detail(pink):representsamomentorintervaloftime,allthingsthathappeninthesoftware. role(yellow):representssomething/someonewhoparticipatestomoment-intervals. description(blue):representsacollectionofvaluesakindofcatalog. party,place,orthing(green):representssomeoneorsomethingthatplaysarole. TheDomainNeutralComponent(DNC)isthecommonpatternappliedwiththeUMLincolorstechnique. Tocreateanarchetypeinaclassdiagramjustselectanarchetypefromthepaletteofthetooltip. ThearchetypesarestoredinUMLmodelasstereotypedclasses. Tochangeanexistingclasstoanarchetypejustselectsthetoolfromthepaletteandtheexistingclass.Thestereotypeoftheselectedarchetypeisappliedontheclasswhichiscolored. UMLincolorsexamplesareavailablefromEclipsemenuFile>New>Example…>UML>Umlincolors. FormoredetailedexplanationonUMLincolorshavealooktoPeterCoad’swebsite. Handleconstraints AConstraintisanassertionthatindicatesarestrictionthatmustbesatisfiedbyanyvalidrealizationofthemodelcontainingtheConstraint. AConstraintslayerisavailableintheUMLDesignerclassdiagram. Whenthelayerisselected,newtoolsareavailableinthepalette: Forthemoment,onlythesetypesofValueSpecificationsarehandledforconstraintsintheclassdiagram:Expression,InstanceValue,LiteralBoolean,LiteralInteger,LiteralNull,LiteralReal,LiteralString,LiteralUnlimitedNatural,OpaqueExpression,StringExpression. Duration,DurationInterval,Interval,TimeExpressionandTimeIntervalarenothandledyet. YoucanapplyaConstraintonanydiagramelementexcepttheRelationships.Itisnothandledyet. Instanciatetheapplication Thisdiagramisnotyetimplemented. Theobjectdiagramisusedtodescribethestructureofthesystembyshowingtheobjectsataspecifictime. Theobjectdiagramisanunsynchronizeddiagramwhichmeansthattheuserhastoaddexistingelementsmanuallyonthediagramtoseethem. Manageinstances Itispossibletocreateanddeleteinstancesintheobjectdiagram. Createaninstance Itispossibletocreateaninstancebyselectingthecreationtoolfromthepaletteandthenclickingonthediagramoranelement.AdiagramisassociatedtoapackageandwhentheuserclickonthediagrambackgroundtheelementiscreatedunderthecorrespondingpackageintheUMLmodel. Iftheuserselectsacontainer,theelementwillbecreatedunderthecorrespondingsemanticelementintheUMLmodel. Tooltiptoolsarealsoavailabletocreateinstances. Setdefaultvalue Itispossibletosetadefaultvaluetoaninstancepropertybyselectingthetoolfromthepaletteandthenclickingonaninstance.Thistoolopensawizardtoasktheusertoselectapropertyoftheselectedinstancetype. Manageexistingelements Asthediagramisunsynchronized,theuserneedstoaddmanuallytheelementsalreadyexistinginthesemanticmodelthatshouldappearontherepresentation. Itispossibletoaddexistingelementsby: selectingtheaddtoolfromthepaletteorthetooltipandthenclickingonthediagramoranelement.Theaddtoolopensaselectionwizard. draganddropinganelementfromthemodelexplorer. Onlyinstancescanbeaddedonanobjectdiagram. Theusercanseethatanelementisnotcomingfromthecurrentpackage: theelementborderislighterthantheelementborderofelementsdefinedinthecurrentpackage atooltipshowsthecontainerpackageoftheelementiftheelementisnotcontainedbythecurrentpackage Theusercanalsodeleteaninstance(seeDiagrameditor/Editortab-bar/Deleteelement/frommodel). Addrelatedelements Intheclassdiagramacontextualactionisavailabletoshowonthediagramtheelementrelatedtotheselection. TheAddrelatedelementsactionisavailablefrom: aninstance:showsalltheelementsthatdefinearelationship(dependency,association,composition…)withtheselectedelement anobjectdiagram:showsalltheelementscontainedinthepackageassociatedtothediagram. Editlabels Intheclassdiagram,itispossibletoedittheelementslabels(seeDiagrameditor/Editormaingraphicalarea/Directedit).Thisactionsallowstoedit: class,interface,package,enumeration,datatype,primitivetypelabels relationshipslabels Definetheapplicationbehavior BobdescribestheapplicationbehaviorthankstoStatemachinediagramsandSequencediagrams. Statemachines Thestatemachinediagramisusedtorepresentthedifferentstatesandtransitionsofasystem. ThestatemachinediagramisasynchronizeddiagramwhichmeansthatanyelementsexistingunderastatemachineintheUMLmodelwillbevisibleautomaticallyinthestatemachinediagram. Managestatemachines Itispossibletocreatestatemachineelementsbyselectingthecreationtoolsfromthepaletteandthenclickingonthediagramoranelement.AdiagramisassociatedtoapackageandwhentheuserclickonthediagrambackgroundtheelementiscreatedunderthecorrespondingpackageintheUMLmodel. Iftheuserselectsacontainer,theelementwillbecreatedunderthecorrespondingsemanticelementintheUMLmodel. Tooltiptoolsarealsoavailabletocreateanykindofelements. Creationtoolsareavailableinthestatemachinediagramforthefollowingtypes: Region=Grouplogicalstates; State=Describestheelementsconditionataspecificmoment; Submachine=Representsasubstatemachine; Initial=Thestartofaflow; Final=Indicatesthecompletionofaflow; Fork=Splittheflowintoanumberofconcurrentflows; Join=Jointheflowfromanumberofconcurrentflowstooneflow; Choice=Composecomplexflowsaccordingtoaruntimecondition; Junction=Mergemultipleflows; Terminate=Indicatesexecutionend; Shallowhistory=Representsthemostrecentactivesubstateofitscontainingstate; Deephistory=Representsthemostrecentactiveconfigurationofthecompositestatethatdirectlycontainsthispseudostate; Entrypoint=DefinesthebeginningofaStateMachine; Exitpoint=Statemachineexit. Theusercanalsodeleteastatemachineelement(seeDiagrameditor/Editortab-bar/Deleteelement/frommodel). Managetransitions Itispossibleto: createatransition:byselectingtheedgecreationtoolfromthepaletteandthenclickingonasourceelementandatargetelement. deleteatransition:byselectingtheedgeinthediagramorintheModelexplorerviewandthenselectingthedeletetool.Thistooldeletesthesemanticelement.Ifarepresentationisopen,theviewcorrespondingtothedeletedflowisnotanymorevisibleafterthedeleteaction(seeDiagrameditor/Editortab-bar/Deleteelement/frommodel). reconnecttransitions:toreconnectthesourceandthetargetofatransitioninthestatemachinediagram. Editlabels Inthestatemachinediagram,itispossibletoedittheelementslabels(seeDiagrameditor/Editormaingraphicalarea/Directedit).Thisactionsallowstoeditanystatemachineelementslabels. Sequences Thesequencediagramisusedtoshowhowprocessesoperatewithoneanotherandinwhatorder. ThesequencediagramisasynchronizeddiagramwhichmeansthatanyelementsexistingunderaninteractionintheUMLmodelwillbevisibleautomaticallyinthesequencediagram. Manageinteractionelements Itispossibletocreate: lifeline:isanindividualparticipantinaninteraction associatedtoaclass associatedtoanactor destruction creation message:indicatesaflowofinformationbetweenelements synchronous asynchronous lost found execution stateinvariant:conditionappliedtoalifeline interactionuse:callanotherinteraction Theusercanalsodeleteanelement(seeDiagrameditor/Editortab-bar/Deleteelement/frommodel). Reorderaninteractionelement Itispossibletoreordertheinteractionelements: lifelinecanbereorderhorizontally otherelements(execution,messages…)canbereorderedvertically Thistoolupdatesthesemanticelementpositionedintheinteractionfragmentslist.Ifarepresentationisopen,theviewcorrespondingtothemovedelementisautomaticallyupdated. Editlabels Inthesequencediagram,itispossibletoedittheelementslabels(seeDiagrameditor/Editormaingraphicalarea/Directedit).Thisactionsallowstoeditanyinteractionelementslabels.
延伸文章資訊
- 1UML Class Diagram Tutorial - Visual Paradigm
A Comprehensive UML Class Diagram tutorial written for everyone who want to learn ... Implementat...
- 2【用VS2010動手學UML第16回】快速上手UML類別圖的初級概念
介面實現關係的名稱有變動過,在2003年UML2.0草版規格書中,這條關係線叫做「實作關係」(Implementation),如圖圖11所示。但是,到了2005年UML2.0正式版 ...
- 3Implements relationships in domain modeling class diagrams
In domain modeling class diagrams, an implements relationship exists between two classes when one...
- 4UML Class Diagrams
Realization: A class implements an interface. For example, the Owner interface might specify meth...
- 5UML 2 Class Diagram Guidelines - Agile Modeling
Interfaces are implemented, "realized" in UML parlance, by classes and components - to realize an...