Design a Student-Course-Teacher-Semester spreadsheet
Recently I was asked to design for curriculum application (in Jav开发者_JS百科a) model dealing with Student/Teacher/Semester/Course entities. It is something like spreadsheet design problem.
The condition was: a student can enroll for a course, taught by some teacher, for a semester occurring at a particular time, say at semester-2.
A student may have multiple courses, taught by multiple teachers (each teacher teaches a specific course) at multiple time (each course occurs at an unique semester). Thus the combination of student + course + teacher+ semester is unique.
What will be a smarter design?
I initially started with a class having student id and a Map where the map has 'key' value set to Course-id and 'value' set to another class, say TeacherSemester. The TeacherSemesterclass contains the TeacherId and SemesterId values.
But this does not seem to be a scalable solution. Can anyone suggest a better design? Any discussion will be helpful.
Thaks
Teacher and Student are roles, they aren't classes.
class Person
{
string Name
}
class Course
{
List<Person> enrolledStudents
List<Person> teachers
Semester semester
CourseTime time
}
class Application
{
List<Course> courses
List<Person> persons
List<Semesters> semester
List<CourseTime> courseTimes
}
精彩评论