Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

Data Interface definition for server and client

Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?

author and jackaroo
Posts: 12199
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
If somebody says you look familiar, tell them you are in porn. Or in these tiny ads:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
    Bookmark Topic Watch Topic
  • New Topic