0% found this document useful (0 votes)
21 views17 pages

Last Time .: Domain Modelling Viewed Using A Class Diagram

Activity diagrams can be used to model business processes and workflows by representing sequential and concurrent steps. They involve actions, flows, decisions, forks, joins, and swimlanes. State machine diagrams show the states of objects and transitions between states caused by events. Simple examples include a switch and savings account, while a more complex example is a credit card account. Both diagrams allow representing sequence and change over time, with activity diagrams focused on business processes and state machine diagrams on dynamic changes to objects. Next will involve sequence diagrams for explicitly representing time-based behavior.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views17 pages

Last Time .: Domain Modelling Viewed Using A Class Diagram

Activity diagrams can be used to model business processes and workflows by representing sequential and concurrent steps. They involve actions, flows, decisions, forks, joins, and swimlanes. State machine diagrams show the states of objects and transitions between states caused by events. Simple examples include a switch and savings account, while a more complex example is a credit card account. Both diagrams allow representing sequence and change over time, with activity diagrams focused on business processes and state machine diagrams on dynamic changes to objects. Next will involve sequence diagrams for explicitly representing time-based behavior.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 17

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

final activity node

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

final activity node

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

final activity node

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

final activity node

flow decision

fork
merge

join
The Activity Diagram
Receive
withdrawal
A simple example request

… withdrawing cash at a bank branch Check


Signature

Enter
transaction
Note the use of a decision criteria [guard
condition] on the decision
[sufficient funds] [insufficient funds]

Count out Print account


cash balance

Hand cash to
customer
The Activity Diagram
Another simple example Receive
Order

… processing an order (Fowler, M. (2004) UML


Distilled. 3rd ed. Boston, MA: Addison-Wesley.
p118)

Fill Order Send


Invoice

[priority order] [else]

Overnight Regular Receive


Delivery Delivery Payment

Close Order
The Activity Diagram
Iteration can also be represented in an activity diagram

Place Order

[item available] [item not available]

Process Back-order
Order Item Item
[more items on order]

a merge a decision

[no more items on order]

Process
Order
The Activity Diagram
Back to the ATM withdrawal …
The Activity Diagram
Back to the ATM withdrawal …

Using `swimlanes’

(from the BPMN toolkit)


State Machines and State Diagrams

A state machine specifies an object’s response (as a change of state) to the events
it may detect during its lifetime.

They can be viewed using a state machine diagram

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

A very simple example: a switch

turnOn

Off On
create switch

turnOff
State Machines and State Diagrams

Another simple example: a savings account object

deposit(amount)
In Balance

[amount >= minimum required]

deposit(amount)

withdraw(amount)

[amount = balance]

close account

Zero Balance
State Machines and State Diagrams

A not so simple example: a credit card account object

open close
Zero Balance

charge(amount)

[amount <= credit limit]


deposit(amount)

deposit(amount)
charge(amount)
[amount = -balance]
[amount = balance]

In Debit In Credit

charge(amount)
[amount > balance AND amount <= credit limit + balance]

deposit(amount) [amount > -balance]


Summary

Both activity diagrams and state machine diagrams allow you to


represent sequence and change over time.

Activity diagrams are suited to modelling business processes i.e. the


way things are done in a business context.

Concurrency, selection and iteration can be represented.

State machine diagrams show the change of state of objects


in the problem domain.
This can be important in representing and understanding the
dynamic nature of the domain model
Next time …

A more explicit representation of time … the sequence diagram

You might also like