lundi 6 avril 2015

Does the Service Layer classes breaks the SRP principle?

Well, that came to my mind when i was watching a SOLID video. The Single Responsabily Principle says that "a class should have only a single responsibility".


Thats good. But at the same time, im working in a ASP.NET MVC 5 project architected in N-Layer model. We have the UI layer, the Repository Layer the Domain Layer and the Service Layer to expose. On the Service Layer we have basically one class per Domain class (UserService, CompanyService, etc). The UserService class has one responsability that is to take care of the User operations, but on the other hand, it has a lot of differents responsabilities like Authentication and deal with that User/Company relationship. Is that a violation of SRP principle?


Aucun commentaire:

Enregistrer un commentaire