[TransWarp] Constraints on model attributes

Roché Compaan roche at upfrontsystems.co.za
Sun Jul 27 16:53:47 EDT 2003


* Phillip J. Eby <pje at telecommunity.com> [2003-07-27 21:31]:
> If what you really want is to "validate", you probably don't want to use 
> any of the existing machinery.  Instead, you should define an interface 
> expected of features, that defines a validation method, and then require 
> features to have that method.

This makes perfect sense but I must think of way that won't lead to a
duplication of code because the validation code will have to do some of
the same checks that mdl_normalize will do.

> The distinction in my mind between normalization and validation, is that to 
> validate, you want to validate *all* your values and assemble a series of 
> messages, so that you can give them all to the user.  So, you don't want to 
> throw an error in the midst of modifying, say, a  multi-element sequence 
> because one of the items is wrong.  You just want to validate the values 
> and see if they're okay.

As long as you catch all the exceptions you can still display all the
validation failures to the user.

-- 
Roché Compaan
Upfront Systems                 http://www.upfrontsystems.co.za



More information about the PEAK mailing list