Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Value Object

 
Bhavik Patel
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone follows this pattern for transferring the data back and forth...My method signatures accepts the String[] only ..so using Value Object may just add an extra layer but less network load...First question Value Object pattern is suitable here or not as the signature is purely with String[]...But the thing that concerns me is
In non-network mode, the database and GUI must run in the same VM and must perform no networking, must not use loopback networking, and[BOLD] must not involve the serialization of any objects when communicating between the GUI and database elements. [/BOLD]
..If i create lets say Record class as value object class then i must implement the Serializable..so will it break the specs as i will be using the same Record class in local mode (which should not involve serializable stuff)..really confused..
 
Oricio Ocle
Ranch Hand
Posts: 284
Debian Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Bhavik.
I have implemented it for the exact find method.
..If i create lets say Record class as value object class then i must implement the Serializable..so will it break the specs as i will be using the same Record class in local mode (which should not involve serializable stuff)..really confused..

Implementing Serializable does not mean serializing. Really i cant undestand at all this requirement...

Regards.
 
Bhavik Patel
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the reply .. i was thinking the same (implementing serializable doesnt mean we are serializing) ...so its fine with implenting Value Object (which means we have to convert all time back & forth between Value Object & String array as DataAcess has methods with String[] in signature ) and implementing the serializable ...Is it acceptable to do so ?? or not a good idea...
 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bhavik

The Value Object provides access on different data models in the same way, it have nothing to do with your network layer.
Serializable does not mean network, it only means that the specified Object can be serialized(and deserialized). A serialized object can be send to a stream.You can use it by example to make serialized object persistent.
If you are not happy with a Serializable Value Object you can have a simple one(not serializable) and then use the Decorator pattern to make it serializable Value Object.

Regards M.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic