Deferred Validation

The Whole Value that quantify a domain model have been checked to ensure that they are recognizable values, may have been further edited for suitability by the domain model and have been Echo Back to the user. All of these checks are immediate on entry. There is, however, a class of checking that should be deferred until the last possible moment.

As your user completes a series of entries there will come a point where more extensive action by the computer is expected. This may be a simple query, "how am I doing"; a pause in activity, "I'll finish this tomorrow" or a change in responsibility, "you take it from here". The exact integrity needs will not be known until the computers action is called for.

Therefore:

Delay detailed validation of a domain model until an action is requested. Taylor the extent of the validation to the specific action.

Saving incomplete work in a private location will not require as much validation as posting finished work in a public place.

Validation checks may (but don't always) form a structure with more complex actions requiring all of the checks of simpler activities and then some.

Write methods for your domain model that encode the anticipated use. Have these methods delegate to simpler validations before making their own checks.

Checks should be made in passes so that the most specific problems are reported first. Check to make sure required quantities are present before checking that they and others are consistent.

validateForPublication: noticeHandler self validateForSave: noticeHandler. self validateForComputation: noticeHandler. self validateForPublication: noticeHandler. self validateConsistency: noticeHandler

Expect the individual validation methods to become complex and be subject to regular modification. As such, they may invoke systems designed specifically to validate business rules and restrictions.

Check the obvious before delegating to these systems so that their rule bases are not polluted with trivial (but necessary) checks. See correspondence

Deferred Validations are hurdles over which domain objects must pass on their way into the more public portions of a system.

The system demands validation so that problems can be brought to the user's attention before publication.

The user, on the other hand, may be aware of potential problems beyond those detectable by any strict validation. Instant Projection and Hypothetical Publication offer the user two related strategies for further assessment of entered information.

DOT FROM preview-next-diagram