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 8282287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:19:18+00:00 2026-06-08T10:19:18+00:00

Is one better than the other? Is that even a valid question? I’ve been

  • 0

Is one better than the other?

Is that even a valid question?

I’ve been advised recently that the MyObject.DoSomething() is quite dated and the service way of doing it is preferred. Is that right?

Example:

public class Policy : ICancellable
{
    public void Cancel()
    {
        // Code to cancel working with 'this'.
    }
}

vs

public class PolicyCancellationService
{
    public void Cancel(Policy policy)
    {
        // Code to cancel working with 'policy'.
    }
}

If the service way of doing it is used – can the object be responsible for any functionality or should it just be dumb?

  • 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-06-08T10:19:19+00:00Added an answer on June 8, 2026 at 10:19 am

    I’ve been advised recently that the MyObject.DoSomething() is quite dated and the service way of doing it is preferred. Is that right?

    Both ways are valid; you should choose whichever leads to high cohesion and low coupling.

    As a rule of thumb, you should begin by trying to put it in the class itself, i.e. MyObject.DoSomething().

    You should only use a separate (service) class if:

    • the functionality of DoSomething does not directly relate to the responsibility of MyObject. If you put an unrelated method into MyObject, it leads to low cohesion.
    • MyObject does not have all the information required to perform DoSomething. If you give this additional information to MyObject, it leads to high coupling.

    In your example, if cancellation is an important feature of a policy and the policy has all the required information to perform this operation, you should keep it in the Policy class.

    If the service way of doing it is used – can the object be responsible for any functionality or should it just be dumb?

    Quite the contrary: you should keep as much functionality as possible in the domain objects themselves. Services should be limited to coordinating activities between multiple domain objects; they should preferably not contain any business logic.

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

Sidebar

Related Questions

Is there better way to enumerate all photos on the device than this one?
does one perform better over the other in terms of indexing/quering etc ? e.g.
My question is, which one is better to use? How to properly use a
I can understand that WCF is in general better than Remoting, but the two
I've read repeatedly that OpenID is better for authentication than OAuth (which is for
Which one is better (implicit control flow via return or control flow via if
which one is better for implementing chat for the iPhone with users in the
Which one is better/faster/preferred 1: mov eax, 5 push eax mov eax, [someAddress] push
Which one is better from performance view user control or custom control? Right now
Which one is better to use when it come to return value for example

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.