Your DTO should generate errors about stuff that can be classified as
"stupid user".  This happens to be exactly the same stuff that
client-side validation can check.  Things like is "DOB a date", "is
username filled in".

Your BO does the "real" validation, because it has access to the other
resources it needs (like the database, and other BOs) in order to
enforce all the rules for the object.  Checking a username's
uniqueness, for example, requires access to the database.

You can definitely omit the DTO validation and only do validation in
the BO.  Note that the converse is NOT true. In most cases, doing this
will clutter your BO with extra stuff, and make it somewhat more
cumbersome to work with, particularly in cases where you do have the
syntactic validation happening elsewhere.  However, there are
definitely cases where there isn't really any syntactic validation to
perform.

cheers,
barneyb

On Tue, 2 Nov 2004 13:40:25 -0600, Dawson, Michael <[EMAIL PROTECTED]> wrote:
> Hmmm.  Barney, let me throw this comment at you...
> 
> What if valid data _is_ my business logic?
> 
> Also, once I have validated my data in the DTO, I should not expect to
> throw another data-related error in the BO code, right?  Most likely,
> any errors in the BO would be related to, for instance, a broken
> database connection, etc?
> 
> Thanks
> 
> 
> M!ke
-- 
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/blog/

I currently have 0 GMail invites for the taking
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words '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