CSPA Exercise 03: Modeling with State Machines

From lectures behaviormodel2010.

Summary of state machine


  • States
    • Start state and End state
  • Input events (incoming messages to entity)
  • Transitions (how states are changing)
  • Output events or actions (what is happening in entity due input)
  • Interface – set of defined input events (messages) the entity is going to get
  • Entity – statement which entity behaviour we are modeling


  • State machine as table (matrix) – is good to present coverage of inputs
  • State machine as graph (diagram) – is good to visualize the transition logic

Design steps (usually)

  • Find out related entities and define entity to model behaviour as state machine
  • Find out interfaces and messages in it the entity is going to get as input
  • Think and find out the states entity could be
  • Think transitions and actions along entity behaviour, remember start end end states (or declarations)

Exercise 03.A

Model a vending machine. Machine takes money from user and serves drinks like Kola, Vissy, Jaffa or Muumi and also return change coins to user.

Give table and graph presentations of state machine(s).

Exercise 03.B

Moved to Homework 02

Last modified: 2013/07/01 14:42