• Post Reply Bookmark Topic Watch Topic
  • New Topic

Value Objects with Local Interfaces?

 
Justin Krettabull
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are there any benefits to using Value\Transfer Objects with Local interfaces or is it just adding more overhead?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even though by using a local interface, you are passing objects back to the client by reference rather than by value, there are still good reasons to use a transfer object between the business objects in the model and the client.

In many cases, the specific information requested by the client is either a subset of a particular model object, or a combination of more than one model object. In this case, it makes sense to have a transfer object specifically designed for the data the client is requesting.

Another consideration is security. Quite often, the model object is persistent, as with an Entity Bean, or a JDO persistent class. Do you really want the client to be able to set properties on this persistent object without going through your facade?

If neither of these considerations apply, as in the case where the client is requesting exacly what is in the model object, and the model object isn't persistent, then I'd say go ahead and send the model object.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!