Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to model Data Transfer Objects for different front ends?
    primarykey
    data
    text
    <p>I've run into reoccuring problem for which I haven't found any good examples or patterns. </p> <p>I have one core service that performs all heavy datasbase operations and that sends results to different front ends (html, silverlight/flash, web services etc). One of the service operation is "GetDocuments", which provides a list of documents based on different filter criterias. If I only had one front-end, I would like to package the result in a list of Document DTOs (Data transfer objects) that just contains the data. However, different front-ends needs different amounts of "metadata". The simples client just needs the document headline and a link reference. Other clients wants a short text snippet of the document, another one also wants a thumbnail and a third wants the name of the author. Its basically all up to the implementation of the GUI what needs to be displayed. </p> <p>Whats the best way to model this:</p> <ol> <li>As a lot of different DTOs (Document, DocumentWithThumbnail, DocumentWithTextSnippet) <ul> <li>tends to become a lot of classes</li> </ul></li> <li>As one DTO containing all the data, where the client choose what to display <ul> <li>Lots of unnecessary data sent</li> </ul></li> <li>As one DTO where certain fields are populated based on what the client requested <ul> <li>Tends to become a very large class that needs to be extended over time</li> </ul></li> <li>One DTO but with some kind of generic "Metadata" field containing requested metadata.</li> </ol> <p>Or are there other options?</p> <p>Since I want a high performance service, I need to think about both network load and caching strategies. </p> <p>Does anyone have any good patterns or practices that might help me?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload