----- Original Message -----
From: "Alan Colburn" <[EMAIL PROTECTED]>
To: "Borland's Delphi Discussion List" <[email protected]>
Sent: Monday, April 24, 2006 10:01 AM
Subject: Re: Delphi and Java


> Thanks for the response, Kevin. It was amazingly apt, for me, because it's
> *exactly* the point I was reading about last night :-) In fact, your next
> post, about TObjList is apt, too, because (continuing the same example),
> students don't register for single courses & courses aren't assigned
single
> students. Here's what I'm wondering at this point ...
>
> So Student has a field Course of type TCourse, and the Register procedure
> associates a TCourse object with Student--I got that. I also understand
the
> need to create an empty TCourse object in the TStudent constructor. I'm
> assuming that Student.Register (CourseName:String) would need to
> (a) find a TCourse object whose CourseName field matches the one from the
> signature with Student,
No, you just assign a CourseName or CourseNameIndex which will point to a
list of possible courses;
> *have Student's Course field point to this TCourse instead of the blank
one
> created in the constructor,*  AND
This should not be necessary;
> (b) the same TCourse object would need to associate Student with itself
(add
> Student to a TObjList?)...
Nor this!

If you want a list of students associated with each course, you can
construct it at run time
by running through all students one by one to see if they have a coursename
corresponding to the course you
are concerned with;
If you construct a Student->Course structure and a Course->Student
structure, it will be hard to keep both
alligned: it is best to construct one only and derive a reverse relationship
list only as needed from it;

You need two 'course' object structures todefine the variables required:
tCourseAvailable and tCourseAssigned;
the tCourseAssigned object only need a variable that indicates which
tCourseAvailable instance it 'points' to (either an index number or a string
name: you could include the student name, though this is already implicit in
the Tstudent object that 'owns' the assigned course instance):
the tCourseAssigned object is already part of a tstudent object so no
association is necessary
(you need a studentname variable as part of the tstudent object: any tcourse
objects are implicitly associated with this student name!!)

I think you need an objectlist of all courses available
which will have the parameters that you want to associate with each student
();
You could create a 'Faculty_list' object which contains a
'courses_available_list' object, which contains a
list of tCourseAvailable objects:

You can pass the coursename value to the student object which will add a
courseobject for that student, and which by definition is associated with
that particular student (if you have multiple students, you can create a
studentobjectlist component which contains lists of student objects, each
having its own internal list of assigned courses)

College>FacultyList->Faculty->CoursesAvailableList->CourseAvailable

StudentList->Student->CourseAssignedList->CourseAssigned

Are you using a database to store the data: if so you can use a dataset from
the database to read in data to your Student object
and to save new or altered student data;
You can read in data using the usual Master-Detail relationships from the
relevant database tables, the structure of which would resemble the object
stuctures that we have already defined in OO terms;
The types of structures that I am currently developing are very similar,
except they also have methods for writing and reading the data to an
associated database (Object Oriented Database): its a bit advanced if you
are only learning, and database programming knowledge is required (SQL
language etc.);

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to