uml activity diagrams - cs.up.ac.za€¦ · model code in an activity diagram write code from an...
TRANSCRIPT
PurposeNotational Elements
Tutorial
UML Activity Diagrams
Vreda Pieterse and Linda Marshall
Department of Computer ScienceUniversity of Pretoria
12 September 2014
Vreda Pieterse and Linda Marshall UML Activity Diagrams
PurposeNotational Elements
Tutorial
Model complicated workflows in
operations on objects
Model complex activities in more detail
Vreda Pieterse and Linda Marshall UML Activity Diagrams
PurposeNotational Elements
Tutorial
Action NodesActivity edgesControl NodesSwimlanes
Action Nodes
Activity Edges
Control Nodes
Swimlanes
Vreda Pieterse and Linda Marshall UML Activity Diagrams
PurposeNotational Elements
Tutorial
Action NodesActivity edgesControl NodesSwimlanes
Initial Node
Starting point
An activity diagram may at most have
one initial nodeVreda Pieterse and Linda Marshall UML Activity Diagrams
PurposeNotational Elements
Tutorial
Action NodesActivity edgesControl NodesSwimlanes
Final Node
Point where activity terminates
An activity diagram may have many
final nodesVreda Pieterse and Linda Marshall UML Activity Diagrams
PurposeNotational Elements
Tutorial
Action NodesActivity edgesControl NodesSwimlanes
Action Node
Describe an action
Represent a function (method)
May contain sub-activities (infinitely)
Vreda Pieterse and Linda Marshall UML Activity Diagrams
PurposeNotational Elements
Tutorial
Action NodesActivity edgesControl NodesSwimlanes
Activity State
actions modes
fire immediately fire on an event
guards on decision only guards on all
actions are actions actions on transitions
actions in states
Vreda Pieterse and Linda Marshall UML Activity Diagrams
PurposeNotational Elements
Tutorial
Action NodesActivity edgesControl NodesSwimlanes
Activity Edge
Indicate flow between actions
May have a name (plain text)
Guards only for decisions (text in [ ])
May not have actions (text after /)Vreda Pieterse and Linda Marshall UML Activity Diagrams
PurposeNotational Elements
Tutorial
Action NodesActivity edgesControl NodesSwimlanes
Decision and Merge
Alternate flows
Needs guard conditions for alternatives
Vreda Pieterse and Linda Marshall UML Activity Diagrams
PurposeNotational Elements
Tutorial
Action NodesActivity edgesControl NodesSwimlanes
Composite Activities
Vreda Pieterse and Linda Marshall UML Activity Diagrams
PurposeNotational Elements
Tutorial
Action NodesActivity edgesControl NodesSwimlanes
Fork and Join (Parallel flows)
Both paths are executed at the same
time by different threads
Join fires only after all flows have
reached it. Synchronisation pointVreda Pieterse and Linda Marshall UML Activity Diagrams
PurposeNotational Elements
Tutorial
Action NodesActivity edgesControl NodesSwimlanes
Swimlanes to separate responsibilities in
different classes
Vreda Pieterse and Linda Marshall UML Activity Diagrams
PurposeNotational Elements
Tutorial
Model code in an activity diagramWrite code from an activity diagram
if (age > 60){goBowling(); }
else if (age > 21){bungyJump(); }
else{stayHomeThread.join();
studyThread.join();
stayHomeThread.detach();
studyThread.detach(); }Vreda Pieterse and Linda Marshall UML Activity Diagrams
PurposeNotational Elements
Tutorial
Model code in an activity diagramWrite code from an activity diagram
Vreda Pieterse and Linda Marshall UML Activity Diagrams
PurposeNotational Elements
Tutorial
Model code in an activity diagramWrite code from an activity diagram
Vreda Pieterse and Linda Marshall UML Activity Diagrams
PurposeNotational Elements
Tutorial
Model code in an activity diagramWrite code from an activity diagram
int value = 22;
while (value > -5){if (value < 10){
value += 3;
}else{value -= 16;
}}
Vreda Pieterse and Linda Marshall UML Activity Diagrams