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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:02:48+00:00 2026-05-30T14:02:48+00:00

its good practice to pass value object to entity methods (in terms of DDD)?

  • 0

its good practice to pass value object to entity methods (in terms of DDD)?
For example I have a method in my entity Customer:

SetAddress(Address invoiceAddress); 

is it valid? Or I should pass address parameters as

SetAddress(string street, string town, string zip, string country);

and let the customer handle the creation of address object and if needs throw an exception.

Address is immutable object.

  • 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-30T14:02:49+00:00Added an answer on May 30, 2026 at 2:02 pm

    You should definitely pass an Address object. It is valid in terms for DDD and it’s also good for extensibility (i.e. you can add more fields to Address object without changing the signature of the SetAddress method).

    Also the Address object should contain validation logic for address information, which a Customer.SetAddress(...) method can execute before setting the address:

    public class Customer
    {
        public SetAddress(Address invoiceAddress)
        {
            // ToDo: Execute validation logic encapsulated in 'Address' object
            // ToDo: Execute additional validation logic here
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im wondering if its good practice to pass-by-reference when you are only reading a
i read in one article that its not a good practice to pass dataset
Are there good reasons why it's a better practice to have only one return
I know that probably it's a good practice to release appdelegate's ivars in its
I'm wondering if its - a) possible; b) good practice - to log multiple
Is it good practice for an object in Objective-C to commit suicide? That is,
Could someone please provide some good practice to handle exceptions in exception for example
I know, its not a good practice to release a project with SNAPSHOT dependencies.
So I know it's considered somewhat good practice to always include curly braces for
Just wandering if its a good idea to put username and password in the

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.