• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Questions on Design

 
Roy Augustine
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
My data base part is like this.
I have two interfaces DB(which is provided by Sun) and DBAdapter. DBAdapter has all the methods of DB plus a book method.
Then I have two classes that implement these interface. Data class that implement DB as specified by Sun and a DataAdapter class that implements DBAdapter. DataAdapter implements all the methods of DBAdapter. Actually what DataAdapter is doing is it just calls the corresponding methods of Data class except for Book method.
I am using RMI and DataAdapter is my remote object.
At the client side I have a DataFactory class. This class returns an instance of local DataAdapter or remote DataAdapter � actually both of these are exactly the same, only difference is that remote DataAdapter is an instance of DataAdapter that runs in a different VM - depending on the mode.
What you guys think about this design?
Is this the way Adapter and Factory patterns works?
Thanks in advance.
[ December 03, 2003: Message edited by: Roy Augustine ]
 
Vlad Rabkin
Ranch Hand
Posts: 555
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Roy,
Actually what DataAdapter is doing is it just calls the corresponding methods of Data class except for Book method.

If your adapter doesn't change signature or logic of methods from Data class, why don't you subclass Data class?
Best,
Vlad
 
Roy Augustine
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Vlad,
Thanks for your reply.
Actually DataAdapter class extends UnicastRemoteObject. So it cannot
extend another class.
Except for that, do you think my design is ok.
Thanks again
Roy.
[ December 03, 2003: Message edited by: Roy Augustine ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic