You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Henri Yandell <ba...@generationjava.com> on 2004/08/29 08:12:37 UTC

Worst offence in Java :) Re: [lang] Interpolation

On Sat, 28 Aug 2004, matthew.hawthorne wrote:

> > IMO, copy-paste reuse is the worst offense that a programmer can commit.
>
> I agree that it's bad news.
>
> But, I think the worst offense is this:
>
> try {
>
>    // ...
>
> } catch (Exception e) {
>    return null;
> }
>
> (shudder)

How lucky you've been. Have you never seen:

try {
    ...
} catch(Throwable t) {
    // ignore
}

??? :)

Hen


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: Worst offence in Java :) Re: [lang] Interpolation

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
Thanx for the reference, Martin.  It is a hoot what people will do.  I 
am not immune, I am sure.

Michael

Martin Cooper wrote:

>MUCH worse would be returning from a 'finally' clause, which can cause
>unexpected control flow behaviour. See "The Java Hall of Shame":
>
>http://www.cs.arizona.edu/sumatra/hallofshame/
>
>and also "The Lost Exception" in Bruce Eckel's "Thinking in Java".
>
>--
>Martin Cooper
>
>
>On Sun, 29 Aug 2004 02:12:37 -0400 (EDT), Henri Yandell
><ba...@generationjava.com> wrote:
>  
>
>>On Sat, 28 Aug 2004, matthew.hawthorne wrote:
>>
>>    
>>
>>>>IMO, copy-paste reuse is the worst offense that a programmer can commit.
>>>>        
>>>>
>>>I agree that it's bad news.
>>>
>>>But, I think the worst offense is this:
>>>
>>>try {
>>>
>>>   // ...
>>>
>>>} catch (Exception e) {
>>>   return null;
>>>}
>>>
>>>(shudder)
>>>      
>>>
>>How lucky you've been. Have you never seen:
>>
>>try {
>>   ...
>>} catch(Throwable t) {
>>   // ignore
>>}
>>
>>??? :)
>>
>>Hen
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
>
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: Worst offence in Java :) Re: [lang] Interpolation

Posted by Martin Cooper <mf...@gmail.com>.
MUCH worse would be returning from a 'finally' clause, which can cause
unexpected control flow behaviour. See "The Java Hall of Shame":

http://www.cs.arizona.edu/sumatra/hallofshame/

and also "The Lost Exception" in Bruce Eckel's "Thinking in Java".

--
Martin Cooper


On Sun, 29 Aug 2004 02:12:37 -0400 (EDT), Henri Yandell
<ba...@generationjava.com> wrote:
> 
> On Sat, 28 Aug 2004, matthew.hawthorne wrote:
> 
> > > IMO, copy-paste reuse is the worst offense that a programmer can commit.
> >
> > I agree that it's bad news.
> >
> > But, I think the worst offense is this:
> >
> > try {
> >
> >    // ...
> >
> > } catch (Exception e) {
> >    return null;
> > }
> >
> > (shudder)
> 
> How lucky you've been. Have you never seen:
> 
> try {
>    ...
> } catch(Throwable t) {
>    // ignore
> }
> 
> ??? :)
> 
> Hen
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: Worst offence in Java :) Re: [lang] Interpolation

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
If we get System.exit(0) when there is a problem or when these is not, 
isn't that worse than System.exit(1) under the same conditions?

Michael

C. Scott Ananian wrote:

>On Sun, 29 Aug 2004, Michael McGrady wrote:
>
>  
>
>>Well, would
>>
>>    boolean dontAsk = false;
>>    try {
>>    } catch (Throwable t) {
>>      dontAsk = true;
>>    } finally {
>>      if(dontAsk) System.exit(0);
>>    }
>>
>>be worse?  LOL
>>    
>>
>
>Yes!  It should clearly be System.exit(1)!  That's *awful*!
> --scott
>
>bomb assassination Philadelphia Ft. Meade tonight Ft. Bragg ODENVY
>   Register to vote!  http://www.yourvotematters.org/VerifiedVoting
>                         ( http://cscott.net/ )
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
>
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: Worst offence in Java :) Re: [lang] Interpolation

Posted by "C. Scott Ananian" <cs...@cscott.net>.
On Sun, 29 Aug 2004, Michael McGrady wrote:

> Well, would
>
>     boolean dontAsk = false;
>     try {
>     } catch (Throwable t) {
>       dontAsk = true;
>     } finally {
>       if(dontAsk) System.exit(0);
>     }
>
> be worse?  LOL

Yes!  It should clearly be System.exit(1)!  That's *awful*!
 --scott

bomb assassination Philadelphia Ft. Meade tonight Ft. Bragg ODENVY
   Register to vote!  http://www.yourvotematters.org/VerifiedVoting
                         ( http://cscott.net/ )

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: Worst offence in Java :) Re: [lang] Interpolation

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
David Graham wrote:

>--- Henri Yandell <ba...@generationjava.com> wrote:
>
>  
>
>>On Sat, 28 Aug 2004, matthew.hawthorne wrote:
>>
>>    
>>
>>>>IMO, copy-paste reuse is the worst offense that a programmer can
>>>>        
>>>>
>>commit.
>>    
>>
>>>I agree that it's bad news.
>>>
>>>But, I think the worst offense is this:
>>>
>>>try {
>>>
>>>   // ...
>>>
>>>} catch (Exception e) {
>>>   return null;
>>>}
>>>
>>>(shudder)
>>>      
>>>
>>How lucky you've been. Have you never seen:
>>
>>try {
>>    ...
>>} catch(Throwable t) {
>>    // ignore
>>}
>>    
>>
>
>At least there was a comment in there :-).  I've seen a shocking number of
>these: catch(Throwable t) {} from programmers that "knew it wouldn't
>matter".
>
>David
>
>
>  
>
>>??? :)
>>
>>Hen
>>    
>>
>
>
>
>		
>_______________________________
>Do you Yahoo!?
>Win 1 of 4,000 free domain names from Yahoo! Enter now.
>http://promotions.yahoo.com/goldrush
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
>
>
>  
>
Well, would

    boolean dontAsk = false;
    try {
    } catch (Throwable t) {
      dontAsk = true;
    } finally {
      if(dontAsk) System.exit(0);
    }


be worse?  LOL

be worse


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: Worst offence in Java :) Re: [lang] Interpolation

Posted by David Graham <gr...@yahoo.com>.
--- Henri Yandell <ba...@generationjava.com> wrote:

> 
> On Sat, 28 Aug 2004, matthew.hawthorne wrote:
> 
> > > IMO, copy-paste reuse is the worst offense that a programmer can
> commit.
> >
> > I agree that it's bad news.
> >
> > But, I think the worst offense is this:
> >
> > try {
> >
> >    // ...
> >
> > } catch (Exception e) {
> >    return null;
> > }
> >
> > (shudder)
> 
> How lucky you've been. Have you never seen:
> 
> try {
>     ...
> } catch(Throwable t) {
>     // ignore
> }

At least there was a comment in there :-).  I've seen a shocking number of
these: catch(Throwable t) {} from programmers that "knew it wouldn't
matter".

David


> 
> ??? :)
> 
> Hen



		
_______________________________
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
http://promotions.yahoo.com/goldrush

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org