Академический Документы
Профессиональный Документы
Культура Документы
edn.embarcadero.com/print/31863
1/10
1/9/13
Usecasediagrams
Usecasediagramsdescribewhatasystemdoesfromthestandpointofanexternalobserver.The emphasisison whatasystemdoesratherthan how. Usecasediagramsarecloselyconnectedtoscenarios.A scenarioisanexampleofwhathappens whensomeoneinteractswiththesystem.Hereisascenarioforamedicalclinic. "Apatientcallstheclinictomakeanappointmentforayearlycheckup.Thereceptionistfinds thenearestemptytimeslotintheappointmentbookandschedulestheappointmentforthat timeslot." A usecaseisasummaryofscenariosforasingletaskorgoal.An actoriswhoorwhatinitiates theeventsinvolvedinthattask.Actorsaresimplyrolesthatpeopleorobjectsplay.Thepicture belowisa MakeAppointmentusecaseforthemedicalclinic.Theactorisa Patient.The connectionbetweenactorandusecaseisa communicationassociation(or communicationfor short).
Classdiagrams
edn.embarcadero.com/print/31863 2/10
1/9/13
AClassdiagramgivesanoverviewofasystembyshowingitsclassesandtherelationships amongthem.Classdiagramsarestatictheydisplaywhatinteractsbutnotwhathappenswhen theydointeract. Theclassdiagrambelowmodelsacustomerorderfromaretailcatalog.Thecentralclassisthe Order.Associatedwithitarethe Customermakingthepurchaseandthe Payment.A Paymentis oneofthreekinds: Cash, Check,or Credit.Theordercontains OrderDetails(lineitems),each withitsassociated Item.
UMLclassnotationisarectangledividedintothreeparts:classname,attributes,andoperations. Namesofabstractclasses,suchas Payment,areinitalics.Relationshipsbetweenclassesarethe connectinglinks. Ourclassdiagramhasthreekindsofrelationships. associationarelationshipbetweeninstancesofthetwoclasses.Thereisanassociation betweentwoclassesifaninstanceofoneclassmustknowabouttheotherinorderto performitswork.Inadiagram,anassociationisalinkconnectingtwoclasses. aggregationanassociationinwhichoneclassbelongstoacollection.Anaggregationhas adiamondendpointingtothepartcontainingthewhole.Inourdiagram, Orderhasa collectionof OrderDetails. generalizationaninheritancelinkindicatingoneclassisasuperclassoftheother.A generalizationhasatrianglepointingtothesuperclass. Paymentisasuperclassof Cash, Check,and Credit. Anassociationhastwoends.Anendmayhavea rolenametoclarifythenatureofthe association.Forexample,an OrderDetailisalineitemofeach Order. A navigabilityarrowonanassociationshowswhichdirectiontheassociationcanbetraversedor queried.An OrderDetailcanbequeriedaboutits Item,butnottheotherwayaround.Thearrow alsoletsyouknowwho"owns"theassociation'simplementationinthiscase, OrderDetailhasan Item.Associationswithnonavigabilityarrowsarebidirectional. The multiplicityofanassociationendisthenumberofpossibleinstancesoftheclassassociated withasingleinstanceoftheotherend.Multiplicitiesaresinglenumbersorrangesofnumbers.In ourexample,therecanbeonlyone Customerforeach Order,buta Customercanhaveany numberof Orders.
edn.embarcadero.com/print/31863 3/10
1/9/13
Thistablegivesthemostcommonmultiplicities. Multiplicities 0..1 0..*or * 1 1..* Meaning zerooroneinstance.Thenotation n..mindicates nto minstances. nolimitonthenumberofinstances(includingnone). exactlyoneinstance atleastoneinstance
Everyclassdiagramhasclasses,associations,andmultiplicities.Navigabilityandrolesare optionalitemsplacedinadiagramtoprovideclarity.
Theobjectdiagrambelowinstantiatestheclassdiagram,replacingitbyaconcreteexample.
edn.embarcadero.com/print/31863 4/10
1/9/13
Sequencediagrams Classandobjectdiagramsarestaticmodelviews. Interactiondiagramsaredynamic.They describehowobjectscollaborate. A sequencediagramisaninteractiondiagramthatdetailshowoperationsarecarriedoutwhat messagesaresentandwhen.Sequencediagramsareorganizedaccordingtotime.Thetime progressesasyougodownthepage.Theobjectsinvolvedintheoperationarelistedfromleftto rightaccordingtowhentheytakepartinthemessagesequence. Belowisasequencediagramformakingahotelreservation.Theobjectinitiatingthesequenceof messagesis aReservationwindow.
edn.embarcadero.com/print/31863
5/10
1/9/13
The Reservationwindowsendsa m a k e R e s e r v a t i o n ( ) messagetoa HotelChain.The HotelChainthensendsa m a k e R e s e r v a t i o n ( ) messagetoa Hotel.Ifthe Hotelhasavailable rooms,thenitmakesa Reservationanda Confirmation. Eachverticaldottedlineisa lifeline,representingthetimethatanobjectexists.Eacharrowisa messagecall.Anarrowgoesfromthesendertothetopofthe activationbarofthemessageon thereceiver'slifeline.Theactivationbarrepresentsthedurationofexecutionofthemessage. Inourdiagram,the Hotelissuesa selfcalltodetermineifaroomisavailable.Ifso,thenthe Hotelcreatesa Reservationanda Confirmation.Theasteriskontheselfcallmeans iteration (tomakesurethereisavailableroomforeachdayofthestayinthehotel).Theexpressionin squarebrackets,[],isa condition. Thediagramhasaclarifying note,whichistextinsideadogearedrectangle.Notescanbeput intoanykindofUMLdiagram.
edn.embarcadero.com/print/31863
6/10
1/9/13
Statechartdiagrams Objectshavebehaviorsandstate.Thestateofanobjectdependsonitscurrentactivityor condition.A statechartdiagramshowsthepossiblestatesoftheobjectandthetransitionsthat causeachangeinstate. Ourexamplediagrammodelstheloginpartofanonlinebankingsystem.Logginginconsistsof enteringavalidsocialsecuritynumberandpersonalidnumber,thensubmittingtheinformationfor validation. Loggingincanbefactoredintofournonoverlappingstates: GettingSSN, GettingPIN, Validating,and Rejecting.Fromeachstatecomesacompletesetof transitionsthatdetermine thesubsequentstate.
edn.embarcadero.com/print/31863
7/10
1/9/13
Statesareroundedrectangles.Transitionsarearrowsfromonestatetoanother.Eventsor conditionsthattriggertransitionsarewrittenbesidethearrows.Ourdiagramhastwoself transition,oneon GettingSSNandanotheron GettingPIN. Theinitialstate(blackcircle)isadummytostarttheaction.Finalstatesarealsodummystates thatterminatetheaction. Theactionthatoccursasaresultofaneventorconditionisexpressedintheform / a c t i o n . Whileinits Validatingstate,theobjectdoesnotwaitforanoutsideeventtotriggeratransition. Instead,itperformsanactivity.Theresultofthatactivitydeterminesitssubsequentstate.
Activitydiagrams An activitydiagramisessentiallyafancyflowchart.Activitydiagramsandstatechartdiagrams arerelated.Whileastatechartdiagramfocusesattentiononanobjectundergoingaprocess(oron aprocessasanobject),anactivitydiagramfocusesontheflowofactivitiesinvolvedinasingle process.Theactivitydiagramshowsthehowthoseactivitiesdependononeanother. Forourexample,weusedthefollowingprocess. "WithdrawmoneyfromabankaccountthroughanATM." Thethreeinvolvedclasses(people,etc.)oftheactivityare Customer, ATM,and Bank.The processbeginsattheblackstartcircleatthetopandendsattheconcentricwhite/blackstop circlesatthebottom.Theactivitiesareroundedrectangles.
edn.embarcadero.com/print/31863
8/10
1/9/13
Activitydiagramscanbedividedintoobject swimlanesthatdeterminewhichobjectisresponsible forwhichactivity.Asingle transitioncomesoutofeachactivity,connectingittothenextactivity. Atransitionmay branchintotwoormoremutuallyexclusivetransitions. Guardexpressions (inside[])labelthetransitionscomingoutofabranch.Abranchanditssubsequent merge markingtheendofthebranchappearinthediagramashollowdiamonds. Atransitionmay forkintotwoormoreparallelactivities.Theforkandthesubsequent joinofthe threadscomingoutoftheforkappearinthediagramassolidbars.
Componentanddeploymentdiagrams
A componentisacodemodule.Componentdiagramsarephysicalanalogsofclassdiagram. Deploymentdiagramsshowthephysicalconfigurationsofsoftwareandhardware. Thefollowingdeploymentdiagramshowstherelationshipsamongsoftwareandhardware componentsinvolvedinrealestatetransactions.
edn.embarcadero.com/print/31863
9/10
1/9/13
UMLToolsandModelingTools CreatingandmodifyingUMLdiagramscanbelaborandtimeintensive.TheUMLmodelingtools fromEmbarcaderoTechnologiesmakeiteasytocreatediagramsliketheonesinthisarticleplus theyprovideagreatamountofotherfunctionalityincludingmodelandcodesynchronization. EmbarcaderoDelphiisthefastestwaytobuildnativeWindowsapplications.TheProfessional editionincludesUMLcodevisualization.TheEnterpriseeditionincludesmodelingwithtwoway synchronizationbetweenmodelandcode.TheArchitecteditionincludestheabilitytocreate languageneutralUMLmodelingprojects.LearnmoreaboutDelphiordownloadatrialedition ofDelphiandtryitforyourself. SimilarUMLmodelingfunctionalityisavailableforC++inC++Builder,forJavainJBuilderandfor WindowsinEmbarcaderoRADStudio.Databasemodelingandbusinessmodelingareavailablein EmbarcaderoER/StudioandER/StudioBusinessArchitect. Forthelatestuptodatetechniquesinthe UnifiedModelingLanguageand AgileSoftware DevelopmentProcesses,andforallofthelatestinformationonhowtodeliver bettersoftware faster,visitTheEmbarcaderoDeveloperNetwork
Copyright19942012EmbarcaderoTechnologies,Inc.Allrightsreserved.
edn.embarcadero.com/print/31863
10/10