L16 Analysis&Design
L16 Analysis&Design
when(balance≥0)
InCredit Closed
closeAccount /
set state=inactive
after(5 years)
when(balance<0) when(balance≥0)
Frozen Overdrawn
after(3 months) /
send BankManager.accountFrozen(account#)
2.4.4 5.4.9
It shows all the messages that an object can send and receive.
It describes all the possible states an object can get into during
its life time.
InCredit closeAccount /
when(balance≥0) set state=inactive
deposit(m) / addMoney(m)
withdraw(n) / subtractMoney(n)
after(5 years)
Overdrawn
deposit(m) / addMoney(m)
withdraw(n) / subtractMoney(n)
after(3 months) / when(balance < overdraftLimit) / notifyManager
send BankManager.accountFrozen(account#)
STATE MACHINE DIAGRAM: STATE
Overdrawn
deposit(m) / addMoney(m)
withdraw(n) / subtractMoney(n)
when(balance < overdraftLimit) / notifyManager
Frozen
STATE MACHINE DIAGRAM:
EVENT/TRANSITION MECHANICS
Events are processed one at a time.
☞ If the event does not trigger any transition it is ignored.
The new system will allow students to select four course sections for the coming
term. In addition, each student will indicate two alternative choices in case a course
section becomes filled or is canceled. No course section will have more than forty
students or fewer than ten students. A course section with fewer than ten students
will be canceled. Once the registration process is completed for a student, the
registration system sends information to the billing system so the student can be
billed for the term.
Professors must be able to access the online system to indicate which courses they
will be teaching, and to see which students signed up for their course offerings.
For each term, during the registration period students can change their schedule.
Students must be able to access the system during this time to add or drop courses.
ASU STATE MACHINE DIAGRAM: SECTION CLASS
To construct a state machine diagram we ask the following
questions:
Transmission
select R
Neutral Reverse
select N
select N select F
Forward
Transmission
select R
Neutral Reverse
select N
select N select F
substate
Forward
stop upshift upshift
First Second Third
downshift downshift
CONCURRENT COMPOSITE STATE MACHINE DIAGRAM
Concurrency arises when an object can be partitioned into sub-
sets of attributes or links, each with its own state machine diagram.
Result of Taking A
a Class
Incomplete Passed
Term project done
Project
Take pass
Exam
fail
Failed
COMPOSITE STATE MACHINE DIAGRAM: TRANSITIONS
A1 A2
Setup Cleanup
Concurrent state 2
B1 B2
A1 A2
Setup Cleanup
Concurrent state 2
B1 B2
WHEN TO USE A STATE MACHINE DIAGRAM
A state machine diagram is good at describing the behavior of
an object across several use cases.