This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Does the object which the client gets from the RMI Naming server need to extend Remote? I thought that because this application uses RMI, any method could run into a communication problem (e.g. the network could go down) and end up throwing a RemoteException. Therefore, the RMI object which the client uses should implement Remote, and each of its methods, including the constructor, would throw a RemoteException.
But in the book SCJD, the DBClient interface does not implement Remote. I looked at the sample code, and it just looks like this:
So... does the object which the RMI Naming server return actually need to implement the Remote interface?
Whenever a book like that is written, the author has the problem of wanting to provide all the information necessary to pass the exam, but without giving away a complete solution. One of the best ways to do this (IMHO) is to provide the answers in separate chapters, then do something slightly different in the example project so that the example project's code can't be copied and pasted.
In Max's book (and in the second edition) we describe that RemoteException must be declared to be thrown in methods that will be called remotely in the chapter on RMI. However we then deliberately do something slightly different in the sample assignment by having all DBClient's methods throw IOException, which is the superclass of RemoteException.
In the second edition we have dedicated several paragraphs to describing what parts of our sample assignment are deliberately harder than the real assignment, and which parts are deliberately easier.