Want to keep learning?

This content is taken from the University of Strathclyde's online course, Understanding Information and Technology Today. Join the course to learn more.

Skip to 0 minutes and 1 second The state transition diagram shows you the time dependent behaviour of the system. So those functions and data– what happens to them and when, but it does not cover the structure or the functions of the system. In some sense, this is the simplest thing in the world, because you just need to explain all the states, and how you can get from one to another. As you will see, this is not exactly how it works out in reality. There are, again, four components of the state transition diagram. The first is obviously the state. The state is a set of conditions that describe the system at any moment in time.

Skip to 0 minutes and 48 seconds So for example, you have your coffee machine, it is in the state of graining your coffee, then it is waiting for you to stop it, or it is waiting for the coffee to run out. It will not stop otherwise. So in this case it is doing something, but it is waiting for something to happen as well. The second step is the transitions, which means getting from one state to another. Now, what is important about the transitions is that they have to be valid. So from some states you can get to some other states, but not from any state to any other state. And you probably start thinking about now the right way that this may actually make things complicated.

Skip to 1 minute and 31 seconds You will see this is not complex, this is only complicated. Difference is that the complex means that it is really, really difficult, there are very messy relationships between different entities. Here, everything is simple, but it is so many of them, so many of them, that you might lose count of it. And there are two components that are a little bit different than the previous two, and both of them are displayed close to the arrow that represents the transition. And they are basically attributes of that. One is called the condition. I prefer to call it a trigger, because this is what triggers the change of the state. So this is what triggers the transition.

Skip to 2 minutes and 23 seconds For example, if you press the switch on button on your coffee machine, then it will start warming the water. The condition, the trigger, was that you pressed that button. And the other part is called the action. It is something that the system delivers back to you, or does a calculation of data that it will store for later use. Now, if we want to look at the whole story of these state transition diagrams, then what we need to know is that there is always, in any sort of state transition diagram, only one single initial state. If you cannot identify an initial state, then you just add idle, and you almost cannot be wrong.

Skip to 3 minutes and 13 seconds So that’s the state in which the system is nothing is going on. Now, there can be many, many different final states. So the whole process of the system can end up in different places. Now, if you, for example, want to write down or draw a diagram of the states of your mobile phone, with a very, very, very small font, you would be easily covering Glasgow– we are in Glasgow now– so you would be covering the whole Glasgow just to describe all the states of your mobile phone. So it means that you will have to have stages of the state transition diagram if you are actually making one. What is the best descriptor of how incredibly complicated this can be?

Skip to 4 minutes and 7 seconds If you are familiar with events like the blue death– so it means when your computer goes frozen and it displays a blue screen. That is actually an undefined state, which means that your computer entered a state from which it cannot exit. And then it stays there. What is really remarkable that, having talked to a few top computer scientists in the world, they said that about 97% of the failures in computers are because the state transition diagram is not good. But imagine if I said that your mobile phone would cover the whole Glasgow, it means that your laptop would cover the whole world. And even then you might not notice all of them.

Skip to 4 minutes and 57 seconds So you need to pay attention if you’re doing this that all the states are defined, that you can exit from any state into which you can enter, and that all the transitions that you consider are valid, so that there is a possibility to go from that one state to that other state. It is also important that you have different ways of approaching this work of building a state transition diagram. One is typically that you start to map all the states, and then you try to figure out from which states you can get into each other states. The other is what they call the avalanche approach.

Skip to 5 minutes and 38 seconds So you take one state, then you say, OK, from this state, where I can go? I can go here, here, here, and here. Then you take one of these from this state. Where I can go? I can go here, here, here. Then you take one of those and so on, and you’ll follow one line. Then you get one step back, follow the other line. Two steps back and so on. What is remarkable is that if you think about a system of any decent complexity, it would normally take you forever to accomplish this. So it is a very, very complicated thing, although the state transition diagram itself is very, very simple.

Skip to 6 minutes and 16 seconds So I will show you now this ATM machine example that I mentioned. We start from the idle state. This is an old fashioned ATM machine, it means that it has a little bit fewer functions. And in the idle state, you actually need to push a button in order to start the first process. Once you press the button, this triggers a transition from the idle state to a different state, and it goes over to the waiting for card state. At the same time, on the screen it displays for you “insert card”. Now, you could expect what the next trigger would be. It is that you insert the card.

Skip to 6 minutes and 58 seconds And when that happens, it triggers another state change, which will be waiting for the password. And it notifies you about this. So the action is that it displays “enter password.” And then once you have entered your password, and it has been accepted, then you get to the screen which is where you can select the function that you want to perform with that particular ATM machine at that particular time. So the ATM enters into the state waiting for your choice. Now here I am starting already to cut off the end of the state transition diagram. So in case you choose to get cash, then it will go into the next branch of giving you the cash.

Skip to 7 minutes and 42 seconds Obviously, this will you lead to the final state that you received the cash. And if you choose different one, for example, that you want to check balance, then it will end up displaying your balance, and so on. What is also very important is that there are all sorts of ways back. So we can see that we can get back from any of the states that we have to the idle state. And that is reasonable because once you have finished what you wanted to do with that ATM machine on that occasion, then you leave, and obviously the ATM machine goes back into the idle state. So if you want to try this out, I suggest that you choose something incredibly simple.

Skip to 8 minutes and 27 seconds If you know that old fashioned device called a fax machine, you can try that. That can fit roughly on A-0 size paper, so a big poster size paper. Or take something like a coffee maker, and so on. Although some of today’s coffee makers tend to be more complex than a fax machine. And we have received, for example, a few days back, a new printer and photocopier at the department, and what you can see now is that anytime you pass the corridor, you can see that there are at least two, three people trying to figure out how to use the photocopier. So that is already something that you could not possibly describe with all states and transitions. Thank you very much.

State-transition diagram (STD)

The STD focuses on the time-dependent behaviour of the system and regards it as a whole. Its purpose is to identify the possible states of the system (as a whole), how it gets from one state to another, how these transitions are triggered and what the system ‘does’ during the transition.

Even if you think about a comparatively simple IS, such as your mobile phone, you will quickly realize that there is a huge number of possible states if you regard it as a whole. You also need to pay attention to make all the transitions valid; e.g. you cannot get into the ‘sms sent’ state on your mobile phone from the ‘contact list displayed’ state. Identifying the states is easiest to do using the ‘avalanche’ approach, i.e. following a process through all of its steps and going back always to the branching points. Due to the very large number of states you will certainly need to partition your diagram but, fortunately, in the case of an STD this can be done simply – just ‘cut’ the transition arrow. Checking the logical consistency is laborious but not particularly complicated. You need to make sure that all states are covered, that it is possible to ‘enter’ each state and that it is possible to exit each. Perhaps most importantly, you need to check that the system responds properly to any conditions (potential triggers). Frequently, crashes of computer systems indicate unhandled states that are entered and cannot be exited; this is so significant that, according to some experts, a poorly constructed STD is responsible for 99% of crashes on personal computers.

Share this video:

This video is from the free online course:

Understanding Information and Technology Today

University of Strathclyde