✅ Data & Database Design · Data & Databases
Data Validation
Reject data that violates defined rules.
Bad data becomes expensive later, so validate at appropriate boundaries.
A required email must be present and match an acceptable format.
💡 Like a bouncer checking IDs at the door — stop the problem at the entrance, not after it is already inside causing trouble.
💡 Why it matters
Bad data that slips in spreads quietly and corrupts reports, breaks features, and is costly to clean up later. Validating at the boundaries, where data enters, keeps the inside clean. It also gives users clear, immediate feedback instead of a confusing failure far downstream.
🛠️ How to achieve it
⚠️ Signs of trouble
- •Invalid values show up in reports and break features.
- •Error messages are vague, so users cannot fix their input.
- •The same bad data has to be cleaned up repeatedly.
- •Rules live only in the UI, so other callers bypass them.
🎯 Quick check
Score: 0/3Three questions to test the idea.
1. Why validate data at the boundary?
Answer: To stop bad data before it spreads and gets costly
Catching bad data as it enters keeps the inside clean and avoids expensive cleanup later.
2. Why not rely on the UI alone for validation?
Answer: Other callers can bypass the UI and insert bad data
APIs, scripts and other callers skip the UI, so key rules must also live at the boundary and in the database.
3. What makes a good validation error message?
Answer: It says what is wrong and how to fix it
Clear feedback tells the user exactly what failed and how to correct it, so they can fix their input.
