• Dynamic aspects of a system • Describe • parallel processing • workflows • Show flow from activity to activity • Activity conceptual: task to be done specification/implementation: method
Activity
[condition 1]
[condition 2]
Activity
Activity
[synchronization condition]
Activity
UML-Activity Diagrams 2
Example activity diagram
Put coffee in filter
Add water to reservoir
Put filter in machine
Turn on machine
UML-Activity Diagrams 3
Activity
Activity Diagram • To describe a complicated method • To describe a use case
UML-Activity Diagrams 4
Activity diagram for Use Cases • When we receive an order, we check each line item of the order to see if we have the goods in stock. If we do, we assign the goods to the order. If this assignment sends the quantity of goods in stock below the reorder level, we reorder the goods. While we are doing this, we check to see if the payment is OK. If the payment is OK and we have the goods in stock, we dispatch the order. If the payment is Ok but we do not have the goods, we leave the order waiting, if the payment is not OK, we cancel the order.
UML-Activity Diagrams 5
And-split
And_join
UML-Activity Diagrams 6
• When a supply delivery comes in, we look at the outstanding orders and decide which ones we can fill from this incoming supply. We then assign each of these to its appropriate orders. Doing this may release those orders for dispatching. We put the remaining goods in stock.
UML-Activity Diagrams 7
UML-Activity Diagrams 8
UML-Activity Diagrams 9
UML-Activity Diagrams 10
UML-Activity Diagrams 11
Conditions
[condition 1]
[condition 2]
[condition 1]
[condition 1]
[condition 2]
[else]
UML-Activity Diagrams 12
[condition 2]
Good structuring: well balanced operators
…………… ……………
AND-join
AND-split
.………..… ………….… OR-join
Explicit OR-split
UML-Activity Diagrams
Le joueur joue et tombe sur une rue
l a n cé l e s d é s
d i a g ra m m e a cti vi té p a ye r
d é p l a ce m e n t
non
ru e l i b re ?
Ca s e a rri vé e
oui
non
a ch e te r ru e ?
d i a g ra m m e a cti vi té a j o u t p o s s e s s i o n
oui
UML-Activity Diagrams 14
l a nce r_ d é s
[dé1dé2]
[dé1=dé2] /nb_doubles++
s e _ d é p l a c e r ( to ta l _ d é ) [cas e=départ] ti re r _ c h a n c e
[cas e=chance]
re c e vo i r_ s a l a i re
[cas e=aller_pris on]
[cas e=com m unauté]
a l l e r _ p ri s o n
ti r e r _ c o m [cas e=terrain et propriétaire(0,num _joueur)]
[cas e=parc_gratuit]
p a ye r _ l o ye r b é n é fi c i e r
[cas e=impôts / taxes] p a ye r
[nb_doubles =1 ou 2] [nb_doubles =3]
[nb_doubles =0]
a l le r_ e n _ pri s o n
UML-Activity Diagrams 15
a van cer
l a nce r d és
[terrain vendu]
[le terrain ne m'appartient pas]
a rre t ca s e terrai n [le terrain m'appartient]
[terrain non vendu]
p a ye r l oye r [pas interressé pour acheter] [interressé pour acheter]
a che te r te rra i n s
UML-Activity Diagrams 16
jo u e u r c o u r a n t
jo u e u r li b r e
jo u e u r e m p riso n n é
jo u e r c la s s e p r is o n acheter m a is o n s
vendre m a is o n s
la n c e r le s d é s
in c r é m e n t e r n b d o u b le s
d o u b le n o n d o u b le so r t d e p riso n
r e s te e n p r is o n
n b d o u b le < 3
n b d o u b le s = 3 n o u ve lle c a s e c a se p riso n c ase c hanc e
e m p r is o n n e r
carte chance
c a se C a isse d e C o m m u n a u té P r o p r ié t é