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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:45:49+00:00 2026-05-20T17:45:49+00:00

I am writing a web service. I am also writing a web client which

  • 0

I am writing a web service. I am also writing a web client which uses this web service. I’ve experienced some of the pain of trying to send domain objects over the wire (cyclic references, lazy loading, etc. — see e.g. Davy Brion’s post on why it’s a bad idea). So, I am going to use DTOs to transfer between these two tiers.

Being in charge of both ends, I am able to control the design of the DTOs. Now I’m wondering, what drives the design of the DTO? Is it the user interface on the client-side? Do I create DTOs based on what views/screens the client will have? Or it something service-side that should dictate the contract of the DTOs I send out, and the client has to work with what it’s given?

  • 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-20T17:45:50+00:00Added an answer on May 20, 2026 at 5:45 pm

    Designing your DTOs can be a hard task especially because there are many concerns coming into play. Usually performance considerations can prevent you from completely abstracting from the UI. Let’s say you have multiple UI representations for the same object, e.g. a tree, grid and a detail pane. Each of them will need a different subset of properties, based on what you actually display. You can design a common DTO to contain a union of all those properties, but it might be expensive to construct such a DTO, load the data from the store and transfer it over the wire. You might end up transferring a rich object graph with lots of data just to display the name of the object in the UI.

    On the other hand, if you go for a DTO per UI context, you’ll quickly end up with a class explosion problem having hundreds of DTO representing nearly the same object, with a slightly modified subset of properties. Reuse of code and readability will suffer and it might become unmanageable in the long run.

    As there is no silver bullet, it requires a sensitive approach where you find the compromise between the performance and other aspects, maybe using up to 3 different DTO types per Domain object and reusing them in different contexts.

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

Sidebar

Related Questions

I am writing a web service in Java, and I am trying to figure
I am writing a C# client that calls a web service written in Java
ProductA uses our only web service, which is a separate deployment from ProductA. We
I am writing a web service in Java which needs to handle a large
I am writing a web service, thus also writing an XSD to pass to
I'm writing a PHP application which uses a number of SOAP web services to
I'm writing a web-service for Android. The client side will be coded in JAVA
I am writing a WCF web service which allows to register new users in
I'm writing a web service, and I want to return the data as XHTML.
I'm writing a mock of a third-party web service to allow us to develop

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.