Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #18772

Re: can't throw

Newsgroups comp.lang.java.programmer
Date 2012-09-14 13:02 -0700
References (4 earlier) <zy7f3qajj0sa.u9hsothk0nnw$.dlg@40tude.net> <50510bbc$0$281$14726298@news.sunsite.dk> <h7kuo77qjaim$.vgolgvvfs7kc.dlg@40tude.net> <ion658l9c0jpn2v239660jlctjqdath7bb@4ax.com> <abhck3Fdgb0U1@mid.individual.net>
Message-ID <7ec08bd8-0faa-41ff-bda2-bc433b5ed92a@googlegroups.com> (permalink)
Subject Re: can't throw
From Lew <lewbloch@gmail.com>

Show all headers | View raw


Robert Klemme wrote:
> Gene Wirchenko wrote:
>>       It may not be nearly as elegant, but I still prefer BASIC's ON
>> ERROR GOTO handling.  Yes, one had to sort through the error numbers,
>> but that made it easier in some ways.  One could code something to
>> handle the few cases where there was a specific handling and then use
>> a catch-all for the rest.

And you can't do that with Java exceptions?

> Well, you can do _that_ in Java, too.

Ah, I thought so.

So what was that advantage of BASIC's approach again?

> I find the distinction between checked and unchecked exceptions pretty 
> good - although the distribution of exception types across these 
> categories does not always seem to be wisely made in the standard library.

API writing is a Dark Art, or rather a Dark Artish approach to programming generally.

It's arguably the best approach.

But designing the exception API is Darker Art. 

People who complain about checked exceptions always take the client point of 
view, and always blame Java.

(Counterexamples welcome.)

But if they are so bad, why do API writers opt to use them?

I know the answer. Do you?

Regardless, why blame Java for the API writer's choice?

As for comparing to other languages that don't have checked exceptions, 
that's utter bullshit. Bullshit, I say.

You can't compare the API writer's choices when they don't have the same 
options.

So writers of code in those other, lesser languages that don't have checked 
exceptions resort to some other idiom, simply because the checked 
exception idiom doesn't exist.

So of course it works, because they use the mechanisms that their 
languages *do* provide. Duh, and double-duh.

Drawing the conclusion that checked exceptions aren't necessary, 
given some other mechanism to accomplish equivalent goals, 
is hardly insightful. Drawing the conclusion from that evidence that 
checked exceptions are somehow inferior to those other mechanisms 
is fallacious.

What is valid is to compare decisions to use or not use checked 
exceptions in environments where they are available. 

Interesting then, that in such environments that good programmers 
find checked exceptions useful.

If you don't like their insistence that you honor the exception contract 
they designed, don't use their libraries. Just like if you don't like their 
insistence that you honor the argument contract they designed, don't 
use their libraries.

Just don't blame Java for providing the API writer the tools to force you 
to deal with something they thought important enough to force you to 
deal with. Thank God and the Java Founders that checked exceptions 
were available to that API writer to enforce that contract on you, otherwise 
a) they couldn't ensure you honor certain robustness requirements, and 
b) you couldn't be sure of exactly what exceptional situations they really 
insist you handle.

-- 
Lew

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

