Re: Introspect whether setCharacterEncoding is present..

Milt Epstein <[email protected]> Tue, 12 Oct 2004 11:18:32 -0500 (CDT)
Newsgroups gmane.comp.java.advanced-servlets
Message-ID <[email protected]>
On Tue, 12 Oct 2004, Nic Ferrier wrote:

[ ... ]
> Let's look at the facts:
>
> - exceptions are non-local exits
>
> - java has syntax for throwing them and catching them
>
> - there is a readability cost to throwing them
>   Similar problem to the use of goto.
>
> - there is a computation cost to throwing them
>   Though exceptions are often highly optimized, depsite what some people
>   in that google search seem to think. This is because most VMs are
>   written in C and an exception can be implemented as a
>   longjmp. Certainly, unix longjmp's are very fast.
>
> - there is no other non-local exit feature
>   Unlike in C++ which still has longjmp left over from C.
>
>
> So what is it about the above that means that exceptions should not be
> used for control flow?
>
> Is it just because someone decided that exceptions should not be used
> for control flow? Because if that's the case you can carry on writing
> programs your way and I'll write good ones  /8->

My impression is that the main reason for this rule/guideline is for
the sake of code clarity and readability.  For example, one could
iterate through an array using a while loop embedded in a try/catch
looking for an ArrayIndexOutOfBounds exception, but a for loop using
the length of the array is much clearer.

And if you think of it as just a guideline, then there are bound to be
exceptions to it, such as when code will actually be clearer when you
use an exception, or when there's no other way to do it.

Milt Epstein
Research Programmer
Integration and Software Engineering (ISE)
Campus Information Technologies and Educational Services (CITES)
University of Illinois at Urbana-Champaign (UIUC)
[email protected]


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

Before posting a question, try to find your answer here: 
<http://www.egroups.com/links/advanced-servlets>
Announcements should go to: [email protected]
To Post a message, send it to: [email protected]
To Unsubscribe, send a blank message to: [email protected] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/advanced-servlets/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/