Daniel, 

What if you changed the CFC so that it not only kept track of whether
it has any errors but actually kept an array of each error that
occured? You would have to make sure that you update the hasErrors
variable whenever you add to the array. But if hasErrors is a function
you could just have it return true if the array is not empty or false
if it is.

<cffunction name="hasErrors" returnType="boolean">
  <cfreturn arrayLen(variables.errors) gt 0>
</cffunction> 

What if you eventually decided that keeping track of errors was
becoming a complicated business and deserves to be a CFC of its own?
Such a change shouldn't affect any code that uses your original CFC.
Your hasErrors function would change to something like this.

<cffunction name="hasErrors" returnType="boolean">
  <cfreturn variables.errorCollector.hasErrors()>
</cffunction> 

It does seem like an inordinate amount of code but IMHO it's well
worth the extra reading. I saved myself all the typing by creating a
snippet in CFECLIPSE.

Patrick


-- 
Patrick McElhaney
704.560.9117
http://pmcelhaney.blogspot.com
I still have 5 gmail invites.
----------------------------------------------------------
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 
[EMAIL PROTECTED]

Reply via email to