Value Object (DTO) vs Business Object

L

Leo

OK, this is kind of a conceptual question, so bear with me...

When does a Value Object or Data Transfer Object become a Business
Object, if it even does at all?

For instance, in J2EE we often used DTOs to solve the problem of
transferring data quickly and efficiently from our DAL (EJB) layer to
our middle and presentation tiers. The DTO was a very lightweight
object that simply stored data. We then passed that object to
different handlers and helpers to work with that object.

But I can also see the benefit of embedding the business logic in that
DTO object as well, instead of relying on handlers, etc to do the work.
In doing so, does this object then become a "Business Object" as it is
used all over the net vs a "Value Object"? Is there any real use for a
"Value Object" in dotNET outside just passing objects through
WebServices, etC?

I guess I'm just hoping that someone could explain the difference
between the two different types of objects, when to refer to an object
as one of the other, etc.

Thanks!
 
G

Guest

Hi, all your questions are answered in 'Patterns of Enterprise Application
Architecture' by Martin Fowler. That book it's a must.
 
F

Frans Bouma [C# MVP]

Leo said:
OK, this is kind of a conceptual question, so bear with me...

When does a Value Object or Data Transfer Object become a Business
Object, if it even does at all?

For instance, in J2EE we often used DTOs to solve the problem of
transferring data quickly and efficiently from our DAL (EJB) layer to
our middle and presentation tiers. The DTO was a very lightweight
object that simply stored data. We then passed that object to
different handlers and helpers to work with that object.

But I can also see the benefit of embedding the business logic in that
DTO object as well, instead of relying on handlers, etc to do the
work. In doing so, does this object then become a "Business Object"
as it is used all over the net vs a "Value Object"? Is there any
real use for a "Value Object" in dotNET outside just passing objects
through WebServices, etC?

I guess I'm just hoping that someone could explain the difference
between the two different types of objects, when to refer to an object
as one of the other, etc.

Java and .NET can't be compared in this. In .NET you've rich
databinding capabilities and for example you've to implement
ISerializable in some situations to perform custom remoting
serialization, which requires code inside your object.

All in all it's also a matter of names and definitions voodoo really.
It depends on how many work you want to do yourself: the more you place
code which is required to for example support databinding (e.g.
ITypedList/IBindingList implementing collection classes inside your
objects) outside your data objects, the more work you've to do (for
example by implementing the MVC pattern everwhere.)

Frans

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top