Re: exceptions: checked or unchecked?
Tom Anderson wrote:
There is also an argument that thorough testing makes static checking of
exceptions unnecessary. There's a lot of truth in this - it's part of a
more general argument that testing makes any kind of static checking
unnecessary, and that argument is largely borne out by the success of
python, smalltalk, LISP, etc in building large and complex systems in
the real world. But that doesn't mean that strong typing is *bad*, or
even that it's unnecessary - it catches problems early, at their source,
without having to write a test to cover it. Tests can detect any kind of
problem - including a colossal number that static typing can't, but test
coverage will never by 100%; type safety coverage is always 100%.
Expanding on this, although static type checking must invariably be
augmented with runtime checks, substantial use of languages without
static type checking make me pine for something like Java or even the
weaker checking of C/C++. It's far better to find the error at
compile-time than at runtime, and also far cheaper in the long run.
As you point out, the advent of generics strengthens the commitment to
static typing, and generic exception throws ameliorates a major sore
point in checked exceptions.
Although a lot of people have suggested removing checked exceptions,
every major Java developer I've talked to has argued in favor of keeping
them. There was a brief discussion on this about a year and a half ago
(look for the "Java 7 Features" thread).
--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth