I'm attempting to do the same thing. In this case I have 2 objects (Page and PageData). When Page.Save() is called, it passes itself to the InsertPage() method of the PageData object which does the actual database operations. I'm just confused as to what all of these methods should be returning. If Page.Save() calls PageData.Validate() before PageData.InsertPage() and there are actual validation errors, what would PageData.Validate() return to Page.Save() (I would assume either an array of validation errors or some sort of message object)... Furthermore, what in turn does Page.Save() return to the calling program (assuming the object was not saved because there were validation errors)?
Thanks, Phillip -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Justin Balog Sent: Friday, October 03, 2003 9:25 AM To: '[EMAIL PROTECTED]' Subject: RE: [CFCDev] Data validation Just to throw in my very humble 2 cents, I do not have save() as a method of any of my objects. I don't believe an object should be able to persist itself. (Kind of like the terminator). I create persister objects that handle saving to the dB. These persister objects take the type of object to persist with a setObjToPerisit() getObjectToPersist(). That way if my data platform changes, I don't have to revisit the objects themselves, I just have to write a new persister method for that type of object. In my application each object has a corresponding persistor type object that has a bunch of persist methods saveSQLServer, saveACCESS, saveWDDX, saveCSV, saveORACLE, etc. Just a thought. Take care, Justin -----Original Message----- From: Phillip Cave [mailto:[EMAIL PROTECTED] Sent: Friday, October 03, 2003 7:51 AM To: [EMAIL PROTECTED] Subject: [CFCDev] Data validation Where is the best place to handle data validation in an object? Should an object's Save() method be responsible for validating it's internal members before actually saving or should the calling program call a Validate() method before attempting to save? Any advice is appreciated. Thanks, Phillip -- Phillip Cave Director, ColdFusion Development Macromedia Certified ColdFusion Developer Carol/Trevelyan Strategy Group 202.448.5212 ---------------------------------------------------------- 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] ---------------------------------------------------------- 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] ---------------------------------------------------------- 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]
