Sweet! The checked exceptions debate again!
1) checked exceptions are just a huge PITA. And being a huge PITA
they lead to bad code. Java code is the worst offender for stuff like
try {} catch(Exception e){}. How many open source libraries do you
see every API method having a Throws Exception clause? Why do you
think this is?
2) checked exceptions don't scale. If you use exceptions as intended
(usually letting them bubble up) you end up with monster throws
clauses. And one change to a core library can have literally 1000s of
methods impacted. So what do people do? They swallow them, or log
them and continue as if everything is great even though something
failed (see point #1)
3) Why is it that every other language ever created doesn't have
Checked Exceptions (including Java FX)?
4) Checked Exceptions pollute interfaces. If you have a public API
Interface and want to introduce a new checked exception you break all
users. So what do people do? "throws Exception" or use
RuntimeExceptions. So they bypass Checked Exceptions.
5) Don't believe me? See what a couple people a lot smarter than me
say: http://www.mindview.net/Etc/Discussions/CheckedExceptions
http://www.artima.com/intv/handcuffs.html
On Sep 21, 2:05 pm, Cédric Beust ♔ <[email protected]> wrote:
> Yup, interesting post.
>
> I agree with Stephen on most points except the checked exceptions part (I
> posted this as a comment on his blog but JRoller sucks rocks so my comment
> disappeared. Why is anyone still using this prehistoric software?).
>
> Calling checked exceptions a "failed experiment" is a bit naive, and using
> Spring as an illustration of this is pretty ironic. If anything, Spring
> showed that using 100% runtime exceptions is as bad as using 0%.
>
> I use Spring on a daily basis and I spend an enormous amount of time going
> through pages and pages of logs containing endless stack traces of runtime
> exceptions, all more useless than the next. I contend that if it was
> possible to use checked exceptions judiciously, most of these errors could
> have been caught at compile time.
>
> Besides, in my experience, Spring has as many haters as supporters, so it's
> not really a shiny endorsement for runtime exceptions.
>
> It's clear that checked exceptions are hard to get right, but I am convinced
> that they are vital to produce robust software and that the correct approach
> is a mix of runtime and checked exceptions.
>
> --
> Cédric
>
> On Tue, Sep 21, 2010 at 12:52 PM, [email protected] <
>
>
>
>
>
> [email protected]> wrote:
> > Interesting:
> >http://www.jroller.com/scolebourne/entry/the_next_big_jvm_language1
>
> > He makes some good points, although I would also advocate
>
> > 1) building more literals into The Next Big JVM Language such as
> > literal collections [], regular expressions /REGEXGOES HERE/, etc
> > (basically what groovy/ruby have)
> > 2) optional dynamic typing
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "The Java Posse" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<javaposse%2bunsubscr...@googlegroups
> > .com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/javaposse?hl=en.
>
> --
> Cédric
--
You received this message because you are subscribed to the Google Groups "The
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/javaposse?hl=en.