Python Forum
Database for a College or School
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Database for a College or School
#1
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.

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

  1. Should the Student class have a list of Courses that he/she has enrolled in?
  2. Should Course have a list of students who have enrolled in the class?
  3. Where would Student grade go for each class?
  4. Using this design, how would a professor generate an attendance sheet?
  5. 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?
Reply
#2
Given the requirements as stated, I would say the answers are:
  1. Yes
  2. Yes
  3. In the student object
  4. From a method in the class object
  5. Not yet.
Keep in mind that the database and the Python objects are going to be different things. With a relational database you could have a table with class ids, student ids, and grades. An attendance sheet could be generated  by joining that table with the student table, subsetting rows by the class id.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#3
You might get some ideas here: http://try.orbund.com/einstein-capterra/
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  I've Wanted to do This Since College ichabod801 1 2,257 Aug-01-2018, 08:53 AM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020