Validation library

Validation is a Big Deal in business apps. There's a principle for it:


Don't trust user data

Validate and sanitize user data.

Two things here. First, there are honest mistakes. Someone mistypes a product name, a price, or whatevs. You can have your program catch errors, before they pollute the app's database. Well, catch some errors, anyway.

There's a second reason to not trust user data: hacking. Entering strange data is one way people break into systems. Later, you'll see how to foil Evil Doers.


Job interview

This sounds good in a job interview: "I learned how to check user data for errors."

You did some validation earlier, when we talked about ifs. Let's take that further. In the end, we'll have a validation library, some chunks of code that we can reuse, whenever we need to check data.

Let's get started.