CS TG State Transition Diagrams Important
CS TG State Transition Diagrams Important
9608
For examination from 2017
Introduction
Contents
Introduction ..................................................................................................................................... 2
How to use this guide .................................................................................................................. 2
Learning objectives ..................................................................................................................... 2
Prior knowledge........................................................................................................................... 2
1.
2.
3.
Online resources...................................................................................................................... 6
3.1 Websites ............................................................................................................................... 6
3.2 Videos ................................................................................................................................... 6
3.3 Software ................................................................................................................................ 6
4.
Introduction
Introduction
How to use this guide
The aim of this guide is to facilitate your teaching of Cambridge International AS and A Level
Computer Science topic 4.2.3 State-transition diagrams, part of topic 4.2 Algorithm design
methods. The guidance and activities in this resource are designed to help teachers devise
programmes of study which provide teaching time devoted to theory work as well as activities that
consolidate learning.
Section 1 lists some key terms used in this topic and their definitions. Section 2 introduces statetransition diagrams and provides example diagrams. Section 3 lists some online resources that you
or your learners may find useful, including software packages for creating state-transition
diagrams. Section 4 gives ideas for class and homework activities.
Learning objectives
Using this document should help you guide learners in the following syllabus learning objectives:
Prior knowledge
Before you begin teaching this topic you should:
Key terms
1. Key terms
Word/phrase
Meaning
accepting
state
event
Something that can happen within a system, such as a timer event, or an input
to the system, that may trigger a transition to another state
finite state
machine (FSM)
A system that consists of a fixed set of possible states with a set of allowable
inputs that may change the state and a set of possible outputs
guard
condition
A condition which must be met for a transition to occur from one state to another
state
state transition
diagram
state transition
table
A table that shows all the states of an FSM, all possible inputs and the state
resulting from each input
transition
Play
Press play
button
Paused
Press stop button
The event (press pause when state is Stopped) that does not cause any change in state is
indicated by the circular arrow.
A finite-state machine can also be represented by a state-transition table, which lists all the states,
all possible events, and the resulting state. The following is the state-transition table for the
diagram above:
Current
State
Stopped
Stopped
Play
Play
Paused
Paused
4
Event
Next State
Play
Stopped
Stopped
Paused
Play
Stopped
Locked
1stDigit
2ndDigit
Unlocked
Not 7
The double line around the Unlocked state indicates that lock halts in this state this is also known
as the accepting state.
Online resources
3. Online resources
The following are useful resources for understanding state-transition diagrams.
The content of websites is dynamic and constantly changing. Schools are strongly advised to check
each site for content and accessibility prior to using it with learners. Cambridge International
Examinations is not responsible for the accuracy or content of information contained in these sites.
The inclusion of a link to an external website should not be understood to be an endorsement of
that website or the site's owners (or their products/services).
3.1 Websites
The first part of this tutorial is a useful introduction to the elements of state transition diagrams
http://www.sparxsystems.com/resources/uml2_tutorial/uml2_statediagram.html
Slide presentation of finite state machines and state transition diagrams for the AQA A Level
syllabus, includes a simple turnstile example.
http://community.computingatschool.org.uk/resources/1357
Harel statecharts, their advantages and use in object-oriented programming
http://www.cs.unc.edu/~stotts/145/CRC/state.html
3.2 Videos
State-transition diagrams and testing. This video explains how a state-transition diagram can be
used to generate the tests required to fully test all states of a system. It also gives an easy to
understand overview of state-transition diagrams.
https://www.youtube.com/watch?v=iQwn_jBQ39k
Visual Paradigm software tutorial for drawing a simple state machine diagram. This tutorial goes
through the principles of the bank account state-transition diagram covered in the theory notes in
this resource and it recaps the main principles.
https://www.youtube.com/watch?v=UzUUZRK_Q6Y
3.3 Software
Interactive state transition programming environment. The Kara educational programming
environment will allow you to create and execute state machines.
http://www.swisseduc.ch/compscience/karatojava/
A free 30-day trial of the Visual Paradigm software is available from the link below. This software
will enable learners to try out the drawing of simple state-transition diagrams.
http://www.visual-paradigm.com/download/.
Off
Alarmed (the alarm is switched on)
Sounding
The possible inputs are: turning the alarm on or off with a key, and sensors on (movement
detected which sounds the alarm) or off. The state-transition table that describes the burglar alarm
is a follows:
Current State
Off
Off
Off
Alarmed
Alarmed
Alarmed
Sounding
Sounding
Sounding
Key
Off
On
On
Off
Off
On
Off
Off
On
Sensors
On
Off
On
Off
On
On
Off
On
Off
Next State
Off
Alarmed
Sounding
Off
Off
Sounding
Off
Off
Alarmed