Nor are ADO.NET data sets truly suitable as data transfer objects (the objects I shove around via messaging).
http://humbleblogger.blogspot.com/2005/04/aspnet-vs-j2ee.html
Showing posts with label DTOs. Show all posts
Showing posts with label DTOs. Show all posts
Saturday, April 13, 2013
Tuesday, June 12, 2012
DTOs are not Objects
A DTO is a representation of such a piece of data mapped into an object-oriented language. That still doesn’t make them objects in the sense of encapsulation. It would be impossible. Since all input is suspect, we can hardly enforce any invariants at all.http://blog.ploeh.dk/2011/05/31/AtTheBoundariesApplicationsAreNotObjectOriented.aspx
You usually can’t send the domain object itself, because it’s tied in a web of fine-grained local inter-object references. So you take all the data that the client needs and bundle it in a particular object for the transfer—hence the term.
Fowler http://www.drdobbs.com/errant-architectures/184414966
Saturday, May 26, 2012
Extension Methods
In my last project, I used extension method to attach Validate() methods to business objects. I justified this because the business objects where serializable data transfer objects and will be used in diffrent domains as they where general ecommerce entities such as product, customer, merchant etc. Well in diffrent domains the business rules may be diffrent as well so I encapsulated my late bound validation logic in a Validate method attahced to the base class of my data transfer objects.Athens - http://stackoverflow.com/questions/487904/what-advantages-of-extension-methods-have-you-found
Wednesday, April 18, 2012
Internal Service, DTOs, and Ceremony Code
Essentially, an internal service's operations will be either queries or commands. When it comes to queries, why not just do the simplest thing possible? In most cases, it's sufficient to just return the data in the exact same form that the data will be displayed in. Quite often, that means a denormalized set of data where the data comes from more than one type of entity/table. There's no reason to send a bunch of entity-mimicking DTO's that reference each other to the client if you're going to use the data to populate a grid.
http://davybrion.com/blog/2012/02/dtos-should-transfer-data-not-entities/
Data transfer object differs from the above two patterns, mainly because it is a distribution pattern and not a data source pattern as above two patterns. Use it mainly when you are working with remote interface and need to make your calls less chatty as each call can get expensive. So usually design an DTO which can be serialized over wire that can carry all the data back to the server for applying further business rules or processing.CodeToGlory - http://stackoverflow.com/questions/804751/what-is-the-difference-between-the-data-mapper-table-data-gateway-gateway-da
Subscribe to:
Comments (Atom)