Last Time .: Domain Modelling Viewed Using A Class Diagram
Last Time .: Domain Modelling Viewed Using A Class Diagram
Now
Modelling business processes using activity diagrams
and modelling an object’s change of state using state machine diagrams
The Activity Diagram
Activity diagrams are useful for representing: procedural logic, business
operations, workflows, use cases, complex operations etc
Activity diagrams have much in common with old-style flow charts but also allow
for concurrency.
The Business Process Modelling Notation (BPMN) is a superset of the standard UML activity
diagram notation. Enterprise Architect provides toolkits for both
Basic notation
initial node
Action
flow decision
fork
merge
join
The Activity Diagram
Action/Activity
A simple operation e.g. validate withdrawal amount
Flow
A connection between actions. A solid line with an arrow on one end showing the
direction of flow
Fork/Join
A fork splits one incoming flow into multiple concurrent (parallel) outgoing flows
A join combines multiple concurrent (parallel) incoming flows into one outgoing
flow.
Basic notation
initial node
Action
flow decision
fork
merge
join
The Activity Diagram
Initial node
The starting point of the activity diagram. There can only be one on a diagram ( a
solid circle)
Final Activity node
An ending point of the activity diagram. There can be multiple final nodes ( a bulls-
eye)
Basic notation
initial node
Action
flow decision
fork
merge
join
The Activity Diagram
Decision
A decision is a multi-way branch. It has one incoming flow and two or
more conditional flows out. A diamond is used to show a decision. Guard
expression are enclosed in [] to clarify the conditions on each outgoing
flow e.g. [sufficient funds], [insufficient funds], [else].
Merge
The end of conditional flow in a decision
Basic notation
initial node
Action
flow decision
fork
merge
join
The Activity Diagram
Receive
withdrawal
A simple example request
Enter
transaction
Note the use of a decision criteria [guard
condition] on the decision
[sufficient funds] [insufficient funds]
Hand cash to
customer
The Activity Diagram
Another simple example Receive
Order
Close Order
The Activity Diagram
Iteration can also be represented in an activity diagram
Place Order
Process Back-order
Order Item Item
[more items on order]
a merge a decision
Process
Order
The Activity Diagram
Back to the ATM withdrawal …
The Activity Diagram
Back to the ATM withdrawal …
Using `swimlanes’
A state machine specifies an object’s response (as a change of state) to the events
it may detect during its lifetime.
state machine
state diagram
State Machines and State Diagrams
State
"A state is a condition or situation during
the life of an object during which it
satisfies some condition, performs some
activity, or waits for some event" [ UML State
Language User Guide]
Transition
Movement between states in response to
some events on the object. These are
labeled to show the event that caused the
transition. Shown as a solid line with an
arrow on one end pointing to the next
state. Guard Conditions can be placed on transition
the transition e.g. [count > 0]
Initial pseudo state
This points to the initial state. There can
be zero or one initial state on a diagram.
Shown as a solid circle
initial pseudo state
Final state
An ending point of the state machine
diagram. There can be zero or more final
states. Shown as a bulls-eye final state
State Machines and State Diagrams
turnOn
Off On
create switch
turnOff
State Machines and State Diagrams
deposit(amount)
In Balance
deposit(amount)
withdraw(amount)
[amount = balance]
close account
Zero Balance
State Machines and State Diagrams
open close
Zero Balance
charge(amount)
deposit(amount)
charge(amount)
[amount = -balance]
[amount = balance]
In Debit In Credit
charge(amount)
[amount > balance AND amount <= credit limit + balance]