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


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

Re: can't throw

From Robert Klemme <shortcutter@googlemail.com>
Newsgroups comp.lang.java.programmer
Subject Re: can't throw
Date 2012-09-12 19:09 +0200
Message-ID <abbtu4F4vj8U1@mid.individual.net> (permalink)
References (1 earlier) <k2o8sm$ve3$1@dont-email.me> <fea53dab-0659-4f9f-af44-c181c4508aa1@googlegroups.com> <504fe3a6$0$293$14726298@news.sunsite.dk> <zy7f3qajj0sa.u9hsothk0nnw$.dlg@40tude.net> <c5d15859hljg2lsi58vh2hci8vm7ip7kpl@4ax.com>

Show all headers | View raw


On 12.09.2012 18:18, Gene Wirchenko wrote:
>       To me, it also seems as if it would be a good idea, but using it
> is awkward.  In some coursework, I used a Java cryptographic system.
> It had a lot of exceptions to handle so my code had a lot of catches.
> Because I did not know what was thrown, I wrote my code without them
> and then added whatever the compiler stated was missing.  In those
> catches, there really was not anything that I could do other than
> reporting the error.

Well, but that's a valid way to handle an exception. :-)

>       I prefer reading the main flow of execution as a high-level
> story.  Catches interrupt this.  When there are a lot of catches, they
> make the main code harder to find.

I my experience that can at least partially be attributed to people 
putting several try catch blocks in a method or not making them the 
outermost "bracket" of the method.  I frequently see a return after the 
closing bracket or such thing which makes it harder to read (and decide 
what happens in case of error and OK) and - more importantly - 
impossible for the compiler to catch control flow errors (e.g. the final 
return returns true while in case of error you wanted to return false).

Kind regards

	robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

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