• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Value Objects

 
Prabhu Venkatachalam
Ranch Hand
Posts: 502
Java jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have an Applet that needs to recieve a large block of data from a
server, manipulate it on the client and return it to the server, which pattern
is best suited for this situation?

Answer : Value Objects

can some body explain me?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Value Objects are commonly used to contain data to be sent from one point A to another point B in one access. This avoids asking many times.

A stupid example: A asks B
1. What is this employee's name ?
2. What is this employee's age ?
Two calls

Instead, use a Value Object to store the employee's info and ask once :
1. Give me this employee's information

This is also called "Transfer Object"
http://java.sun.com/blueprints/corej2eepatterns/Patterns/TransferObject.html
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's a great explanation, Satou!
 
Charles Lyons
Author
Ranch Hand
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Everything that's been said is all absolutely correct.

But, I'm going to be pedantic because I hate the inaccuracies in the way some questions are written (particularly those on the subject of patterns):
You have an Applet that needs to recieve a large block of data from a server, manipulate it on the client and return it to the server, which pattern is best suited for this situation?
Actually, my applet needs to load a high-resolution image from the server, so the resource it accesses is a "large block of [image] data"... would I choose a Transfer/Value Object? Not likely, I think I'd choose "none of the above" and just use a basic I/O InputStream!

Right, that's my complaint about bad wording over with, so back to work...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic