When we are a making a one to many relationship in a class. For example, A Student can have many Books.
In the class are we not breaking the Single Responsibility Principle?
Because Student Class has it’s own Business Logic. Moreover it would also have logic to Add Remove Book…
Similarly the Student can have many EnrolledSubjects too.
I have a working system with Student class having relationship with Books and EnrolledSubjects. But I’m thinking it is violation the SRP.
user24437316 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.