• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Should RemoteConnection extend LocalConnection?

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an two interfaces,

and..

Then i have..

-this class behaves as an adapter, to adapt the Data interface to the Connection interface. They have the subtle difference that Connection throws an IOException when operations are performed on it.
This class basically delegates the work on to Data.

Then my RemoteConnectionImpl operates identically to LocalConnection with the exception of the lock and unlock methods.
Would it not make sense for RemoteConnectionImpl to extend LocalConnection and override the lock methods? It can export itself rather than extending UnicastRemoteObject. We are saying that a RemoteConnectionImpl is a LocalConnection which can be remotely exported.
After all, the server object is always a connection to a local database, but we are just saying that it also implements to declare that can also be exported remotely.
Therefore, the class declaration would be:
 
town drunk
( and author)
Posts: 4118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This isn't a bad idea @ all. I can see you going either way with it. However, in a real world application, I probably wouldn't do it. Reason? I'd like for my RemoteConnection class and my LocalConnection class to be able to grow /evolve without having side effects on each other.
M
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic