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]

Reply via email to