SCJP 5, SCWCD 5, SCBCD 5
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
SCJP 5, SCWCD 5, SCBCD 5
in your design the local business IS-NOT-A server..
secondly (and the reason so much people had question about this topic)
methodA ans methodB doesn't throw RemoteException in BusinessModel interface.
(and if they do then it's almost the same as roel's solution with few naming changes.
also, in your design the local business would have to deal with remoteexception..).
anyway, at the end you'll have to code 2 implementation with exactly the same logic..
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
SCJP 5, SCWCD 5, SCBCD 5
Roberto Perillo wrote:Exactly. It isn't a server... why should it be? Since it is supposed to be used only locally, then it shouldn't be a server anyway.
Jonathan Elkharrat wrote:correct me if i'm wrong, but don't you have to implement two exact same find() methods, say, in both local and remote businessmodel?
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
SCJP 5, SCWCD 5, SCBCD 5
Jonathan Elkharrat wrote:i know, but the find() logic will exist in 2 classes. suppose i find a bug while using a remote client, and i'm changing the
RemoteBusinessModel i must not forget to do the same changes in LocalBusinessModel, right?
or i'm missing something here...
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
Roberto Perillo wrote:
SCJP 5, SCWCD 5, SCBCD 5
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
SCJP 5, SCWCD 5, SCBCD 5
Jonathan Elkharrat wrote:with your design the local implementation still have remote exception in it, and that's what i wanted to avoid.
Roel De Nijs wrote:
And you want to avoid that for which reason? What benefit would you have with avoiding this?
SCJP 5, SCWCD 5, SCBCD 5
Jonathan Elkharrat wrote:there's no benefit, at least not in this assignment
Jonathan Elkharrat wrote:but that aside, if both classes do exactly the same thing and throw exactly the same exceptions, i couls use only one class for both local and remote use...
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
Roberto Perillo wrote:
Well champ, is there a place where there is some benefit?
Roberto Perillo wrote:
(as long as the server code isn't used in standalone mode)
Roberto Perillo wrote:
SCJP 5, SCWCD 5, SCBCD 5
Jonathan Elkharrat wrote:and i didn't fully understand this:
Roberto Perillo wrote: (as long as the server code isn't used in standalone mode)
Jonathan Elkharrat wrote:by the way, this won't compile... since the extending class (RemoteBusinessModel) throws an exception that doesn't exist in the super...
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
Roberto Perillo wrote:Well, it's just that the server code must be entirely bypassed in standalone mode, since this causes automatic failure.
Jonathan Elkharrat wrote:
SCJP 5, SCWCD 5, SCBCD 5
Roel De Nijs wrote:I would not opt for this approach, but that's just because you tell now that Server IS-A Remote which is not really true.
Roel De Nijs wrote:
So the design is not wrong (it will work and you'll pass), but it's not for the 100% correct.
Therefor I would opt for this design (and use a ServerImpl instance for both local and network mode):
SCJP 5, SCWCD 5, SCBCD 5
Roel De Nijs wrote:In my opinion Server (the business service) is not a Remote. I agree it's just a marker interface, but the IS-A relation does not apply. But that's just my opinion, you don't have to agree with it and you can take the approach you described a few posts above. That will be just fine.
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
SCJP 5, SCWCD 5, SCBCD 5
So, myDataObject can be used transparently in the client, without having to bother about the mode.
SCJP (1.4 | 5.0), OCJP (6.0), OCMJD
Sean Keane wrote:So I'm wondering where you got inspiration from this. Because this doesn't sound like a good design, where ServerImp IS-A RemoteInterface. It doesn't make sense to say that a local mode is remote.
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
Sean Keane wrote:So I'm wondering where you got inspiration from this. Because this doesn't sound like a good design, where ServerImp IS-A RemoteInterface. It doesn't make sense to say that a local mode is remote.
Roel De Nijs wrote:
and a remote business service (which extends the business service and the Remote service with no extra methods)
SCJP 5, SCWCD 5, SCBCD 5
Jonathan Elkharrat wrote:so the only thing you gain with the remote interface is a marker.
Jonathan Elkharrat wrote:there's no argument that in real life i'll probably won't use this design, because of the limitation in future change. the question arose given the simplicity of the assignment and the "good" approach would end up with more empty interfaces and duplicate classes...
Roel De Nijs wrote:
And the code in your client will look a bit less weird The interface you use in the client code has not a dependency on the Remote interface.
SCJP 5, SCWCD 5, SCBCD 5
Jonathan Elkharrat wrote:could you please elaborate on that? i dont think i understood...
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
SCJP 5, SCWCD 5, SCBCD 5
Jonathan Elkharrat wrote:but i think i'll stick with the 2 interfaces (the first one i proposed in my first post, i think it's roel's solution too)
because it's a safe bet. (i only have 1 try to submit)
SCJP 5, SCWCD 5, SCBCD 5
Jonathan Elkharrat wrote:i must use a super-server interface, that's a face.
i also don't want the localServer to extends Remote (this is the Safe bet i was talking about)
so i got 2 sub-inteface for Server, hence 2 implementation.
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
SCJP (1.4 | 5.0), OCJP (6.0), OCMJD
Roberto Perillo wrote:
Jonathan Elkharrat wrote:i must use a super-server interface, that's a fact.
i also don't want the localServer to extends Remote (this is the Safe bet i was talking about)
so i got 2 sub-inteface for Server, hence 2 implementation.
Hum... I think there's something wrong. You should have 1 interface with the business methods throwing RemoteException and business exceptions, 1 sub interface for the server extending Remote, one class that implements directly the super interface and another class extending the class that implements the super interface and implements the sub interface... you shouldn't have 2 sub interfaces...
SCJP 5, SCWCD 5, SCBCD 5
Sean Keane wrote:
He was suggesting that this approach was good because:
So, myDataObject can be used transparently in the client, without having to bother about the mode.
So I'm wondering where you got inspiration from this. Because this doesn't sound like a good design, where ServerImp IS-A RemoteInterface. It doesn't make sense to say that a local mode is remote.
SCJP 5, SCWCD 5, SCBCD 5
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |