Skip to content

State transition diagram, decision table and event–action table

Lifecycles, rules for every combination, and responses to events.

What it explains and when it is useful

A state transition diagram shows the states something can be in and the events that move it between them, with guards and actions. A decision table lists every combination of conditions and the action for each. An event–action table lists each event an event-driven program handles and its response.

When to use it: State diagrams: anything with modes or a lifecycle (bookings, orders, game states, a level). Decision tables: rule-heavy logic. Event–action tables: games and GUI programs driven by clicks, keys and timers.

Worked example

Illustrative: PracticePal is a fictional project used throughout this guide.

State transition diagram for a PracticePal booking: it starts Confirmed; it can become Checked in, Cancelled or No-show; Checked in becomes Completed; events, guards in brackets and actions after a slash label each transitionConfirmedcounts towards theweekly capbook()[all rules pass]Checked inCancelledslot is free againNo-showslot is free againCompletedcheck_in()[start − 5 min ≤ now ≤ start + 10 min]cancel() [now < start]or room_blocked()/ offer_next()tick [now > start + 10 minand not checked in] / offer_next()tick[now ≥ end]● start ◉ end · label = event [guard] / action · tick = the scheduler's 5-minute job
The lifecycle of a booking.

Scroll sideways to see the whole diagram.

State transition diagram for a waiting-list entry: Waiting, then Offered when a slot is freed and the student is at the front; Accepted creates a booking; an offer not accepted within 15 minutes Expires and the next student is offered the slotWaitingOfferedAcceptedExpiredjoin()slot freed[front of queue]/ send offeraccept()[≤ 15 min]tick [> 15 min]/ offer next
The lifecycle of a waiting-list entry (SC7).

Scroll sideways to see the whole diagram.

Decision table: may this booking be saved?

Condition / actionR1R2R3R4R5R6
Slot valid?NYYYYY
Room blocked?–YNNNN
Overlaps a booking?––YNNN
3 bookings already this week?–––YNN
Loud and neighbour has loud overlap?––––YN
ActionInvalid timeRoom blockedSlot taken + offer queueWeekly limitNoise clashSave booking

“–” means the condition is not checked (an earlier rule already decided). Six rules cover every case, and the table becomes six abnormal or extreme tests.

Event–action table: week grid page

EventConditionAction
Page loadslogged inGET /api/week; draw grid; show weekly counter
Tap a free cell–Select it; fill booking panel; enable Confirm
Tap a booked cell–Show “Taken”; show Join waiting list
Tap Confirmcounter < 3POST /api/book; disable button until reply
Reply 201–Mark cell “You”; counter + 1; show confirmation
Reply 409–Show reason in error area; refresh grid
Timer every 60 spage visibleRefresh grid (others may have booked)
Press ◀ / ▶within current and next weekLoad that week

Notation and legend

Symbol or partMeaning
● / ◉Start / end
Rounded boxState; a second line can say what is true in it
Arrow labelevent [guard] / action
GuardCondition that must be true for the transition
tickThe scheduler's 5-minute job

Design decisions it communicates

A diagram earns marks when you explain the decisions it shows. In PracticePal's documentation these would each be one sentence:

  • Cancelled and no-show both free the slot by calling offer_next, so SC7 and SC8 share one mechanism.
  • Check-in is only possible inside a window, written as a guard.
  • Every status in the data dictionary appears as a state.

Common mistakes

  • States named as actions (“Cancelling”).
  • Transitions with no event.
  • Missing states that the database allows.
  • Decision tables with impossible or missing combinations.

Checklist for your own version

Ticks are saved in this browser only, so you can use the list while you draft.