aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes General design question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "General design question" Watch "General design question" New topic
Author

General design question

David Winters Junior
Ranch Hand

Joined: Oct 30, 2007
Posts: 47
Hi All,

I have a general design question which i need to pose here.

I have 3 layers in my application a client/gui layer a business layer and a data layer.

The business layer contains methods which invoke the methods in the data layer.

My question is here is it okay for both the non-network client and network client/rmi client to invoke methods on business methods defined in the business interface whereby the only change i make to this interface for an RMI client is that i just extend the interface.

So my business interface used by the non-network is:


The business interface used by the rmi client is:


The only issue i have here is that the non-network client interface throws RenoteExceptions which it should not since it is a non-network client even though the local client implemntation class doesnt throw RemoteExceptions however the methods in remote interface implementation class does as it should. Is this a problem i should be concerned about?

Your thoughts would be most appreciated
David
Herman Schelti
Ranch Hand

Joined: Jul 17, 2006
Posts: 387
hi David,

first off: looks like you changed the interface that Sun gave to you: you added a few Exceptions. Don't do that.

In my assignment: I used the given interface for local access, and made a second interface (copied the given interface), added the Remote exceptions for network-access. I justified the small amount of duplicate code in my decisions-document.

Herman
David Winters Junior
Ranch Hand

Joined: Oct 30, 2007
Posts: 47
Thanks herman,

Yes i changed it briefly during testing an issue but as you said i cannot which is quite right.

Ok i take on board your suggestion but still i think it is okay to do as i did here since the local implementation does not throw these exceptions anywhere in the code. It's a design choice perhaps which is okay. Perhaps i will change it as you should as the interface should not declare such exceptions in its interface.

David
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: General design question