
Originally Posted by
Bosmon
I think a point missing from this debate is a characterisation of the different styles of applications. I think there is a natural measure of the "shape" of an application derived by comparing the "breadth" measured at the persistence layer in terms of number of entities/tables &c and the "height" in terms of the number of abstraction layers/tiers, and possibly also in terms of the "richness" or otherwise of the behaviour of the domain model itself.
Some applications are *extremely* wide and low (a project I saw, for example, which consisted of an extremely complex schema designed to categorise and register occurrences of different kinds of cancer), and could be characterised as simply the persistence functionality dressed up in a palatable and coherent user interface. Other applications are quite tall and narrow (perhaps banking/payroll applications) with a rich cascade of interpretation from the highest layers to the lowest.
Certainly for wide applications, the DTO pattern looks ridiculous. The model *is* the persistence model. On the other hand, I can quite easily imagine one or more "surrogate" models arising in "high" applications which are required to broker between the interpretations at different levels. Although I have to say that if a developer finds (as many have reported on this thread) that numerous slightly different representations of the *same* entity structure keep arising at different tiers (which in some cases "classically" represents the DTO pattern) that one has to query whether the design is really as high as it appears - if it is "implicitly" relying on the same representational structure at different levels it may as well do it explicitly and give up a pretence at embodying a rich domain model.