liveBook · Manning

Validation

As explained in Grokking Software Architecture

Data validation is the enforcement of rules that determine whether stored values are valid and conform to required constraints.

Data validation checks that values satisfy required rules before they become trusted system state. Treat every boundary as a checkpoint: client-side checks can give quick feedback, but the server must enforce critical business rules, and the domain layer should be a final defense. section 4.3.1 section 6.2.4

Put checks where they provide useful feedback and protect system integrity:

  • Use database types as guardrails: store dates as dates, flags as booleans, and status codes as integers. A DATE column rejects an impossible date such as February 31; a string can preserve it until later code fails. section 8.5.2
  • Validate input at each layer. A client can check email format for immediate feedback; the server decides whether that email is allowed to register. section 4.3.1 section 6.2.4
  • Keep validation on write paths through required layers. Bypassing an application layer may reduce boilerplate for simple reads, but can skip rules and weaken separation of concerns. section 4.3.1

Two checks, two jobs

A client checks whether an email contains an @ symbol; the server checks whether registration is permitted. The first makes feedback fast, while the second protects the system’s rules. section 6.2.4

How Grokking Software Architecture covers it

How deep it goes
Explains type-based guardrails and layer responsibilities, but stops short of validation algorithms or implementation details.
Examples
Uses impossible dates, Boolean and status-code storage, and client-side email-format checks versus server-side registration rules.
What you can do after
Apply validation across layers by choosing suitable database types, giving clients fast feedback, and enforcing critical rules on servers.
How it connects
Connects validation to database data types, layered architecture, separation of concerns, and defense in depth.

Also explained in

Compare how 44 books explain validation →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Software Architecture. The section links point to the parts of the book it draws on.