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
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