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

Data Interface definition for server and client

 
Gokul Krishnan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,
I am currently doing the FBN assignment and have a question regarding the
Definition of the Interface for the Database server and Data client.
I have put all the public methods in the data class in an interface which
can be used by the client and server.
I currently have the 2 following interface definitions for data client
and the RMI server (as given below).I would like to know if this approach
is acceptable as per good OOP design principles ? The reason for the separation
is exception handling :

The reason I chose this approach is this : If one interface extends another,
then the exception handling gets mucked up(one method does not throw an
exception in the local mode while in the server it must throw an exception
For e.g. the method getFieldInfo()
This way it is cleaner. But if a method is added to the the Data class, it
has to be updated in 2 interfaces separately(the only drawback I see).
Any comments/suggestions on this design ?
Thanks
Gokul


 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12007
215
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gokul
That is the same approach I took.
I also had the same concerns as you - that a change to Data that has to be propogated would require both interfaces to be changed - but I could not see a clean way around it.
Regards, Andrew
 
Xiao Qinglai
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Given that we have:
A interface DataInterface resides in suncertify.db;
A interface RemoteData, which extends Remote, resides in suncertify.server;
Now we have a package named suncertify.client, in which package, we want to dynamicly change data's resource: either from local or from network.
We can write a class ClientData implements suncertify.db.DataInterface. ClientData works like a wrapper of RemoteData, that is, use try--catch to hide RemoteException.
Now, given we have suncertify.client.Client, we can set Client's data like this:

In this way, we can dynamicly change DataInterface in Client.
In one word, the point is to create a class (ClientData) to implement DataInterface, and to wrap RemoteData (that is, catch RemoteException in method, instead of throwing it).
[ July 16, 2003: Message edited by: Xiao Qinglai ]
[ July 16, 2003: Message edited by: Xiao Qinglai ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic