Suppose we are developing a UserServiceImpl class that performs CRUD operations (create, read, update, and delete). In my opinion, creating, reading, updating, and deleting are four reasons for changing a class. Is this class a violation of the principle of shared responsibility? If it breaks, then we should have four classes, such as CreateUserServiceImpl, ReadUserServiceImpl,
UpdateUserServiceImpland DeleteUserServiceImpl. Isn't it too much to classes?
Suppose I define 4 interfaces for the create, read, update, and delete operations, and the service class implements all four interfaces. Now I can have only one implementation class, but, having separated their interfaces, I divided the concepts of how much this concerns the rest of the application. Is this right, or do you see some problems in it?
source
share