wood burning stoves 2.0*
The moose likes Java in General and the fly likes Value Objects in which layer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Value Objects in which layer" Watch "Value Objects in which layer" New topic
Author

Value Objects in which layer

Rajendra Prakash
Ranch Hand

Joined: Sep 10, 2009
Posts: 293
Value Objects or DTO is in Service layer or web layer.
Jan Groth
Ranch Hand

Joined: Feb 03, 2004
Posts: 456
Value Objects or DTO is in layer in which you need it. don't use this pattern if you dont need it - just overhead.
Rajendra Prakash
Ranch Hand

Joined: Sep 10, 2009
Posts: 293
I was asked in interview. Value Objects is in service layer or web Layer
Jan Groth
Ranch Hand

Joined: Feb 03, 2004
Posts: 456
did you get the job?
Jan Groth
Ranch Hand

Joined: Feb 03, 2004
Posts: 456
if you recall what a value object / DTO is (i assume you do know what this pattern is used for), then you'll probably find different scenarios and aspects in which you want to think about using DTOs. One possible aspect is security, another one would be performance, decoupling a third.

so my point is: you can use DTOs wherever you need them, in the service-layer as well in the web layer.
and my real point is: don't use them unless you have a very good reason to do so. unmotivated DTOs is an anti-pattern.

to answer your interview question:
service layer.

Rajendra Prakash
Ranch Hand

Joined: Sep 10, 2009
Posts: 293
no
Jan Groth
Ranch Hand

Joined: Feb 03, 2004
Posts: 456
sorry to hear ;-)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Value Objects in which layer