Earlier in this lesson, I promised to tell you about turning the computer off and on again when there's a problem. Why does it work? As we've seen, computers and software can be in different states. So far, we've talked about them in an abstract simplified way, but computers can have states at many different levels of abstraction. We've already seen that being off and on is a state which encompasses the whole working of a computer, but the state of a cursor in a word processor affects only one detail of a single application. Let's look at another example from a word processor. The formatting of your document is an example of a state. As you move your cursor around the document, it will pass through lots of different bits of text with different formatting. When we start typing, the text we type will match the formatting of the text around the cursor. So, if I type here, the text will be bold, but here, it will not be. We might think that pressing the E key will always do the same thing, but actually what it does changes massively depending on where you are in the text. Here, it will create a bold character. Here, it will create a character in the heading font. If I select all just before pressing E, it will delete the entire document. All of these little features of formatting and selections are examples of the state of your word processor. That means that the state can be really complex, containing lots of minor individual features. For example, is any text selected, is the current text bold, is it italic, is it underlined? What color is the current text, what font is it, what font sizes it? Is it a title, is it part of a bullet point, is it indented? Those are only ten things from the top of my head. The real state of a word processor is way more complex and contains many more features. At the most detailed level, a state depends on how the computer memory is set up. Your computer memory can store billions of numbers, and you can think of changing any of those numbers as changing the state of the computer. If you think about it that way, the number of possible states your computer can have is really astronomical. In fact, it's more than astronomical. It is more than the number of atoms in the universe. Most of these states won't do anything useful or there's something wrong. Programs are written to avoid non-sense states, but it's hard to be sure. Modern computer programs are very complex things, it is impossible to test every state the program can get into. That means your program might get into a state that doesn't work properly, and you can't get out of it. A common example comes with networked or web-based applications. Modern apps often connect to the internet to get some day or check some information, but what if the internet connection breaks, or if the server won't give you access because you aren't logged in? If the programmer hasn't checked for that eventuality, then something could go wrong. The software could show a blank screen and served the information. What's worse, it might not even show you a back button, or any way of getting out of that state. So, what do you do when you get into one of those strain states? Well, most of the time, when you start a program, it goes back to its default state and forgets about the last state it was in. So, the best fixed for strain state, turn it off and turn it on again.