UsingActivityDiagrams toModel Use Cases VisuallyPart 1: TheBasicsby Declan Chellar
START POINT
TheStart Point representstheEVENT that triggersthe use case.
LabeltheStart Point to makethe INTENT and TRIGGER of the use case explicit.
Actor elects to AddCustomer
Actor elects to AddCustomerEND POINT
Actor elects to AddCustomerLabeltheEnd Point to EXPLICITLY confirm that theintent of the use case has beenachieved.
Actor elects to AddCustomerCustomeradded
Actor elects to AddCustomerThis makesitclear to thereader that the use case is complete and that nothingfurther is needed in order to fulfiltheintent.Customeradded
Actor elects to AddCustomerNOT a goodlabelforanEnd PointEnd of process
To reachtheEnd Point…
… you need to model STEPS.
Link thestepswith TRANSITIONS.
Transitions use arrowheads to show thedirection of  processflow.
I like to put a note againstanystep that achievesthegoal of the use case.Goal  X achieved
Goal  X achieved… becauseitmightnotbethelaststep.
Themostcommonroutefromthestartpoint to theendpoint has manynames.
Buttheyeffectively mean thesamething.
Combine anywordontheleftwithanyphraseontheright.PRIMARY……PATHBASIC……FLOWTYPICAL……COURSE OF EVENTS…SCENARIO
Often in a use case theSystem has to make a decisionbasedonbusiness rules...
The actual decisiontakes place within a STEP
System determines whether X or YThe actual decisiontakes place within a STEP
System determines whether X or YA DECISION POINT is then used to helpthereadernavigatethediagram.
DECISION POINT
DecisionPointscontaintextwhich describes thenature of thedecision to bemade.
So wasit X or Y?
Decisionpointsallowtheflow to branchawayfromthePrimaryPath.
Transitionscomingout of DecisionPointsmust have a GUARD.[Condition 2][Condition 1]
[IT WAS “Y”][IT WAS “X”]A Guardneeds to explicitly describe a conditionwhichmustbe true in order to proceeddown that path.
IftheflowrejoinsthePrimaryPath, it is known as anAlternatePath.[Condition 2][Condition 1]
[Condition 2][Condition 1]WithAlternatePaths, thegoal of the Use Case is stillachieved.
There are othernamesforAlternatePaths.[Condition 2][Condition 1]
Combine anywordontheleftwithanyphraseontheright.ALTERNATE……PATHALTERNATIVE……FLOWSECONDARY……COURSE OF EVENTS…SCENARIO[Condition 2][Condition 1]
[Condition 2][Condition 1]You can show howpathsrejoinbyusing a MERGE POINT.
[Condition 2][Condition 1]You can show howpathsrejoinbyusing a MERGE POINT.
I don’tlikeMergePointsbecausetheytake up spacewithoutaddingclarity.[Condition 2][Condition 1]
I prefer to modelmergingpathslikethis.[Condition 2][Condition 1]
MergePoints can sometimesbeparticularlysuperfluous.[Condition 2][Condition 1]
[Condition 2][Condition 1]I thinkit is neater to show themergethisway.
Iftheflowdoes NOT rejointhePrimaryPath, it is known as anExceptionPath.[Condition 2][Condition3][Condition 1]
WithExceptionPaths, thegoal of the Use Case is NOT achieved.[Condition 2][Condition3][Condition 1]Goal  X achieved
WithExceptionPaths, thegoal of the Use Case is NOT achieved.[Condition 2][Condition3][Condition 1]Uh, oh!Goal  X achieved
I like to use colour to highlightthedifferentpaths.[Condition 2][Condition3][Condition 1]
[Condition 2][Condition3][Condition 1]
[Condition 2][Condition3][Condition 1]
This makesiteasy to identify test scenarios at a glance.[Condition3][Condition 2][Condition 1]
I alsolike to labeltheGuards in order to easilyidentifythepaths.A1: [Condition 2]E1: [Condition 3]P: [Condition 1]
And I like to labeltheStepsforeasybackwardreferencefrom Business Rules and a Logical Data Model.P1:A1: [Condition 2]E1: [Condition 3]P: [Condition 1]P2:A1.1:E1.1:
PrimaryPath: 	P1, P2.P1:A1: [Condition 2]E1: [Condition 3]P: [Condition 1]P2:A1.1:E1.1:
PrimaryPath: 	P1, P2.AlternatePath 1: 	P1, A1.1, P2.P1:A1: [Condition 2]E1: [Condition 3]P: [Condition 1]P2:A1.1:E1.1:
PrimaryPath: 	P1, P2.AlternatePath 1: 	P1, A1.1, P2.ExceptionPath 1: 	P1, E1.1.P1:A1: [Condition 2]E1: [Condition 3]P: [Condition 1]P2:A1.1:E1.1:
In some Use Cases, you willneed to modelparallelsteps[Condition 2][Condition3][Condition 1]
[Condition 2][Condition3][Condition 1]XABIn thisexample, steps A and B mustbothstartafterstep X finishes and mustbothfinishbeforethe Use Case ends.
[Condition 2][Condition3][Condition 1]XABButwe do notcareabouttheorder in which A and B happen.
A and B couldevenhappen at thesame time.[Condition 2][Condition3][Condition 1]XAB
In thisexample, B mustfollow A, butwe do notcarewhen C happens in relation to (A + B).[Condition 2][Condition3][Condition 1]ACB
In some Use Cases, you willneed to modelrepeatedsteps.[Condition 2][Condition3][Condition 1]AB
[Condition 2][Condition3][Condition 1]Foreach X:AIn thisexample, you repeat (A + B) untilthere is no more X.B
[Condition 2][Condition3][Condition 1]Foreach X:AForexample, you might do thiswhenaddingpassengers to a holidaybooking.B
Let’sreviewtheshapes
START POINTDECISION POINT[Condition]END POINTGUARDSTEPPARALLEL STEPSForeach X:TRANSITIONREPEATED STEPS
www.chellar.com/blog

Activity diagram tutorial