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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T23:36:54+00:00 2026-06-18T23:36:54+00:00

I know a DTO is not a ViewModel. The usage can be the same

  • 0

I know a DTO is not a ViewModel. The usage can be the same when its misused but the origion purpose is different.

I return domain entities from my Repository to the Service.
In my Service I have to reshape the entities due to the needs of my tabular view.

Now I have a conflict. Normally my service would return a DTO with the data BUT in this case the data is reshaped due to the needs of the presentation layer. Someone could say then the DTO is a ViewModel but I do not want to return a viewmodel from my service.

In this case the DTO is a ViewModel, ok the behavior is missing, but what if there is no further behavior.

Something is wrong here.

  • 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-18T23:36:55+00:00Added an answer on June 18, 2026 at 11:36 pm

    It can feel like too much, but don’t overlook that it may be just right now that there is an exact match on what you’re wanting to generate at the service and UI level. There is nothing inherently wrong about having those two pieces separate but nearly identical.

    Often a ViewModel will be further extended to support computed fields, options for UI selection etc. It will always be easier to extend that distinct object down the road without having to blow up your service (and anyone who’s taken a dependency on it).

    On the other hand, I really like to follow YAGNI. So, if you honestly believe there is no way this object is likely to grow, recycling something isn’t always terrible. (More context would definitely help to make this call).

    Finally, don’t spend so much time on the academics of it. You seem to have a pretty good handle on what you’re trying to accomplish, and the only good code is shipped code. Write tests, separate what you can, but get the code out the door. I’ve seen projects fail because of over-engineering.

    Cheers.

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

Sidebar

Related Questions

I know you can not set a key value dynamically, but what about the
I got some services where I return DTOs, now I can reuse the same
can you bind regular HTML form (not using Springs <form:form>) tag to DTO? I
Know this might be rather basic, but I been trying to figure out how
I know that Phonegap has an event for back button, but it's only available
I know that this sort of question has been asked here before, but still
Anyone know how I can make a login button in Ruby on Rails for
i know this is a stupid question but i d'ont know how to do
I know there are lots of tools on the net that can make our
UPDATE 10/19/2010 I know I asked this question a while ago, but the workarounds

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.