SCJP (1.4 | 5.0), OCJP (6.0), OCMJD
Sean Keane wrote:But I am confused by the example in that thread that has a startServer method in it.
SCJP (1.4 | 5.0), OCJP (6.0), OCMJD
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
SCJP (1.4 | 5.0), OCJP (6.0), OCMJD
SCJP (1.4 | 5.0), OCJP (6.0), OCMJD
Sean Keane wrote:Sound OK?
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
Ixus See wrote:you guys are making me worried again
![]()
I don't even have a IF ELSE.
Dmitri Cherkas wrote:can it be considered a good design ?
Roel wrote : You would expect you retrieve once the correct business service implementation based on the mode you are running. That happens for example in the constructor or in some initialize method. Then when you need to find rooms, just call service.findRooms(), when you want to book a room, that's service.book(). And that's where the SuperBusiness interface gives you advantage and doesn't clutter your code: the call in standalone mode and network mode will be exactly the same, the object on which you invoke the call will be different (but your gui will not know that)
Roel wrote : And you might have a look at the rmi tutorial and this thread, because RMI expects some must-dos or otherwise it won't work (and you are violating some of them)
Dmitri Cherkas wrote:This phrase freeze my soul...
Dmitri Cherkas wrote:I comletely agree with you, Roel - the solution you write here clear, good and OO, but i still do not understand how to realize it...
Roel wrote : You have an interface with your business operations, let's call it BusinessService containing all business methods you want to invoke. This is the interface you will use in your GUI to call methods on.
Roel wrote :You have to create a special remote interface (RemoteBusinessService) which extends Remote and BusinessService (no other methods needed).
Roel wrote :Then you can create an implementation for RemoteBusinessService and you could use that one for standalone mode as well.
Roel wrote :...in your interface every method will indeed have a "throws RemoteException" (besides any business exceptions).
Roel wrote :And of course calls to any service method are wrapped with a try/catch/finally block to handle appropriately any business exceptions.(and/or the RemoteException)
Roel De Nijs wrote:
And you might have a look at the rmi tutorial and this thread, because RMI expects some must-dos or otherwise it won't work (and you are violating some of them)
OCJP 6, OCMJD 6
**OCP, Java SE 6 Programmer**OCM, Java SE 6 Developer**
Consider Paul's rocket mass heater. |