On Thu, 6 Jan 2005 19:18:14 -0200, Marcantonio Silva <[EMAIL PROTECTED]> wrote: > It seems obvious now that you explained it, and I feel myself a little > stupid for asking.
There are no stupid questions. > I have to confess that trying to built a complex system using design > patterns in CFCs is making me feel like I'm back on school again. Yes, I know what you mean. The OO school can take many years to graduate from! :) > - the DAO is the persistence mechanism. I can change my database for others > or even WDDX or XML if I want. Yes. > - the Bean instantiates the DAO when it needs to persist the content. It > handles the business logic (I'm in doubt about it). A bean is usually a fairly simple representation of data (and maybe some functionality). Most business objects are more complex - handling business logic - and many business objects are not beans (because they do not expose all of their state as getters). Typically some sort of controller (perhaps a CFC, perhaps a framework like Fusebox or Mach II) is what instantiates the DAO. > - the Transfer Object uses the Bean to get me a "snapshot" of the object, > avoiding the business logic to "escape" from the bean. Usually the controller asks the business object to provide a TO with the snapshot. A TO can be a bean. > - the Gateway help me get collections of related objects, this should not > be managed by the DAO. Correct. Generally a DAO is for CRUD operations on a single business object, a Gateway typically provides access to groups of objects (although usually returns raw query data because you typically want aggregate or summary data from a group). Often your controller will use a gateway to get summary data for a "master list" page and then use a DAO to get specific object data when you drill into a "detail" page. Don't return a list of objects from a gateway - it's inefficient and rarely useful. > - the Facade uses all the other CFCs and is a wrapper that actually enables > the whole subsystem to be called externally, acting sometimes like the main > circuit of a fusebox. Yes, the fa�ade can be the controller or be what the controller uses to interact with the other CFCs. If you're using a framework, the fa�ade may be unnecessary because it is implied by the framework itself. For example in FB4.1 you might have a controller circuit that acts as the fa�ade for the CFCs; in Mach II you might have a listener CFC that acts as the fa�ade. -- Sean A Corfield -- http://www.corfield.org/ Team Fusebox -- http://www.fusebox.org/ Breeze Me! -- http://www.corfield.org/breezeme Got Gmail? -- I have 5 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] 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 www.mail-archive.com/[email protected]
