We are creating a one-to-many relationship in a class, for example, a student can have many books.
In this class, are we not breaking the Single Responsibility Principle?
Because Student
class has its own business logic. Moreover it would also have logic to add and remove books.
Similarly the Student
can have many EnrolledSubjects
, too.
I have a working system with a Student
class that has relationships with Books
and EnrolledSubjects
. But I think it is violation the SRP.