<cffunction name="validateBeginDate"> <cfif variables.endDate neq ""> // make sure begin is before end </cfif> </cffunction>
<cffunction name="validateEndDate"> <cfif variables.beginDate neq ""> // make sure end is after begin </cfif> </cffunction> <cffunction name="setBeginDate"> ... <cfset isValid = validateBeginDate()> ... </cffunction> <cffunction name="setEndDate"> ... <cfset isValid = validateEndDate()> ... </cffunction> That way the order in which they are set is moot. The equivalent of an XOR operation :) -----Original Message----- From: Ian Skinner [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 17, 2006 2:41 PM To: CF-Talk Subject: RE: OOD/Design Patterns and ColdFusion. > They do not realize that they should run the validate method The validate method for each attribute would be an internal method, not invoked from the caller page. <cffunction name="setSerialNumber" ...> <cfargument name="serialNumber" type="number" ...> // Validate argument type // Validate argument data // Set attribute to argument value // or // Throw validation error </cffunction> Ok this was my first thought as well, but then how does one incorporate this if the validation requires checking a relationship between two properties, such as BeginDate is always before EndDate. When would you run this? Since one would need both dates set before any sensible validation could be checked, wouldn't one? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:240802 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54