can't throw bob smith <bob@coolfone.comze.com> - 2012-09-11 13:16 -0700
  Re: can't throw markspace <-@.> - 2012-09-11 13:34 -0700
    Re: can't throw Lew <lewbloch@gmail.com> - 2012-09-11 14:15 -0700
  Re: can't throw Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-09-11 17:02 -0400
    Re: can't throw Lew <lewbloch@gmail.com> - 2012-09-11 14:17 -0700
      Re: can't throw Arne Vajhøj <arne@vajhoej.dk> - 2012-09-11 21:21 -0400
        Re: can't throw Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-09-11 21:59 -0700
          Re: can't throw Gene Wirchenko <genew@ocis.net> - 2012-09-12 09:18 -0700
            Re: can't throw Robert Klemme <shortcutter@googlemail.com> - 2012-09-12 19:09 +0200
            Re: can't throw markspace <-@.> - 2012-09-12 10:56 -0700
            Re: can't throw Arne Vajhøj <arne@vajhoej.dk> - 2012-09-12 18:36 -0400
              Re: can't throw Gene Wirchenko <genew@ocis.net> - 2012-09-12 18:29 -0700
                Re: can't throw Patricia Shanahan <pats@acm.org> - 2012-09-12 18:34 -0700
                Re: can't throw Arne Vajhøj <arne@vajhoej.dk> - 2012-09-12 21:37 -0400
                Re: can't throw Arne Vajhøj <arne@vajhoej.dk> - 2012-09-12 21:54 -0400
          Re: can't throw Jim Janney <jjanney@shell.xmission.com> - 2012-09-12 11:27 -0600
          Re: can't throw Arne Vajhøj <arne@vajhoej.dk> - 2012-09-12 18:24 -0400
            Re: can't throw Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-09-13 22:20 -0700
              Re: can't throw Gene Wirchenko <genew@ocis.net> - 2012-09-14 09:49 -0700
                Re: can't throw Robert Klemme <shortcutter@googlemail.com> - 2012-09-14 20:50 +0200
                Re: can't throw Lew <lewbloch@gmail.com> - 2012-09-14 13:02 -0700
                Re: can't throw Gene Wirchenko <genew@ocis.net> - 2012-09-14 14:06 -0700
                Re: can't throw Gene Wirchenko <genew@ocis.net> - 2012-09-14 13:16 -0700
                Re: can't throw Robert Klemme <shortcutter@googlemail.com> - 2012-09-14 23:07 +0200
                Re: can't throw Lew <lewbloch@gmail.com> - 2012-09-14 14:28 -0700
                Re: can't throw Gene Wirchenko <genew@ocis.net> - 2012-09-16 20:04 -0700
        Re: can't throw Arne Vajhøj <arne@vajhoej.dk> - 2012-09-12 18:16 -0400
          Re: can't throw Lew <lewbloch@gmail.com> - 2012-09-12 23:15 -0700
        Re: can't throw Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-09-14 17:33 -0500
          Re: can't throw Robert Klemme <shortcutter@googlemail.com> - 2012-09-16 15:46 +0200
            Re: can't throw Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-09-16 12:17 -0500
              Re: can't throw Robert Klemme <shortcutter@googlemail.com> - 2012-09-16 22:36 +0200
                Re: can't throw Gene Wirchenko <genew@ocis.net> - 2012-09-16 20:07 -0700
                Re: can't throw Robert Klemme <shortcutter@googlemail.com> - 2012-09-17 07:41 +0200
                Re: can't throw Gene Wirchenko <genew@ocis.net> - 2012-09-17 09:51 -0700
                Re: can't throw Robert Klemme <shortcutter@googlemail.com> - 2012-09-17 21:00 +0200
                Re: can't throw Gene Wirchenko <genew@ocis.net> - 2012-09-17 13:23 -0700
                Re: can't throw Joerg Meier <joergmmeier@arcor.de> - 2012-09-17 18:52 +0200
                Re: can't throw Lew <lewbloch@gmail.com> - 2012-09-17 11:22 -0700
                Re: can't throw Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-09-17 02:52 -0500
                Re: can't throw Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-09-17 02:39 -0500
                Re: can't throw Robert Klemme <shortcutter@googlemail.com> - 2012-09-17 21:02 +0200
  Re: can't throw markspace <-@.> - 2012-09-11 14:28 -0700
  Re: can't throw Arne Vajhøj <arne@vajhoej.dk> - 2012-09-11 21:14 -0400
    Re: can't throw Arne Vajhøj <arne@vajhoej.dk> - 2012-09-12 18:11 -0400
  Re: can't throw Robert Klemme <shortcutter@googlemail.com> - 2012-09-12 08:31 +0200
    Re: can't throw bob smith <bob@coolfone.comze.com> - 2012-09-12 11:40 -0700
      Re: can't throw Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-09-12 15:50 -0400
      Re: can't throw Lew <lewbloch@gmail.com> - 2012-09-12 12:52 -0700
        Re: can't throw Robert Klemme <shortcutter@googlemail.com> - 2012-09-12 23:24 +0200
          Re: can't throw Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-09-12 15:10 -0700
            Re: can't throw Robert Klemme <shortcutter@googlemail.com> - 2012-09-13 23:32 +0200
    Re: can't throw Arne Vajhøj <arne@vajhoej.dk> - 2012-09-12 18:06 -0400
  Re: can't throw Roedy Green <see_website@mindprod.com.invalid> - 2012-09-12 20:55 -0700

csiph-web