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

  • SEARCH
  • Home
  • 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 122669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T04:09:55+00:00 2026-05-11T04:09:55+00:00

If I break my Objects down to ‘Single Responsibilities’, is there a fundamental thought

  • 0

If I break my Objects down to ‘Single Responsibilities’, is there a fundamental thought whether like objects should live together or separately, for example if I have

class Employee_DataProvider() : IEmployee_DataProvider { ... }; class Employee_Details() : IEmployee_Details { ... }; class Employee_Payroll() : IPayroll() { ... }; class Employee_LeaveProcessing() : ILeaveProcessing_Client { ... }; ... 

Is it bad smell to have all these living inside, yet loosely coupled to through interfaces, an owning Employee class:

class Employee {     IEmployee_DataProvider _dataProvider;     IEmployee_Details _details;     IPayroll _payroll;     ILeaveProcessing_Client _leaveProcessing;      //My functions call the interfaces above  } 

or is the thinking more around keeping these classes completely separate (or as least as separate as is posible) in the code? Or are both these methods a valid usage of SRP?

EDIT: I do not want critique on the feasibility of the object given in the example, I just made it up to illustrate the question. I agree data, leave and payroll processing are not the domain of the employee class.

It does appear though that SRP is asking me to move away from the object as real world representation to object as a properties and methods around a single functional concept

  • 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. 2026-05-11T04:09:55+00:00Added an answer on May 11, 2026 at 4:09 am

    Although no one has yet addressed my actual question regarding the principle itself, rather than the somewhat poor example I gave, of an Employee object knowing too much about the processes that affect it, for those who are obviously interested in the question (there are 2 ‘favourites’ stars) I’ve done a bit more further reading, although I was hoping for more of a discussion.

    I think what the two current answers are trying to say is that responsibilities separated should be able to be stand alone, and that my example was a perfect example of what not to do. I am more than happy to accept that.

    There is a paragraph from ObjectMentor (Uncle Bob’s site) that has an example that combines Connection and DataReader objects (two objects previously living in a modem class then separated out) into a ModemImplementation, but states

    However, notice that I have recoupled the two responsibilities into a single ModemImplementation class. This is not desirable, but it may be necessary. There are often reasons, having to do with the details of the hardware or OS, that force us to couple things that we’d rather not couple. However, by separating their interfaces we have decoupled the concepts as far as the rest of the application is concerned.

    We may view the ModemImplementation class is a kludge, or a wart; however, notice that all dependencies flow away from it. Nobody need depend upon this class. Nobody except main needs to know that it exists. Thus, we’ve put the ugly bit behind a fence. It’s ugliness need not leak out and pollute the rest of the application.

    I think the line ‘notice that all dependencies flow away from it’ is an important one here

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

Sidebar

Related Questions

There are many systems that depend on the uniqueness of some particular value. Anything
This question is specifically related to overriding the equals() method for objects with a
I am currently implementing a method that accepts two bitmap objects. We can assume
As we know, C# objects have a pointer to their type, so when you
I'm writing a game for school in OpenGL. Since there will be several more
I thought that I could use SimpleDB to take care of the most challenging
I have been adding dependency injection to my code because it makes by code
What i'm trying to do is create a template array class that will store
I'm new to ASP.NET MVC so this may be a stupid question. I have

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.