Part II. Integrity Constraints

For catching various cases of flawed data, we need to define suitable integrity constraints that can be used by the application's data validation mechanisms. Integrity constraints may take many different forms. The most important type of integrity constraints are property constraints, which define conditions on the admissible property values of an object of a certain type.

Table of Contents

5. Integrity Constraints and Data Validation
1. Introduction
2. Integrity Constraints
2.1. String Length Constraints
2.2. Mandatory Value Constraints
2.3. Range Constraints
2.4. Interval Constraints
2.5. Pattern Constraints
2.6. Cardinality Constraints
2.7. Uniqueness Constraints
2.8. Standard Identifiers (Primary Keys)
2.9. Referential Integrity Constraints
2.10. Frozen Value Constraints
2.11. Beyond property constraints
3. Responsive Validation
4. Constraint Validation in MVC Applications
5. Criteria for Evaluating the Validation Support of Frameworks
6. Quiz Questions
6.1. Question 1: Where to Check Constraints
6.2. Question 2: Where to Define Constraints
6.3. Question 3: Counting Constraints
6.4. Question 4: Constraint Names
6.5. Question 5: Compliant Objects
6. Constraint Validation in a Plain JS Front-End App
1. Introduction
2. Using the HTML5 Form Validation API
3. New Issues
4. Make a JavaScript Data Model
5. Set up the Folder Structure with Library Files
5.1. Style the user interface with CSS
5.2. Provide general utility functions and JavaScript fixes in library files
5.3. Create a start page
6. Write the Model Code
6.1. Summary
6.2. Encode the model class as a constructor function
6.3. Encode the property checks
6.4. Encode the property setters
6.5. Add a serialization function
6.6. Data management operations
7. The View and Controller Layers
7.1. The data management UI pages
7.2. Initialize the app
7.3. Initialize the data management use cases
7.4. Set up the user interface
8. Run the App and Get the Code
9. Evaluation
10. Possible Variations and Extensions
10.1. Adding an object-level custom validation function
10.2. Simplifying forms with implicit labels
11. Points of Attention
11.1. Database size and memory management
11.2. Boilerplate code
12. Quiz Questions
12.1. Question 1: Validation in Setter (1)
12.2. Question 2: Validation in Setter (2)
12.3. Question 3: Methods to Add in JS Data Model
12.4. Question 4: Implementing Constraints
7. Practice Projects
1. Project 1 - Validate Movie Constraints
2. Project 2 - Validate Country Constraints