An online shopping website is a good example of a piece of software that's based around states. In the modern world, we increasingly don't buy things in physical shops, we go online instead and buy things on the web from shops ranging from Amazon to eBay to Alibaba. A website where you will go to buy something is called an e-commerce website, short for electronic commerce. So, what do I mean the e-commerce websites are based around states? As we go through the process of buying something, the website changes in response to where we are in that process, both in terms of what we see and in terms of the data that the website has about us. When we first encounter the website, we're probably just looking for something and we'll go to the default homepage of that website. The first thing you probably want to do is search for a particular product that you're looking for. That puts the site into a second state, which is the search page that shows a number of results, possible products that you might be looking for. You next click on one of those to look more carefully. That's the third state, looking at a particular product. If you choose to buy that product, then you might add it to your shopping cart. The shopping cart is another example of a state. You go from a state where you haven't chosen anything to a state where you have something in your shopping cart. You will be ready to buy the product, but you haven't bought it yet, it's just sitting there in your shopping cart. This is an example of a change of state that's less about what you see and more about the data the website is holding about us. Often the website won't let us put anything in the shopping cart until we've actually logged in. That's another example of a state, whether you're logged into the site or not. When you click "Add shopping cart," a message might come up first saying, "Please login." Once you've completed the login, you will be in the logged in state and also the state where you have something in your shopping cart. From that state we can proceed to the checkout state, where we enter our payment details. The prices of checking out itself typically has a number of states like entering a delivery address, entering your credit card details, and the delivery method. As you progress through the various states, you will be asked to enter different information and at some point, you will be asked to click "Purchase now." When that happens, you're almost at the final state, but there's one last step before you're allowed to reach there. The steps needed to get to the final state isn't done by you, the user. Instead, the website will go and check your payment card has been accepted. It will contact your card provider. So, the move to the next state depends on the transaction somewhere completely different in the world. Only when the payment card check is succeeded does the e-commerce website come back to you and confirm that you're in the final state, you have bought your product. You will either be able to download it if it's a digital product, or you'll be waiting for very physical non-computer based state, a parcel turning up at your house. So, the process of buying something online goes through a lot of different states of the software from browsing products to purchasing. In this case, the sequence is fixed. You do one after the other. Although, you can sometimes go back to the previous step. That isn't always the case with software, you can often move from one state to another in any order. Can you think of a software which has states in a fixed sequence? And one in which the states can be in any order?