Re: exceptions: checked or unchecked?
- From: Arne Vajhøj <arne@xxxxxxxxxx>
- Date: Fri, 29 Aug 2008 22:07:23 -0400
marlow.andrew@xxxxxxxxxxxxxx wrote:
What is best practice for using exceptions in java?
Checked or unchecked? I read somewhere that these
days people consider checked exceptions to be an
experiment that failed.
That is most by people coding in C++ and C#.
There are a few Java people believing the same,
but it is a minority.
Instead of people adding
the exceptions required to the throw list or handling
the exceptions internally the exceptions are typically
mis-handled by doing a catch and report stack trace
and then ignoring them. I have seen quite a lot of this.
Hopefully not in any serious code.
Unchecked exceptions don't give these problems.
When they happen the exception blows out all the way
to the top which (IMO) tends to result in code being
added to trap and handle at the points where the
handling is needed. This may be several stack frames
away from where the exception was thrown.
It is not obvious to me why no reminder in language/compiler
should make it more likely to put exception handling
in a good place.
Arne
.
- References:
- exceptions: checked or unchecked?
- From: marlow . andrew
- exceptions: checked or unchecked?
- Prev by Date: Re: exceptions: checked or unchecked?
- Next by Date: Re: how to parse a xml document which has a combination of XML XQuery and XPath
- Previous by thread: Re: exceptions: checked or unchecked?
- Next by thread: Re: BigDecimal
- Index(es):
Relevant Pages
|