data-transfer-objects

How much business logic should Value objects contain?

One mentor I respect suggests that a simple bean is a waste of time - that value objects 'MUST' contain some business logic to be useful. Another says such code is difficult to maintain and that all business logic must be externalized. I realize this question is subjective. Asking anyway - want to know answers from more perspectives....

Data Transfer Objects and transactional service methods

Is there any truly practical way to avoid using DTOs, when passing data through Hibernate-backed transactional service methods? In other words, are DTOs the only non-hacky solution to avoiding lazy initialization problems? I think the two popular alternatives to DTOs and the reasons I don't really like them are: Open Session in View p...

Why should I isolate my domain entities from my presentation layer?

One part of domain-driven design that there doesn't seem to be a lot of detail on, is how and why you should isolate your domain model from your interface. I'm trying to convince my colleagues that this is a good practice, but I don't seem to be making much headway... They use domain entities where ever they please in the presentation a...

DataGridView Master-Detail for DTOs?

In my Windows Forms app, I two DataGridViews that represent a Master-Detail relationship. The datasource for each is a Data Transfer Object, represented as an IList(of T) -- so DataRelation is out. What is the best way to drive the master-detail grids? Is there a built-in way to do this in .NET or do I have to write my own rebind when...

what is Data Transfer Object?

what is a Data Transfer Object? In MVC are the model classes DTO, and if not what are the differences and do we need both? ...

The meaning of API

Hello, Could anyone please tell me the meaning of API in following paragraph, that's actually about Transfer Object: If it's likely that a business service might be asked to send or receive all or most of its data in a big, coarse-grained message, it's common for that service to provide that feature in its API. Thanks in...

business object, on the wire object and calculator - which is best

i see this pattern over and over again and wanted to get opinions: Option 1: On the wire object and Business object composition: On the wire object - the data that is serialized and sent back and forth across machines (client / server, etc). This is a POCO object. For example: public class Order { public int Price; publi...

Java data transfer object naming convention?

Given this scenario where you have "transfer objects" (POJO's with just getters/setters) which are passed by a client library to your API, what is the best way to name the transfer objects? package com.x.core; public class Car { private String make; private String model; public Car(com.x.clientapi.Car car) { ...

Business Objects - Containers or functional?

Where I work, we've gone back and forth on this subject a number of times and are looking for a sanity check. Here's the question: Should Business Objects be data containers (more like DTOs) or should they also contain logic that can perform some functionality on that object. Example - Take a customer object, it probably contains some...

GWT - Grails rpc with transfer object failing

GWT version: 2.0.0 Grail version: 1.1.2 Grails - GWT plugin version: grails-gwt-0.5-SNAPSHOT, used after 0.4.1 I'm calling a method from the gwt side passing a transfer object, which implements IsSerializable and resides in the client package, so to be compiled into js, also all class properties are of primitive types. Follows a brief s...

DTOs : Several DTO (and Assemblers) for the same resource

Hi, I often need, depending on cases, of several DTOs for a same resource. Take the example of photo Albums. Depending of what i want to display, i'll need different data into my DTOs (creation thru a form, list, details, etc.). I will have an albumFormDTO to create an album, an albumDTO collection for a list of albums, and an albumDe...

Wrapping NHibernate mapped object with DTO

NHibernate mapped objects produce lazy-loading for their references to other objects unless it's set SetFetchMode (Eager) or fetch="eager" attribute. The drawback is that whenever our DAO classes produce the nhibernate-mapped objects for other application tiers (Services, Controllers, UI), they in order may access unloaded proxy referenc...

Are there any frameworks or utilities (in the .NET space) for automatically generating data transfer objects from business objects

I'm looking for the best approach for generating data transfer objects from business objects (the type definition, not mapping the data) using a set of conventions (e.g. all public properties), and possibly configurable to determine how deep to go. I realize that this may not be possible or even desirable for many cases where the dto's ...

Why do transfer objects need to implement Serializable?

I realized today that I have blindly just followed this requirement for years without ever really asking why. Today, I ran across a NotSerializableException with a model object I created from scratch and I realized enough is enough. I was told this was because of session replication between load-balanced servers, but I know I've seen o...

DTO or Domain Model Object in the View Layer?

I know this is probably an age-old question, but what is the better practice? Using a domain model object throughout all layers of your application, and even binding values directly to them on the JSP (I'm using JSF). Or convert a domain model object into a DTO in the DAO or Service layer and send a lightweight DTO to the presentation ...

Dto and domain entities. Did I create my dto correctly?

I have the following domain entity: public class CartItem { public virtual Guid Id { get; set; } public virtual Guid SessionId { get; set; } public virtual int Quantity { get; set; } public virtual Product Product { get; set; } } I have the following DTO: public class CartItemDTO { public CartItemDTO(CartItem c...

Containership Question

Consider this example: namespace ValueObjects { public class User { public string UserCode { get; set; } public string UserName { get; set; } } public class Company { public string CompanyCode { get; set; } } } Now, I want the User class to have a CompanyCode property.. the first obvious solution is just simpl...

Sorrow with Data Transfer Objects in Silverlight / WCF

I have a Silverlight app hosted in an Azure web role ASP project. The ASP project exposes a WCF service. I would like to have one set of class definitions for the data types. Someone recommended making a third project (class library) and adding a reference to it from the SL and ASP. I started doing this, but the Silverlight project comp...

DTO pattern vs Memento pattern

What are the differences between DTO pattern(by Fowler) and Memento pattern(by GoF) in motivation and implementation aspect? Can it be the same classes? If yes, how can I name them (xxxDTO or xxxMemento)? Do they have any principal difference in implementation? Where are their place in MVP architecture? Thanks. ...