mercredi 3 juin 2015

Value Object vs Data Transfer Object

I was a part of one of the project where we were producing java webservice and publishing into server. Some other java application was consuming the web service through extjs.

In that producer application was following Domain Driven Design. We were using two types of pojos , Domain Objects and DTO objects. Both the classes were having same properties variables. And DTO class was implementing Serializable class.

First we were creating the domians objects from db call and then converting the domains objects into dtos and published in websevice.

Now what i want to know is this a good practice to have these two types of objects ? Why the dtos were implementing serialzable( one reason could be to maintain the state of the objects while webservice call through network --- this reason i found in net, but not clear to me ) ?

Any link to this or expert's explanation is welcome.

Thanks in Advance.

Aucun commentaire:

Enregistrer un commentaire