Hello
Suppose we are designing a UserServiceImpl class which does CRUD(Create, Read, Update, and
Delete) operations. In my view Create, Read, Update, and Delete are four reasons for a
class to change. Does this class violates Single Responsibility Principle? If it violates,
then should we have four classes like CreateUserServiceImpl, ReadUserServiceImpl,
UpdateUserServiceImpl, and DeleteUserServiceImpl. Isn't it an overkill to have lots of
classes?
Suppose i define 4 interfaces each for create, read, update, and delete operations and my
service class implements all the four interfaces. Now i can only have a single
implementation class but by separating their interfaces i have decoupled the concepts as
far as rest of the application is concerned. Is this the right way or you see some problems
in it?
Thanks
Shekhar