Hello All,

I am wondering how/whether I should expose data validation information for arguments 
passed into my components.

Let us assume that I have a Person component that stores a name and age.  At the top 
of the component I am defining:

Variables.MinNameLength = 1;
Variables.MaxNameLength = 50;
Variables.MinAge = 0;
Variables.MaxAge = 120;

These variables are used in a Validate() routine inside the component to make sure the 
instance values passed to a Person.Create() or Person.Update() are in a valid range.

I also have public functions in the Person component such as GetMinNameLength(), 
GetMaxNameLength(), GetMinAge(), GetMaxAge() that return the appropriate values.  The 
idea is that the web pages that accept input for a call to Person.Create() or 
Person.Age() can easily call these GetMin(), GetMax() functions to create things like 
JavaScript validation or to set the size attribute of text input fields.  Thus, bad 
input data can be caught before it is passed to the Person component.  

If the valid length of an allowable name changes, I then need to change the validation 
variables at the top of my component (and probably the size of a database field), but 
not the web forms that use the component.

Does this seem like a good model?  Is it too granular?

It is definitely adding a lot of functions (and coding time) to my components!

Thanks,
Jon

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to