Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6201229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:30:54+00:00 2026-05-24T04:30:54+00:00

After refactoring some service-layer classes in our java web application, i was asking myself

  • 0

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:

  1. finds users from a database
  2. creates new users
  3. 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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T04:30:56+00:00Added an answer on May 24, 2026 at 4:30 am

    In my opinion, SRP as related to OOP means that state and behavior related to a particular object or entity should all be within a single class. Thus, my opinion is that you would want to keep all methods related to users in a single class, regardless of how many methods there are or how many are needed to carry out a particular task.

    The point of SRP (as I see it) is to make sure that you don’t have domain objects manipulating one another. In other words, if you (hypothetically) had another class called AccountManager, then that class should not have any operation that manipulates a User object directly – as this would violate SRP. Rather, the AccountManager class would need to rely upon the UserManager class to handle any/all user manipulation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a vs.net project, and after some refactoring, have modified the name of
After some find and replace refactoring I ended up with this gem: const class
I have a framework which works this way: After defining some meta data, it
After reading this question , I was reminded of when I was taught Java
I'm currently refactoring some code on a project that is wrapping up, and I
I've been spending some time refactoring my C# code, and I'm struck by how
I'm working with legacy java code, without any Unit-Tests. Many classes need to be
I'm developping an application in java that regulary saves objects onto the hard disk
I have a Crystal Report used in an ASP.NET web application that I've just
After reading the Head First Design Patterns book and using a number of other

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.