Currently, I’ve created 2 classes: Students and Courses. All we’re going to focus on here are the proficiencies. So, each course_type has their own set of proficiencies (saved in course_proficiencies – and each course has a course type). Once a student signs up for a course, I want to be able to track how many proficiencies they have completed (once a student completes a proficiency, a row is added to student_proficiencies).
a schema http://slickrocksolutions.com/test/schema.png
Now.. In order to get proficiencies(and completed proficiencies), should I create a new class called StudentProficiencies with getCourseProficiencies() and getCompletedProficienciesByStudent($studentID), or, should I do something:
$course->getCourseProficiencies();
$student->getCompletedProficiencies($courseId);
And, how would you recommend me adding a proficiency? If I don’t create a new class, it could be:
$student->completeProficiency($proficiencyId, $courseId);
Any thoughts?
Three classes:
Student,
Course,
Proficiency
Course_type is a property of Course.
hash tables as follows:
course_type_to_proficiency,
course_to_student,
course_to_course_type
I think that should allow you to do a Student method to look up proficiencies with a query similar to this:
Student->get_proficiencies( // connec to DB etc,
‘SELECT cttp.proficiencies FROM course_type_to_proficiency cttp INNER JOIN course_to_course_type ctct ON cttp.course_type_id = ctct.course_type_id INNER JOIN course_to_student cts ON ctct.course_id = cts.course_id WHERE student_id = ###’
No need to make course type it’s own class unless it doesn more than just join courses, students, and proficiencies. If you need to track a completed field per course, or course_type create another hash table with for that.