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

Why the remote client code must provide all the public methods of the Data class?

 
Tiger Meng
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why "the remote client code must provide all the public methods of the Data class"?
My sense is that these methods are Remote-method of RMI, is that right?
"This implementation should include a class that implements the same public methods as the suncertify.db.Data class,"
Is the _stub.class auto-generated by JDK meet the requirement?
In this case the book method will put in client-side (in this method call lock-read-modify- unlock).
But can I put book method in server-side (also call lock-read-modify-unlock), and the client-side just call book method and criteriaFind method, then the public methods of Data are no use the client.
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by mengxiaoxi:
Why "the remote client code must provide all the public methods of the Data class"?
Because if you look at the system in this way:
GUI <==> business code <==> database
Then there are two sensible candidates for your RMI interface: either the GUI <==> business code interface, or the business code <==> database interface.
The requirement forces you into the second choice.
Is the _stub.class auto-generated by JDK meet the requirement?
Yes, it does. Well spotted.
But can I put book method in server-side (also call lock-read-modify-unlock), and the client-side just call book method and criteriaFind method, then the public methods of Data are no use the client.
You answered your own question. If you would put the business code (esp the book function) on the server, then having a Data-like object at the client side makes no sense, worse, would be bad OO.
- Peter
[ November 27, 2002: Message edited by: Peter den Haan ]
 
Tiger Meng
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you. another further question: can i use data class directly in both client and server side? i notice that candidates often use respectively remoteDataclass and localDataclass which implement a dataInterface. I feel this way waste code! becasuse both local and remote class have a instance of data, method call is boring like:
xxx add(yyy){
data.add(yyy);
}
Why not modify the Data class: make the public methods could be RMI?
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You asked the same question in a new thread -- see my answer there.
Executive summary: yes, but...
- Peter
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic