title: Spring MVC: should service layer be returning operation specific DTO's?
body: <p>In my Spring MVC application I am using DTO in the presentation layer in order to encapsulate the domain model in the service layer. The DTO's are being used as the spring form backing objects.</p>
  
  <p>hence my services look something like this:</p>
  
  <pre><code>userService.storeUser(NewUserRequestDTO req);
  </code></pre>
  
  <p>The service layer will translate DTO -> Domain object and do the rest of the work.</p>
  
  <p>Now my problem is that when I want to retrieve a DTO from the service to perform say an Update or Display I can't seem to find a better way to do it then to have multiple methods for the lookup that return different DTO's like...</p>
  
  <pre><code>EditUserRequestDTO userService.loadUserForEdit(int id);
  
  DisplayUserDTO userService.loadUserForDisplay(int id);
  </code></pre>
  
  <p>but something does not feel right about this approach. Perhaps the service should not return things like EditUserRequestDTO and the controller should be responsible of assembling a requestDTO from a dedicated form object and vice versa.</p>
  
  <p>The reason do have separate DTO's is that DisplayUserDTO is strongly typed to be read only and also there are many properties of user that are entities from a lookup table in the db (like city and state) so the DisplayUserDTO would have the string description of the properties while the EditUserRequestDTO will have the id's that will back the select drop down lists in the forms.</p>
  
  <p>What do you think?</p>
  
  <p>thanks</p>