Thats what I needed to clarify.
 
I always taught of DAOs as "query helpers" for BOs.
They would get data from databases and return it raw to the business objects (ugh!),
or managers, but it seems that this was a misconcept.
 
A DAO should get the data AND populate the object, using the BO methods, right ?
 
I was doing it the wrong way, having the manager getting the data from the DAO through the BO.
 
 
Thanks again.
 

Marcantonio Silva
Product Development - ContentObjects
[EMAIL PROTECTED]
www.contentobjects.com
Phone: +55 11 3055.2004
Mobile: +55 11 7732.4907

 

----- Original Message -----
Sent: Tuesday, January 25, 2005 6:45 PM
Subject: Re: [CFCDev] How to avoid duplication of objects

On Tue, 25 Jan 2005 18:10:22 -0200, Marcantonio Silva
<[EMAIL PROTECTED]> wrote:
  
>  
> Inside the bean I init the DAO from the factory:
>  
> [article.cfc init()]:
> cfset variables.articleDAO = createObject("component","model.factory.DAOFactory").init(arguments.stConfig).getDAOFactory(factoryType:arguments.stConfig.dbtype).getArticleDAO(arguments.stConfig)

It would probably be better if your Article CFC only knew about the
state of an article and what an article can do. It shouldn't have to
worry about how articles are stored. That's the DAO's job.

The DAO should know how to get the data from the database (or an XML
file, or a data gateway, or something) and create an article object
(perhaps with the help of an ArticleFactory).

You only need one DAO. Maybe it comes from a factory that instantiates
the right DAO given a text string ("MSSQL", "ORA", etc). And maybe, if
necessary, you can make sure the factory returns a reference to an
existing DAO if it has already created a suitable one.

HTH,

Patrick




--
Patrick McElhaney
704.560.9117
http://pmcelhaney.blogspot.com
----------------------------------------------------------
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