🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #75471

Re: Why does Java require the throws clause? Good or bad language design?

#75471
From: Robert
Date: Sun, 11 Mar 2007 01:10
48 lines
3437 bytes
In article <20070208111322.GB5007@morgenes.shire.sytes.net>, Robbert Haarman
<comp.lang.misc@inglorion.net> wrote:
>On Thu, Feb 08, 2007 at 10:44:18AM +0000, Bent C Dalager wrote:
>> And, of course,
>> public void foo(Object... args) throws Throwable
>> may be just the silver bullet we are looking for . . .
>
>It is true that this removes the effort of changing the declaratiens in
>response to refactoring, but Java will still impose burdens on the
>programmer. First, they have to actually type "Object" before every
>argument and "throws Throwable" after every method declaration.

throws Throwable means your very design is incorrect
as you are entirely missing the granularity of your errors.
You'll never be able to successfuly recover
and forget about reattempting the operation
on a fine grained level as you will be thrown
several layers up.

>Secondly, if you actually want to use these arguments and throwables,
>you will have to downcast them to another class, because Object and
>Throwable probably don't have the methods and fields you need. This
>requires more typing. It also incurs a performance penalty, because the
>casts will be checked at run time. In the end, you get the worst of
>dynamic typing and the worst of mandatory declarations, all in one
>program.

A BASIC rule in object oriented programming:

DO NOT USE CASTS.
Unless it is absolutely unavoidable.

>Regards,
>
>Bob
>




- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"The most important job is not to be governor,
or first lady in my case."

--- Adolph Bush,
    Pella, Iowa,
    as quoted by the San Antonio Express-News, Jan. 30, 2000
Technical Details
Message-ID: <3BE1C7C5.7F2C408F@u.washington.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!number1.nntp.dca.giganews.com!border2.nntp.ams.giganews.com!feeder2.cambrium.nl!feed.tweaknews.nl!193.201.147.84.MISMATCH!xlned.com!feeder1.xlned.com!npeer1.de.kpn-eurorings.net!npeer-devel!news2.dg.net.ua!news.univ.kiev.ua!news.ntu-kpi.kiev.ua!news.uran.net.ua!news1.lucky.net!carrier.kiev.ua!news.te.net.ua!postnews.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!130.81.64.211.MISMATCH!cycny01.gnilink.net!spamkiller2.gnilink.net!gnilink.net!trndny04.POSTED!760c3fd9!cfl.rr.com!first-class
References: <1170835862.972715.24740@v33g2000cwv.googlegroups.com> <45c9a593$0$765$5a6aecb4@news.aaisp.net.uk> <gcudnTZig-sMTFTYnZ2dnUVZ_uGjnZ2d@comcast.com> <eqeuu2$tec$1@orkan.itea.ntnu.no> <20070208111322.GB5007@morgenes.shire.sytes.net>

Show Full Headers
Complete Article Headers
Message-ID: <3BE1C7C5.7F2C408F@u.washington.edu>
Subject: Re: Why does Java require the throws clause? Good or bad language design?
Date: Sun, 11 Mar 2007 01:10:36 GMT
From: first-class@cfl.rr.com (Robert)
References: <1170835862.972715.24740@v33g2000cwv.googlegroups.com> <45c9a593$0$765$5a6aecb4@news.aaisp.net.uk> <gcudnTZig-sMTFTYnZ2dnUVZ_uGjnZ2d@comcast.com> <eqeuu2$tec$1@orkan.itea.ntnu.no> <20070208111322.GB5007@morgenes.shire.sytes.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!number1.nntp.dca.giganews.com!border2.nntp.ams.giganews.com!feeder2.cambrium.nl!feed.tweaknews.nl!193.201.147.84.MISMATCH!xlned.com!feeder1.xlned.com!npeer1.de.kpn-eurorings.net!npeer-devel!news2.dg.net.ua!news.univ.kiev.ua!news.ntu-kpi.kiev.ua!news.uran.net.ua!news1.lucky.net!carrier.kiev.ua!news.te.net.ua!postnews.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!130.81.64.211.MISMATCH!cycny01.gnilink.net!spamkiller2.gnilink.net!gnilink.net!trndny04.POSTED!760c3fd9!cfl.rr.com!first-class
Newsgroups: news.groups, alt.slack, alt.config, news.software.nntp, alt.usenet.kooks
 alt.usenet.kooks
Organization: Exploding Delusions
Lines: 48
NNTP-Posting-Host: d31-75.tenet.odessa.ua
X-Trace: toster.te.net.ua 1173596533 16000 195.138.75.31 (11 Mar 2007 07:02:13
 GMT)
X-Complaints-To: abuse@te.net.ua
NNTP-Posting-Date: Sun, 11 Mar 2007 07:02:13 +0000 (UTC)
X-Newsreader: Microsoft Outlook Express 4.72.3110.1