Thank Sean,
 
It seems obvious now that you explained it, and I feel myself a little stupid for asking.
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.
 
Anyway, let me know now I'm approaching a solution design for my CMS, and a good understanding of the parts of it:
 
-  the DAO is the persistence mechanism. I can change my database for others or even WDDX or XML if I want.
-  the Bean instantiates the DAO when it needs to persist the content. It handles the business logic (I'm in doubt about it).
-  the Transfer Object uses the Bean to get me a "snapshot" of the object, avoiding the business logic to "escape" from the bean.
-  the Gateway help me get collections of related objects, this should not be managed by the DAO.
-  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.
 
I will eventually wrap the Facade with custom tags, to have a simpler API for HTML and interface developers
 
- Am I'm missing something ?
 
 
Regards,
 

Marcantonio Silva
Diretor de Desenvolvimento de Produtos - Navita
[EMAIL PROTECTED]
www.navita.com.br
Tel: +55 11 3055.2004
Cel: +55 11 7732.4907 (novo)

 

----- Original Message -----
Sent: Thursday, January 06, 2005 6:52 PM
Subject: Re: [CFCDev] Should bean extend DAO ?

On Thu, 6 Jan 2005 18:48:10 -0200, Marcantonio Silva
<[EMAIL PROTECTED]> wrote:
> Is it good or bad design to make my beans extends the DAO ?

Bad design. A DAO is for data access. A bean is not.

> The difference would be in the bean, if I extend the DAO, I would not have
> to instantiate it in my init or pseudo constructor, and could call the DAO
> CRUD methods
> easily from the bean body.

The whole reason for having a separate DAO is to decouple an object
from its persistence mechanism. Extends (inheritance) is just about
the tightest coupling you can have so you do not want them related
like that!
--
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]

Reply via email to