Win a copy of Terraform in Action this week in the Cloud 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 ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

throwing IOException instead of RemoteException

 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Peter den Haan:
If I'd do the assignment again, I would throw IOException rather than RemoteException. Why? Decoupling. By throwing IOException, DataInterface does not make any assumptions about the technology that is used to connect to the server, i.e. sockets or RMI. Please note that RemoteException is a subclass of IOException.
- Peter


Even if the data interface extends Remote? Can we still say that we are not making any assumptions about the technology used? Is it worth throwing IOException instead of RemoteException but still extend Remote?
/Daniela
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Daniela Ch:
Even if the data interface extends Remote?

In many designs I've seen, it doesn't; most have a DataInterface and a separate RemoteDataInterface extends DataInterface, Remote. A DataInterface where all methods throw IOException would be truly implementation-agnostic. So would a client programmed against this interface.
This is a purely academic point though. If you're in the slightest way insecure about this, play safe, simply throw RemoteException and wire your assumptions about the transport protocol (RMI) in your client.
- Peter
 
Daniela Ch
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ah ok I understand, thanks Peter...
Do you think it is worth doing this or should I stick to my only DataInterface that implement Remote?
...
/Daniela
 
Daniela Ch
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
dont bother...i did it...
thank you
 
reply
    Bookmark Topic Watch Topic
  • New Topic