Software Engineering basics - Validity check &Consistency check
1. Validity Check
Definition:
A validity check ensures that the data entered is correct and acceptable according to predefined rules, formats, or constraints.
Purpose:
-
To ensure that input values are sensible and within allowed limits.
-
Prevents incorrect or invalid data from being accepted by the system.
Examples:
-
A date field should be in the format
DD/MM/YYYY
. -
Age should be a number between 0 and 120.
-
Email addresses must contain
@
and a domain.
Key Point:
-
Validity checks focus on individual data items.
2. Consistency Check
Definition:
A consistency check ensures that related pieces of data do not conflict with each other.
Purpose:
-
To maintain logical integrity and coherence among data items.
-
Detects contradictions or mismatches between related data.
Examples:
-
Start date of a project should not be after the end date.
-
Total of individual line items should equal the invoice total.
-
If a user is marked as "married," marital status details must be present.
Key Point:
-
Consistency checks focus on relationships between multiple data items.
3. Key Differences Table
Feature | Validity Check | Consistency Check |
---|---|---|
Purpose | Ensures data is correct and acceptable | Ensures data is logically coherent with other data |
Focus | Single data item | Multiple related data items |
Example | Age is between 0-120 | Start date ≤ End date |
When Used | During data entry | During data processing or validation of related fields |
Summary
Validity check = Is the data acceptable?
Consistency check = Does the data make sense together?