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

throwing IOException instead of RemoteException

 
Daniela Ch
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • 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
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • Quote
  • Report post to moderator
dont bother...i did it...
thank you
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic