That answers a lot of questions for me. Seems like I should've known that
already, but somehow had escaped me till now.
THANKS!
----- Original Message -----
From: "Barney Boisvert" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 09, 2003 2:30 PM
Subject: RE: [CFCDev] design question...
> All references to CFCs are pointers, so you needn't do anything special at
> all.
>
> method getClassFromId(id) {
> var result = createObject("component", "Class");
> // get the data
> result.setName(name);
> // ...
> return result;
> }
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > Behalf Of Nelson Winters
> > Sent: Thursday, October 09, 2003 11:21 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [CFCDev] design question...
> >
> >
> > Barney,
> >
> > Thanks for your response! This helps me understand things better.
> >
> > Does the array of class objects in the student object contain copies or
> > pointers to the class objects.
> >
> > If they're copies, when someone updates the time a class starts, do I
need
> > to loop through all the students and update any class objects
> > that refers to
> > the class that was updated?
> >
> > If they're pointers, what am I returning in the getClassFromId(classID)
> > method to make them pointers?
> >
> > -Nelson
> >
> >
> > ----- Original Message -----
> > From: "Barney Boisvert" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, October 09, 2003 1:12 PM
> > Subject: RE: [CFCDev] design question...
> >
> >
> > > I assume your queries are all in your Student and Class CFCs?
> > >
> > > For a situation like this, I'd set up three CFCs (possibly
> > more), Student,
> > > Class and EnrollmentManager. Student and Class probably wouldn't
change
> > > much from what you have. Student (in addition to basic get/set
methods)
> > > would have addClass(), removeClass() and getClasses(). Class would
have
> > the
> > > corresponding methods for Students. I'd use an array as an instance
> > > variable for storing the list in both cases.
> > >
> > > When a student registers for a class, you'll call a method on the
> > > EnrollmentManager CFC, which would create the necessary Student
> > and Class
> > > objects, and then pass them to eachother's addXXX() methods:
> > >
> > > method registerForClass(studentID, classID) {
> > > var student = getStudentFromId(studentID);
> > > var class = getClassFromId(classID);
> > >
> > > class.addStudent(student);
> > > student.addClass(class);
> > > }
> > >
> > > Then, when you go to update a student in the database, your update the
> > > student table just like you're doing now, and then check the
enrollment
> > > table to see if it matches the classIDs that are stored in your array
of
> > > Classes. If any are extra, delete them, if any are new, add them.
> > >
> > > When you instantiate a Student from the database, you'll use a similar
> > > mechanism. Create the Student object, and then either pass in
> > an array of
> > > Class objects, or add them individually with the addClass() method.
> > >
> > > That being said, I really don't like the idea of any
> > persistance code in a
> > > business object CFC (Class, Student), because if you then change
> > persistance
> > > mechanism, you have to wade through a lot of code to make the changes.
> > I'd
> > > strongly recommend you build a persistance CFC (either a global one,
or
> > one
> > > for each distinct BO type) that accepts a BO and persists it, whether
> > > insert, update or delete. That's also where your methods for
> > creating new
> > > BOs would probably reside.
> > >
> > > HTH,
> > > barneyb
> > >
> > > > -----Original Message-----
> > > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > > > Behalf Of Nelson Winters
> > > > Sent: Thursday, October 09, 2003 9:54 AM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: [CFCDev] design question...
> > > >
> > > >
> > > > I've been having difficulty understanding how to model the following
> > using
> > > > CFC's:
> > > >
> > > > Suppose I'm trying to create a model where I have students
> > and classes.
> > I
> > > > would think that I would have a student type and a class type. I
> > > > would also
> > > > like to be able to call a student.getClasses() to retrieve the
> > > > classes that
> > > > the student is in. I would also like to be able to call
> > > > class.getStudents()
> > > > to retrieve the students in the class. Set this up in a
> > > > relational table, I
> > > > would have a table for students, classes and class
> > enrollment. However,
> > I
> > > > don't understand how to store the relationship using objects?
> > > >
> > > > Any insight would be much appreciated.
> > > >
> > > > -Nelson
> > > >
> > > >
> > > > ----------------------------------------------------------
> > > > You are subscribed to cfcdev. To unsubscribe, send an email
> > > > to [EMAIL PROTECTED] with the word '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 word '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 word '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 word '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 word '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]