So, you have to generate the CFC file and a separate DAO CFC file? Hmm, seems like a lot of extra work when you can simply introspect the properties and create the insert, updates etc. This assumes the property names and the table field names match up. Although you could theoretically have an alias attribute to a property that maps the cf property to the database table.
I've found that while this works in theory, in can be extremely fragile in practice. All of the wonderful tools floating around this list and others that generate code based on one or more of these design artifacts are very helpful, but usually require at least some manual tweaking.
But that's just my point of view - I prefer a little more explicit code than "magic" - in my opinion, definitely easier to debug and extend.
I thought it was best practice for an object to know everything about itself. There's a school of thought that objects model real world things and should know everything about itself. If you follow this point of view, then an object also knows how to display itself. There's no reason why you cannot have a save SQL method and a save xml method, etc.
Objects are powerful.
Agreed! My business objects know quite a bit about itself - all of its attributes and methods it uses to accomplish business. However, it doesn't know about persisting nor reporting, which I've delegating to DAOs and Gateways respectively.
To each their own, I suppose - Ray Camden's excellent blogCFC keeps everything together, though when I tried to tweak it a little bit, I found that having all of the persistence and gateway methods in the same object made it hard to read and confusing.
Chris
--
*********************** 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]
