Oct-13-2017, 10:18 PM
(This post was last modified: Oct-13-2017, 10:20 PM by nexusfactor.)
While working on a task today, my brain was occupied by another task that I'm not quite sure how to solve. Either I'm trying to do too many things with a design that doesn't allow it or I'm not thinking about it properly. This isn't an professional issue or problem with code I'm having, so please don't move this thread to General Coding Help, it's more a recreational problem. Here it is:
Suppose you've been tasked with creating a system to allow students to register for a course, and view there grades at the end of the course. This same system should allow the professor to generate an attendance list of his/her class.
The problem I'm having is where would the student grade go? or the student relationship to class.
My thinking is:
A Student can enroll in a class, provided it isn't full.
A Class can have a list of students.
A Student can obtain a grade in the course they enrolled in.
A little Googling turned up this link and this one. Because of the many-to-many relationship, you would create a junction table, but how then would a professor generate an attendance list with the database? Would grade go in the junction table?
Suppose you've been tasked with creating a system to allow students to register for a course, and view there grades at the end of the course. This same system should allow the professor to generate an attendance list of his/her class.
The problem I'm having is where would the student grade go? or the student relationship to class.
My thinking is:
A Student can enroll in a class, provided it isn't full.
A Class can have a list of students.
A Student can obtain a grade in the course they enrolled in.
class Student: def __init__(self, id, firstname, lastname, listofcourses): self._id = id self._firstname = firstname self._lastname = lastname self._listofcourses = listofcourses;
class Course: def __init__(self, courseID, courseName, professor listofStudents): self._courseID = courseID self._courseName = courseName self._professor = professor # A class called professor self._listofStudents = listofStudents self._isFull = False
- Should the Student class have a list of Courses that he/she has enrolled in?
- Should Course have a list of students who have enrolled in the class?
- Where would Student grade go for each class?
- Using this design, how would a professor generate an attendance sheet?
- Am I trying to accomplish too many things with a design that doesn't allow it?
A little Googling turned up this link and this one. Because of the many-to-many relationship, you would create a junction table, but how then would a professor generate an attendance list with the database? Would grade go in the junction table?