What’s the concept behind DAO and CFCs? Is it a separate file for handling all of the inserts, updates, etc? This seems like a lot more work than necessary. What about the concept of a CFC knowing everything about itself? If the DAO functionality is in a separate file, then it seems like this tenant is broken.
Tom,
Sometimes objects may exist without the need to persist them. Sometimes objects may need to be persisted to different datasources or different database types. Having this code abstracted outside of your business objects helps in these situations.
That said, in my meager experience, you tend to know ahead of time if this is required. Implementing the abstract DAO factory pattern is cool, but if you will only ever be on MySQL, its a bit of a waste of time. However, if you know you'll need to support XML, MySQL, Oracle, and SQL in the future, your code will be much more maintainable in separate DAOs.
You can create a EmployeeOracleDAO.update(employee), EmployeeMySQLDAO.update(employee), EmployeeXMLDAO.update(employee), which take the same employee object and save it in different ways.
Chris
------------------------------------------------------------------------
*From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] *On Behalf Of *Bill Rawlinson
*Sent:* Wednesday, April 27, 2005 2:42 PM
*To:* [email protected]
*Subject:* Re: [CFCDev] While we're on the subject of DAOs
I'm going to have to remember the "KISS/YAGNI" phrase. It is exactly what I was trying to say in the thread
about the fileaccess objects dealing with DAOs and XML files yesterday.
On 4/27/05, *Sean Corfield* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:
On 4/27/05, [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:The answer I received in the example previously provided was that it was probably best to have the main object's DAO loop over and call each of the sub object's DAO individually.
Yes, or even not have separate DAOs for the subobjects. If they only exist inside the composite object and have no relevance to anything else, there's no real need to create a separate DAO for them (since you are persisting them as part of the composite DAO already).
KISS / YAGNI would favor having a single DAO for the composite object, only introducing subobject DAOs through refactoring *if* they needed to be exposed in the future. -- Sean A Corfield -- http://corfield.org/ Team Fusebox -- http://fusebox.org/ Got Gmail? -- I have 50, yes 50, invites to give away!
"If you're not annoying somebody, you're not really alive." -- Margaret Atwood
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] <mailto:[email protected]> with the words 'unsubscribe cfcdev' as the subject of the email.
CFCDev is run by CFCZone (www.cfczone.org <http://www.cfczone.org>) and supported by CFXHosting (www.cfxhosting.com <http://www.cfxhosting.com>).
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected] <http://www.mail-archive.com/[email protected]>
-- [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> http://blog.rawlinson.us
If you want Gmail - just ask. ----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).
An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
--
*********************** Chris Dempsey Director, Information Services UCSB Graduate Division Quidquid latine dictum sit, altum videtur.
---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).
An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
