Validation Rules

Validation rules are the mechanism for describing to the runtime system how it should validate business entities. There are a few important characteristics of these rules:

  • The coding style is declarative. That is, every attempt has been made so the programmer specifies what makes data valid, not how or when the validation should take place.
  • Only in the case of "custom rules" does the programmer need to build the step-by-step logic specifying how the validation should take place.
  • Validation rules are side-effect free. That is, they cannot change the persistent state of the system. This insures that all the validations are performed on the complete set of changes. Likewise, it allows for the startChange()/saveChanges() logic to safely defer the firing of rules until the end of the coherent set of changes.