Nielsen's fifth heuristic is error prevention. So, even better than good error messages is a careful design which prevents a problem from occurring in the first place. Either eliminate error-prone conditions or check for them and present users with a confirmation option before they commit to the action. Why is this important? Well, first of all, mistakes are common. People will make mistakes as we discussed in an earlier heuristic. And we want to try to prevent them as often as possible. As we talked about earlier in the course, people don't see or read everything on the screen. You can't assume that just because you gave them the information they needed to do something correctly, that they're actually going to notice that and do it correctly. People make mistakes just all the time when typing, clicking, et cetera, even if they understand what it is that they're trying to do. So, what are some different ways that we can prevent errors in designing user interfaces? Well, one is, we can provide constraints that guide people towards the correct actions. So, let's give an example. So, imagine a form where you're asked to enter your birth date or enter some kind of a date. If the form field looks something like this, you might enter something, and then more often than not, you present it with an error that says, ''Oh, actually, we wanted it in this particular format, month, day, year, and so forth.'' So, how can we do a little bit better? How could we prevent that error from happening in the first place? Well, one way might be to provide the information as part of the prompt. So, we actually now are asking them to enter their birth date, but we're telling them the format we want it in. But remember, people don't always read that carefully. So, many people might still get this wrong. So, a third way that would even be an improvement upon this, is to provide constraints. So, what we've done here is, we've actually broken the data up into three different fields, and by the size of the fields, we're showing the type of information that we're expecting in each one, and we're labeling each of the fields with the information that we're expecting. So, the first one is not so good, the second one is a little bit better, but the last one is even better than that. But there's techniques that exist to make this experience even better. One of those techniques is in-process feedback, or feedback that is given to the user as they go through the process of filling out a form. And this can be done with technologies like JavaScript for example. I'll show you an example of what happens when you sign up for a Twitter account, and look at what happens when you enter incorrect or invalid information. So, I'm going to enter my name, but then I'm going to enter a bogus email address, and I'm going to enter a short and insecure password. You can see that even before I click the Sign Up button, I'm presented with feedback telling me that the input that I've given is invalid. So, it prevents me from entering erroneous data before I've even gone to the point of clicking Sign Up or completing the action. Another way we can prevent errors before they happen is, ask people to confirm that this is what they really wanted to do when it's a particularly risky operation or perhaps one that can't be undone. So, for example, on a Macintosh, if you empty the trash, that means that you're deleting data that you can't get back. And the operating system will ask you to confirm that this is what you really want to do, and give you the warning that you can't undo this action. So, it asks you to confirm this action which is potentially risky before it does it. Another example is wherever possible, you can just prevent actions that are likely to fail. So, in this example, which is a screenshot from the Android operating system, I was not allowed to update the system because I didn't have enough battery to complete the update. The system designers knew that if the update failed in the middle because the battery ran out, then it would cause corruption to the system. So, it didn't even allow me to do that. So, the key here is, wherever possible, you should try to prevent errors before they even happen, rather than just waiting for them to happen and helping users recover from it.