wk5 uml activity diagram
TRANSCRIPT
-
8/3/2019 Wk5 UML Activity Diagram
1/34
www.ddss.arch.tue.nl
7M822
UML Activity DiagramsUML Activity Diagrams
6 October 2008
-
8/3/2019 Wk5 UML Activity Diagram
2/34
www.ddss.arch.tue.nl
7M822
ExampleExample
-
8/3/2019 Wk5 UML Activity Diagram
3/34
www.ddss.arch.tue.nl
7M822
Activity Diagram: what is it?Activity Diagram: what is it?
Describes activities and flows of data or
decisions between activities
Provides a very broad view of business
processes
Can be used to break out the activities
that occur within a use case Good for showing parallel threads
-
8/3/2019 Wk5 UML Activity Diagram
4/34
www.ddss.arch.tue.nl
7M822
Activity Diagram: when to use it?Activity Diagram: when to use it?
When describing work flow across many use
cases
When analysing a use case, and before
methods are assigned to symbols
When dealing with multi-threaded applications
-
8/3/2019 Wk5 UML Activity Diagram
5/34
www.ddss.arch.tue.nl
7M822
Creating an Activity DiagramCreating an Activity Diagram
This diagram is useful in showing work flowconnections and describing behaviour that has a
lot of parallel processing.When you use an activity diagram you can choose
the order in which to do things.
It expresses the essential sequencing rules to
follow.It is different from a flow chart in that it shows
parallel processes, not just sequential processes.
-
8/3/2019 Wk5 UML Activity Diagram
6/34
www.ddss.arch.tue.nl
7M822
Activity DiagramActivity Diagram
Shows a set of activities, the flow from activity
to activity.
Represents the dynamic view of a system.
Models the function of a system.
-
8/3/2019 Wk5 UML Activity Diagram
7/34
www.ddss.arch.tue.nl
7M822
Activity DiagramActivity Diagram
Activity diagrams show the flow of control
between activities
They can model the sequential and concurrent
steps in a computational process
They can also model the flow of an object as it
moves from state to state at different points in the
activity
-
8/3/2019 Wk5 UML Activity Diagram
8/34
www.ddss.arch.tue.nl
7M822
UML Activity symbolsUML Activity symbols
ActionState initial state final state
Transition(Fork)
Transition(Join)
Control FlowDecision
Swimlane
-
8/3/2019 Wk5 UML Activity Diagram
9/34
www.ddss.arch.tue.nl
7M822
Action StateAction State
In a conceptual diagram an activity is a task that
needs to be done either by a human or a
computer In a specification-perspective diagram or an
implementation-diagram, an activity is a method
on a class
-
8/3/2019 Wk5 UML Activity Diagram
10/34
www.ddss.arch.tue.nl
7M822
Sequential BranchingSequential Branching
A sequential branch is represented as a diamond
It may have one incoming transition and two or more
outgoing transitions Guards are associated with each transition. The guards
are evaluated upon entering the branch, and the one
that evaluates to true is then taken
-
8/3/2019 Wk5 UML Activity Diagram
11/34
www.ddss.arch.tue.nl
7M822
ExampleExample
-
8/3/2019 Wk5 UML Activity Diagram
12/34
www.ddss.arch.tue.nl
7M822
Branch & MergeBranch & Merge
Calculate Risk
Issue a Loan
[ risk low]
Ask for Authorization
Continue
[ risk high]
-
8/3/2019 Wk5 UML Activity Diagram
13/34
www.ddss.arch.tue.nl
7M822
Forking and JoiningForking and Joining
Concurrent activities within an activity diagram are modelled
with the use of synchronised bars
Synchronisation bars are drawn as a thick horizontal or vertical
line
Joins and Forks should balance
The number of flows that leave a fork should equal to the number
of flows entering the corresponding join.
-
8/3/2019 Wk5 UML Activity Diagram
14/34
www.ddss.arch.tue.nl
7M822
Fork & JoinFork & Join
Issue a Loan
Reserve Money Make a Agreement
Make an Offer
-
8/3/2019 Wk5 UML Activity Diagram
15/34
www.ddss.arch.tue.nl
7M822
PrepareMeal
CookSpaghetti MakeSauce
Combine
OpenBottleWine
[ in the mood for wine]
Serve
-
8/3/2019 Wk5 UML Activity Diagram
16/34
www.ddss.arch.tue.nl
7M822
Forks, Joins & conditional ThreadsForks, Joins & conditional Threads
PrepareMeal
CookSpaghetti MakeSauce
Combine
OpenBottleWine
Serve
[ in the mood for wine]
-
8/3/2019 Wk5 UML Activity Diagram
17/34
www.ddss.arch.tue.nl
7M822
Swim lanesSwim lanes
The activities of an activity diagram may be performed by
different groups.
Each zone or lane represents the responsibilities of a particular
group.
If swimlanes are used, each activity can belong to one and only
one swimlane.
To use swimlanes, you must arrange your activity diagrams into
vertical zones separated by dashed lines.
-
8/3/2019 Wk5 UML Activity Diagram
18/34
www.ddss.arch.tue.nl
7M822
Swim lanesSwim lanes
AdministrationDeskFinance
Issue a Loan
Reserve Money Make a Agreement
Make an Offer
-
8/3/2019 Wk5 UML Activity Diagram
19/34
www.ddss.arch.tue.nl
7M822
Activity
Diagram
Activity
Diagram
-
8/3/2019 Wk5 UML Activity Diagram
20/34
www.ddss.arch.tue.nl
7M822
Composite ActivityComposite Activity
-
8/3/2019 Wk5 UML Activity Diagram
21/34
www.ddss.arch.tue.nl
7M822
-
8/3/2019 Wk5 UML Activity Diagram
22/34
www.ddss.arch.tue.nl
7M822
Receive Order
Assign Goods to item
Authorize Payment
[ for each line item] /
Cancel Order
[ failed]
*
Reorder Goods
[ need to order]
[ succeeded]
Dispatch Order
[ stock assigned to all items and payment authorized]
-
8/3/2019 Wk5 UML Activity Diagram
23/34
www.ddss.arch.tue.nl
7M822
ExampleExample
-
8/3/2019 Wk5 UML Activity Diagram
24/34
www.ddss.arch.tue.nl
7M822
Object FlowObject Flow
Objects may be involved in the flow of control associated with an
activity.
These associations can be shown in activity diagrams by placing objects
in the diagram and linking them to specific activities using a dependencylink.
The same object may be the output of one action and the input of one or
more subsequent activities.
To distinguish the various appearances of the same object, the state of
the object at each point may be placed in brackets and appended to the
name of the object.
-
8/3/2019 Wk5 UML Activity Diagram
25/34
www.ddss.arch.tue.nl
7M822
Object
Flow
Example
Object
Flow
Example
StockroomSalesCustomer
Request service
Take order
Fill order
Deliver order
Pay
Take order
StockroomSalesCustomer
Request service
Take order
Fill order
Deliver order
Pay
Collect order
Order [placed]
Order [entered]
Order [filled]
Order [delivered]
-
8/3/2019 Wk5 UML Activity Diagram
26/34
www.ddss.arch.tue.nl
7M822
Date2date example: scenariosDate2date example: scenarios
Use caseLog in Subscriber
Step-by-step Plan1. Validate number of invalid logins
2. If number of invalid logins more than 2, stop
3. Show web-page4. Actor enters login and password
5. Actor confirms login
6. Application validates login
7. If login is valid
7.1 Actor is marked as subscriber
7.2 Stop
8. If login is invalid8.1 Increase the number of steps
8.2 Repeat from 1.
-
8/3/2019 Wk5 UML Activity Diagram
27/34
www.ddss.arch.tue.nl
7M822
Use Case Log in subscriber
Actors Subscriber, Visitor
Description
Pre-conditions
Check validity actor as subsciriber
----
Basic flow 1. Validate number of invalid logins
2. Show web-page
3. Actor enters login and password
4. Actor confirms login
5. Application validates login
6. Actor is marked as subscriber
Extension /
Exception flow 1a Login is invalid
1a1 Number of logins >2, stop
5a Login is invalid
5a1 Increase number of logins, repeat 1
Post-conditions Actor is known as subscriber and actor is logged in
Date2date : Log in Subscriber use case textDate2date : Log in Subscriber use case text
-
8/3/2019 Wk5 UML Activity Diagram
28/34
www.ddss.arch.tue.nl
7M822
Date2date :
Log in
subscriber activity diagram
Date2date :
Log in
subscriber activity diagram
-
8/3/2019 Wk5 UML Activity Diagram
29/34
www.ddss.arch.tue.nl
7M822
Key pointKey point
Activity diagrams are useful for
Business Process Redesign
Work Flow Modelling
Analysing Use Cases
-
8/3/2019 Wk5 UML Activity Diagram
30/34
www.ddss.arch.tue.nl
7M822
NS Ticket serviceNS Ticket service
Define a use case diagram of
NS Ticket service
Describe an use case.
Take ticket
Destination
Single / Retour
No Reduction /
40% reduction
2e class / 1e class
-
8/3/2019 Wk5 UML Activity Diagram
31/34
www.ddss.arch.tue.nl
7M822
Use Case diagram NS Ticket serviceUse Case diagram NS Ticket service
Traveller
Buy OV ticket
Buy NS ticket
Pay ticket
extends
uses
-
8/3/2019 Wk5 UML Activity Diagram
32/34
www.ddss.arch.tue.nl
7M822
Use Case Buy OV Ticket
Actors Traveller
Preconditions Traveller has a valid pass
Description 1. Ticket device expects destination code
2. Traveller enters destination code
3. Extension point: NS ticket
4. Ticket device checks code and calculates the charge. Showsdestination code & fare. Activates ticket machine for paying
5. Traveller pays (use case: Pay ticket)
6. Ticket device print and supplies ticket
7. Traveller takes ticket
Extension Destination code = NS station.3a. Ticket device expects ticket type
3b. Traveller enters Single/Return, Discount Y/N, Class
Exceptions Traveller interrupt the interaction or walk away
Traveller enters an incorrect destination code
Payment is not finished off successful
Result Traveller has ticket.
(NS can look forward to the payment)
-
8/3/2019 Wk5 UML Activity Diagram
33/34
www.ddss.arch.tue.nl
7M822
Make a class diagram of NS ticket service
including the classes Ticket and
Destination
Make a class diagram of NS ticket service
including the classes Ticket and
Destination
+create()
+payPrice()
+printTicket()
-fromStation-toStation
-oneWay : Boolean
-reduction : Boolean
-class
-date : Date
-price : Currency
Ticket
+validateDestination()
+showPrice()
-code
-name
-distance
-base price
Destination
+Print()
+checkStatusPrinter()
-statusPrinter
Printer
* 1
-
8/3/2019 Wk5 UML Activity Diagram
34/34
www.ddss.arch.tue.nl
7M822
Make an activity diagram for the actor TravellerMake an activity diagram for the actor Traveller
Enter Destination
[else] [ correct NS destination]
Choose single or return Choose reduction Y/N Choose 1st / 2snd class
[ bus&tram card]
Pay ticket
[ payment not OK]
Take ticket
[ else]