Professional Documents
Culture Documents
CS1004-2.13 States
CS1004-2.13 States
• https://examtimetable.brunel.ac.uk/
• Tuesday, 12 December
• 9:30-10:30am
– Be there at 9am
• On campus
• Bring your laptop
– On Wiseflow
– Charged
– Brunel wifi
CS1004 INFORMATION SYSTEMS &
ORGANISATIONS
LECTURE 13
STATES
Previously in CS1004
Client
Use Cases
Analysis
ERDs
Design
Implementation
Validation
System
Maintenance
Previously in CS1004
• Design the structure of the data
(database design)
– Explore what data needs to be stored
and how it will be stored
– Identify entities, their attributes and
relationships
Plan for today
• Look at the ‘lifecycles’ of data entities
in business processes
• Understand Events
• Continue with system design
– And Create State Diagrams
System design
• A description of how the system should
be made
• We use diagrams, drawings and text
• We design all aspects of the system
– Overall architecture
– Database
– Interfaces
– Programs
• Entity: Cup
• States: Full, Empty
• Events: Drink tea, Pour tea
• Entity: Door
• States: Closed, Open
• Events: Open, Close
Events
• Something that happens in the
environment
• Events cause entities to change state
– In other words, an event causes a
transition from one state to another
• State
State
– With name
• Transition
event
– With event
• End point
States in an entity’s life ☺
1. StateD
2. StateA
3. StateB
4. StateC
Examine the State Diagram
below:
• Which state is the system
Guard or in after Transition
Guarded the
sequence of events: event1,
[boolean event3,
expression] if it’s true,
event2? transition is allowed
1. StateD
2.Transient
StateAState or Pseudostate
3.NoStateB
name. Lasts 0 time
4. StateC
Examine the State Diagram
below:
• Which state is the system in after the
sequence of events: event2, event3,
event2, with the var i equal to -2.
1. StateD
2. StateA
3. StateB
4. StateC
State diagram of system user
x
Not logged in logged in
[a]
[b]
Place order
Sign delivery note Send payment
Placed Delivered Paid
Order (Business level)
• Remember different states mean that
entities have different behaviour and
constraints…
• What changes should we allow to the
data of the Order entity when its in the
Placed, Delivered and Paid states?
Place order
Sign delivery note Send payment
Placed Delivered Paid
Order (Business level)
Place order
Sign delivery note Send payment
Placed Delivered Paid
• Placed
– Order can change (data like shipping date, address,
quantity, etc) or order be cancelled
• Delivered
– Only price data can be changed (for example, in case
of problem)
– Cannot be cancelled
• Paid
– Nothing can be changed
✓ These constraints follow the ‘business rules’ of the
company
Let’s now add more detail by
looking at our system use cases
Actors Goals
Customer Place an order
Pay an invoice
Warehouse staff Get next dispatch
Driver Get delivery list
Record deliveries
Accounts Send invoices
[get next
dispatch]
place
an order
Dispatched Invoiced
Order – add constraints
State What data are allowed to change?
Cancel Quantity Price Shipping Next state
Placed ✓ ✓ ✓ ✓ Dispatched
Dispatched *
*
✓ ✓ Delivered , Placed
Delivered ✓ Invoiced
Invoiced Paid
Paid
place
an order
Dispatched Invoiced
Your state diagram?
go to class
[class
not over]
[class over]
Summary
• We discussed events that change the
state of a data entity and how to model
that.