There are four classes:
StudentBase, CourseBase and
StudentDataMapper, CourseDataMapper
An Student object can have a relationship with an Course object. One Student can have many courses. One course can be visited by many students.
In the ER diagram, a Student entity has an attribute called “courses”, but a course does not know anything about his students. A course has no Attribute called “students” in return.
Which of these classes should perform the creation of the relationship?
EDIT: This is the System Layer! In the Business Logic Layer, the developer subclasses StudentBase and CourseBase to create a Student class and an Course class. The developer who creates these classes will not see any of that code, except for his own business logic code.
Neither.
First, the ERD should change; what you’ve described is a many-to-many relationship (a course can have many students and a student many courses). So, the student shouldn’t have a courses attribute but, instead, there should be a student-course entity.
Then there should be a StudentCourseDataMapper class that does what you’re asking (maintaining relationships) and both StudentDataMapper and CourseDataMapper should be aware of and use it.