Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

If Sun's DB interface returns String[], Is Value Object needed?

 
woo hwang
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, all.

I have just started a SCJD. And i got a question in my mind.
Sun provides a interface called DB. Methods in there have returnValues and methods parameter as String[] which String array holds datas.

I am wondering that Do i need a Value Object to transfer data between Cilent and the server?

For the RMI networking.. Is String array able to be transfered?
If so, I do not need VO. right?
If not, can i create an anothere facade class to call DataAccess class?

Do i have only String[] return value? because i downloaded an assignemtn 2 years ago. I guess that mime is too old one. you guys one has object return value.

Cheers.
 
Alex Belisle Turcot
Ranch Hand
Posts: 516
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

My SUN's interface also returns String[]. You could (your choice) directly transfer the array of String.

I chose to encapsulate (Value Object) the strings in a tangible object (Contractor in my case).

So a list of records is transfered as a list of Contractor, each containing an array of Strings.

It's all a matter of design choice.

Most probably you also need to transfer other information to the client (the record number, for later use ?), so it makes sense to encapsulate all this in an object. it can then adapt better to any future changes.

Regards,
Alex
 
woo hwang
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for an quick response.
It means that DBImpl class does not be an most front end facade in db package. right?

My new question is:
Where DBImpl should be sit on?
It will read a real database file anyhow. When reading processing is doing, It will bytes and create VO. and... return string?
I think it does not make sense to me.

Gui will call another facade class and it will call DBImpl which return String[]. the facade create new VO and return VO or List<VO> to GUI client.
Is it good decision? do you think?

NewFacade --> DBImpl --> DataFileAccess
read File and put field values into String[]
return String[] <--
<--
Create VO with value from String[]

<--retun VO to gui

Cheers mate.
 
Alex Belisle Turcot
Ranch Hand
Posts: 516
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I still want to emphasis the fact that it's a choice you make.
I simply gave you my opinion on it.
 
Alex Belisle Turcot
Ranch Hand
Posts: 516
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I think the idea is this:

your business/network layer will use the Data layer. For sure, your data layer will return String[].
You can then use your Value Object in your business/network layer to pass it on to your user interface.

That is what I did. I don't really call it Value Object myself since I consider it standard object-oriented to use tangible objects to hold informations.

Regards,
Alex
[ January 10, 2008: Message edited by: Alex Belisle Turcot ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic