This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Exception Handling and Purpose Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Reply Bookmark "Exception Handling and Purpose" Watch "Exception Handling and Purpose" New topic
Author

Exception Handling and Purpose

Javini Javono
Ranch Hand

Joined: Dec 03, 2003
Posts: 286
Hi,
I'll have to do more reading and review of this topic, both at this web site
and from my books. But, in the interrum, here is my question.
First, the code:

As an example, you'll see one portion where three exceptions are potentially
caught: notBoundException, malformedUrlException, remoteException.
From my perspective, all I care about as "the running application" is that I
was not able to connect to the "local" or remote server. That is, from the
perspective of "the running application," whether the exception was any one of
these potential three types is not relevant.
Should I also be concerned about the user? That is, should the exception message
offer hints to the user about how to get the application to operate correctly?
Such as:

Thanks,
Javini Javono
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17243
    
    1

Well, yes you do wnat to be concerned about the client. Most importantly that they know something happened. Secondly, wrapping each into a new ApplicationException type exception so that the client only has to catch one exception is very good. Just like you have.
I will say that I am more impressed by the second set of exception handling. It is cool to let the client know some possible remedies. Not necessarily needed for the assignment, but that won't hurt, and if you keep that practice up, very good for the real world.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception Handling and Purpose
 
Similar Threads
Rmi BAsic Problem
NX: RMI and Mutlithreading
RMI problem
Proxi-pattern and RMI question?
About catching Exception instead of more specific exception.