Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12141

Violating the Single Responsibility Principle?

$
0
0

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.


Viewing all articles
Browse latest Browse all 12141

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>