After refactoring some service-layer classes in our java web application, i was asking myself at which point it is reasonable to stop adhering to the Single Responsibility Principle (SRP) and to keep the maintainability and readability of the code. Now I am asking you about your experience with this issue.
Example:
Assuming a UserManager class which does the following:
- finds users from a database
- creates new users
- manipulates existing users
Case A: Every of these three responsibilities consists of several methods which perform their tasks.
→ It would be clear for me to split it into three classes.
Case B: Every of these three responsibilities consists of only one method.
→ What would you suggest in this case? Should this be separated into three tiny classes or left in the UserManager class?