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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:47:08+00:00 2026-05-11T00:47:08+00:00

In domain driven design, it appears to be a good practice to use Factories

  • 0

In domain driven design, it appears to be a good practice to use Factories to create your domain objects in your domain layer (as opposed to using a direct constructor or IoC).

But what about using the domain object factories in a presenter layer. For instance, say that I was creating a domain object from user input obtained from the presenter.

Here’s an example, say I have a Configuration domain object that has a number of decimal settings.

public class Configuration : PersistantObject {

 public decimal temperature {get;set;}   ...(times 20)   public decimal gravity {get;set;} 

}

In order to create this object in the domain layer, rather than the presenter layer, I would have to pass each of these decimal values as function parameters. Creating an unwieldy function definition and call.

ie ConfigurationService.CreateConfiguration(temperature, …(x20), gravity);

The perhaps better solution would be to create the Configuration object in the presenter layer, and assign all the values of the configuration object directly from the user input, skipping a lengthy function call.

Configuration config = ConfigurationFactory.CreateNewConfiguration();

config.temperature = temperature;

..(x20).. = …;

config.gravity = gravity;

ConfigurationService.SaveNewConfiguration(config);

But I’m wondering if this approach is wrong and why? If both of these approaches are wrong, what is the best approach for creating a lengthy object from user input and why?

Thanks!

  • 1 1 Answer
  • 1 View
  • 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-11T00:47:09+00:00Added an answer on May 11, 2026 at 12:47 am

    I’d advise against letting your domain objects out of the domain layer and into the presentation layer. Keep the presentation layer focused on presentation.

    For this reason, I construct Data Transfer Objects to shuffle data to and from the domain and presentation layers. In your case, have the dialog populate a DTO that is passed to your service and translated into the corresponding domain object.

    You wouldn’t want to construct domain objects from DTOs every time, though. Consider the case where a DTO represents only a subset of a domain object. Re-constructing an existing domain object from such a DTO would give you a partial domain object. You’d probably want to maintain a light-weight cache that held the full domain object so you could do a proper update.

    Essentially, you’d arrive at the DTO solution if you applied the Introduce Parameter Object refactoring.

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

Sidebar

Related Questions

Ok so I've ordered Applying Domain-Driven Design and Patterns: Using .Net , but while
Is anyone using the techniques from Domain Driven Design? I've recently read the Eric
For a rich domain driven design I want to use Guice dependency injection on
I'm trying to find a good, simple introduction to domain driven design, but that
Is it easier to implement domain-driven design when using guids as identity fields instead
I'm trying to learn Domain Driven Design by example and I need your advice.
I'm trying to use domain driven design while creating a website that is publicly
I'm new to domain driven design and would like to hear your thoughts on
I'm new to domain driven design but want to learn it and use it
In Eric Evans' Domain Driven Design approach, would it be a good idea to

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.