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.
- The programmer needs to build the step-by-step logic specifying how the validation should take place only in the case of custom rules.
- Validation rules are side-effect free. That is, they cannot change the persistent
state of the system. This ensures that all 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.