That sounds fine.  How would you relate the different managers?  What I've
done lately is when I init the main manager, I init its child managers and
pass a reference of the parent to the child.  As in...

articleManager.cfc
<cffunction name="init">
    <cfset variables.JournalManager = createObject("component",
"JournalManager").init(this)>
</cffunction>

then in journalManager.cfc

<cffunction name="init">
    <cfargument name=controller type=any>
    <cfset variables.controller = arguments.controller>

I don't know if this is a good way or a bad way but one way I've been trying
lately.

----- Original Message ----- 
From: "Jon Gunnip" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, December 15, 2003 5:17 PM
Subject: Re: [CFCDev] BO/DAO/Manager CFC's and Inheritance



Sure,

We can take an article as an example.

Say that one had an ArticleBO.cfc, ArticleDAO.cfc, and ArticleManager.cfc.
The ArticleBO.cfc has your properties common to all articles (e.g. Author,
Length), your get/set memento methods, and your validation logic.  The
ArticleDAO.cfc has methods to interact with a database: Create(), Read(),
Update(), Delete().  The ArticleManager.cfc is the entry point for Creating,
Retreiving, Updating, and Deleting articles so it has methods similarly
named.

Say that in actuality, we use subclasses of ArticleBO.cfc for our
application: JournalArticleBO.cfc and WebsiteArticle.cfc.  These components
have the same properties as ArticleBO.cfc.  In addition,
JournalArticleBO.cfc has a JournalName property and WebArticle.cfc has a URL
property.  Say that you want to do the same things to JournalArticles and
WebArticles (Create, Retrieve, Update, and Delete).

I'm wondering how one would model the relationships.

What I am doing now is have the JournalArticleBO.cfc and WebArticleBO.cfc
extend ArticleBO.cfc.  When you set a memento in the child components it
calls super.Validate(), for example.  That is the only inheritance involved.

There are 3 database tables I would design for this example.  ARTICLE with
ArticleID, Author, and Length columns, JOURNAL_ARTICLE with ArticleID and
JournalName columns, and WEB_ARTICLE with ArticleID and URL columns.  (I
could have duplicated the common fields in the JOURNAL_ARTICLE and
WEB_ARTICLE tables and not have had an ARTICLE table, but I thought the
reuse of having the common fields in one table made more sense.)

Then, I have the chilld component managers talk directly to the
ArticleManager.cfc  in order to Create, Retrieve, Update, and Delete the
common properties that exist in ArticleBO.cfc.  ArticleManager.cfc is the
only component that has access to ArticleBO.cfc to update and retrieve the
common ArticleBO.cfc properties from the database.

Does that make sense?

Jon




>>> [EMAIL PROTECTED] 12/15/03 03:01PM >>>
Could you give a more specific example?  Its fun to theorize and I've been
trying a few different ways.  But it helps to have some idea of what kind of
objects you're talking about.


Hello all,

Anyone have recommendations on how best to implement inheritance of a CFC
whose functionality is split between a Business Object, Data Access Object,
and Manager Object similar to Sean's article CFC in the MachII develoment
guide?

Would the ChildBO extend the ParentBO, the ChildDAO extend the ParentDAO,
and the ChildManager extend the ParentManager?  And, then once could call
super.Init(), super.Load(), super.Delete() etc....

Thanks,
Jon

----------------------------------------------------------
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]



----------------------------------------------------------
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]

----------------------------------------------------------
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]



----------------------------------------------------------
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