0% found this document useful (0 votes)
13 views20 pages

ISYS2395 Session 10 SMD Exercise Sample Solution

Uploaded by

Mary
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views20 pages

ISYS2395 Session 10 SMD Exercise Sample Solution

Uploaded by

Mary
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

ISYS 2395:Business Systems

Analysis and Desing

Session 10

Modelling System Behaviour: State


Machine Diagram Exercises Sample
Solution

Alem Molla
Exercises

CLO1: Critically analyse the


Exercise 1: Group Project Reflection strategic and operational needs of
an enterprise in a real-world
situation.

CLO2: Address the strategic and


Exercise 2: States, Events, and Transitions operational needs of an enterprise
by designing appropriate and
relevant technological solutions.

Exercise 3: UBER SMD CLO3: Demonstrate a critical


understanding of system analysis
and design methodologies in order
to evaluate the application of
Exercise 4: Project SMD systems in a business context.

CLO4: Demonstrate a critical


understanding of the relevant tools
available and their appropriate
Exercise 5: Account SMD application in the context of the
business environment.

Exercise 6: Ticket Selling (Post Class)

2
Exercise 1: Reflection

Reflecting on your group project class diagram


and CRC, which of the classes are stateful and
which are stateless?

Which of the objects are complex and why?

3
Exercise 2: States, Transitions,
Events

(a) Describe the states,


(b) Describe the states,
transitions, events, and
transitions, events, and
actions of a bank
actions of an ATM and
customer's account and
create a SMD.
create a SMD.

4
Exercise 2a Solution
States Events/Actions Transitions
Setup: Initial state Initialize account, Setup to active
when an account Change status
is created.
Active: most Dormant or Request Active to close;
account Close, Active to inactive
operations occur Deactivate
Inactive: Passage of time/User
temporarily request,
deactivated and Close account Inactive to close
can be
reactivated. Reactivate account Inactive to active
Closed : account No event (account End state
cannot be used cannot be transitioned
for transactions. out of this state)

5
Exercise 2a Solution

Setup Inactive

Reactivate

Initalize Dactivate Close

Active Closed

Close

6
Exercise 2b Solution
States Event /Action Transition
Idle: An initial state Card insertion Idle to active
of an ATM Action=reading card
Active: Ready to Incorrect PIN Active to idle
process inserted action = cancel
card
Active: Ready to Correct PIN Active to idle
process inserted action = transaction
card processed
Out of order: ATM Technical Idle to Out of order
not functioning failure/power failure
Fixed/power back
action= display
change

7
Exercise 2b: (High level)
state machine for ATM
Exercise 3: Uber SMD

Refer to the Uber class diagram (c.f. Week 8


sample solution)
Choose a complex object
Describe the states, transitions, events, and
actions
Create a State Machine Diagram

9
Exercise 3 Solution for
Ride Object
States Event/Action Transition
Requesting: initial Notify drivers Searching
state when a user
requests a ride
Searching Driver accepts Driver assigned
User cancels ride Cancelled
Driver assigned Driver cancel ride Searching
Ride starting In progress
Cancelled None completed
In progress Trip Completed
Completed No event Final state

10
Exercise 3 Sample
Solution

Requesting Searching

Driver
cancels
User cancels Driver
found

Driver
Cancelled In progress Trip Completed
assigned Ride
start

11
Exercise 4: Project SMD

Take stateful and


complex object(s) Describe the states,
from your group transitions, events,
project’s class and actions
diagram

Create a simple
State Machine
Diagram(s)

12
Exercise 4 Solution

13
Exercise 5: Account SMD
For the user account to be created, it must meet some initial requirements. For
example, user id (used as a login name) must be unique, at least for the existing
accounts. After account was created, it might need to be verified. Verification
depends on the company and could include e-mail, phone, and/or address
verification. If account was not verified during some predefined period, that
account could be moved to the suspended accounts.
New, active, or suspended accounts could be cancelled at any time by client's
request. Note, the precondition for this usually includes payment of any
outstanding balances and might require some separate account state
or substate to handle this case.
User account might be suspended for security reasons, manually or
automatically. For example, website intrusion detection system locks user
account for predefined period, if there were several unsuccessful login attempts
using incorrect account password. After account lock times out, account is
activated back automatically.
Some user accounts could be inactive for a long period of time. Company policy
or business rules could require moving such dormant for a year or two accounts
to the suspended state.

14
Exercise 5 Solution

15
Exercise 6: Post-Class
Exercise Ticket Selling

Assume that you have developed an app for your


client who organises concerts.
Through the app, customers (of your client) can
book tickets.
Think about the different states of the object
"Ticket“
Develop a SMD for a “Ticket” object including
guard conditions

16
Exercise 6: Sample
Solution Ticket Selling
System State Machine

• Issues: the end state is missing!


• No guards
Summary
• State machines are used most commonly to model the behavior of an
object across its lifetime.
• They are particularly needed when objects have state-dependent
behavior.
• Objects which may have state machines include classes, subsystems,
use cases and interfaces (to assert states which must be satisfied by an
object which realizes the interface).
• Not all objects require state machines. If an object's behavior is
simple, such that it simply store or retrieves data, the behavior of the
object is state-invariant and its state machine is of little interest.
• Modeling the lifetime of an object also involves deciding the order in
which the object can meaningfully respond to events, starting at the time
of the object's creation and continuing until its destruction.
• Modeling the lifetime of an object involves three things:
 specifying the events to which the object can respond
 the response to those events
 the impact of the past on current behavior.

18
References

Jacobson, L., & Booch, J. R. G. (2021). The Unified Modeling


Language Reference Manual.

Friedenthal, S., Moore, A., & Steiner, R. (2015). Modeling event-based


behavior with state machines. A Practical Guide to SysML, 273-294.
https://rmit.primo.exlibrisgroup.com/permalink/61RMIT_INST/4t5l5f/cdi_
proquest_ebookcentralchapters_1823236_118_298

Scott, K. (2001). UML Explained. Addison Wesley

Sundaramoorthy, S. (2022). UML Diagramming: A Case Study


Approach. Auerbach Publications. Available at
https://rmit.primo.exlibrisgroup.com/permalink/61RMIT_INST/4t5l5f/cdi_
askewsholts_vlebooks_9781000587265

UML Guide available at https://www.omg.org/spec/UML/2.5/PDF/

19
Post Class Activities

Complete Complete the class exercises

Revise Revise the class exercise solutions

Start Preparing for sprint three presentation and report

Draft Draft individual assessment

20

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy