Ben, 

I'm doing something similar with redesigning our local user group's
website with Meetings and Presentations. In looking through a number of
sample apps, I like the idea of having an id in the bean which is a
reference for use in the gateway object to get the other beans
information. For example, a Presentation is part of a meeting, thereby
containing a meetingID as one of its properties. So I use one of the get
functions in the PresentationGateway to call the MeetingGateway as:

MeetingGateway.getMeeting(variables.presentation.getMeetingID());

In the MeetingGateway, I have a function call back to the presentation
like:

PresentationGateway.getPresentationByMeeting(variables.meeting.getMeetin
gId());

The gateway function both instantiate/utilize the proper beans/DAOs to
return either a Presentation or Meeting object depending on which side
it's coming from. 
I know in the Klondike records sample app from the ColdSpring source
(written by Chris Scott), there is something similar for artists and
genres where the base object is a Record, but the record contains the
instance variables of genreId and artistId. Thanks,

Phil

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Ben Nadel
Sent: Wednesday, December 14, 2005 1:23 PM
To: [email protected]
Subject: [CFCDev] Object relations, getting, setting, and validation Oh
My!

Starting to get a better handle on the whole OOP but another question. I
know this has been touched on before on different threads, but a
me-specific
example would help me wrap my head around it.

Lets say I have a publication. It can have authors. It can be associated
to
categories. 

What I am thinking is having the following items (naming is to be
clear):

PubicationEntity
PublicationDAO
PublicationGateway

AuthorsGateway
CategoriesGateway


I understand the straight up bean data. What I am needing help with is
the
non-bean data such as authors and categories (defined by joining, rather
than row data). 

What I am thiking is that the pub entity has methods like GetAuthors()
and
GetCategories() But instead of doing anything, what the pub entity
really
does is just redirect to the appropriate gateways:

<cffunction name="GetAuthors" returntype="query">
        Return
VARIABLES.AuthorsGateway.GetByPublication(VARIABLES.Instance.ID) />
</cffunction>

<cffunction name="GetCategories" returntype="query">
        <cfreturn
VARIABLES.CategoriesGateway.GetByPublication(VARIABLES.Instance.ID) />
</cffunction>


Maybe I am way off base here (its happened before), but what I like
about
this is it really separates out the different pieces of data. 

Now this is just the GETTING side of things. I am not sure how I would
do
the validation/setting side. Like, if a Pub needed at least one
author...
where would that validation be? I assume it would be part of the Pub
Entity
Bean, but then it would have to store author data in order to validate
count... hmmmm. 

One step at a time.

Any help would be great. I think once I get passed this linked object
step,
the rest of the object relationships will make sooooo much more sense.

Thanks!
......................
Ben Nadel 
Web Developer
Nylon Technology
6 West 14th Street
New York, NY 10011
212.691.1134
212.691.3477 fax
www.nylontechnology.com

"Vote for Pedro"




----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[email protected] with the words 'unsubscribe cfcdev' as the subject of
the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.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' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]


Reply via email to