This week's book giveaway is in the Performance forum. We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line! See this thread for details.
Hi. I'm working on my standalone/server design. My first approach would be to have one interface, Server, which would extend Remote, and one implementation, ServerImpl, which would extend UnicastRemoteObject (and implement Server, of course). If the client/server mode were to be selected, I would create a ServerImpl instance and bind it in the RMI registry. Then I would get that instance through Naming.lookup() and pass it to the clients.
So far, so good. My problem/doubt comes with the standalone mode. To keep things simple, I had thought of creating the ServerImpl instance and passing it to the Client instance directly. No RMI involved, but the Server interface would then be extending Remote for no apparent Reason. The same goes with ServerImpl, the extension of UnicastRemoteObject would be completely superfluous, since no RMI would be used.
My question is: do you think this is an acceptable decission or should I spend more time working on a better class hierarychy? I'm not convinced of using it, but the instructions mention that we should keep things as clear as possible and the design mentioned above would be pretty straightforward.