<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: The Bad Practices of Exception Handling</title>
	<atom:link href="http://www.hans-eric.com/2009/10/31/the-bad-practices-of-exception-handling/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hans-eric.com/2009/10/31/the-bad-practices-of-exception-handling/</link>
	<description>Hans-Eric Grönlund on software development</description>
	<lastBuildDate>Wed, 21 Dec 2011 04:18:51 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: Chas Dhondt</title>
		<link>http://www.hans-eric.com/2009/10/31/the-bad-practices-of-exception-handling/comment-page-1/#comment-50286</link>
		<dc:creator>Chas Dhondt</dc:creator>
		<pubDate>Fri, 19 Nov 2010 07:24:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.hans-eric.com/?p=218#comment-50286</guid>
		<description>Greetings I recently finished reading through your blog as well as I’m very impressed. I truly do have a couple questions for you personally however. Think you’re thinking about doing a follow-up submitting about this? Will you be gonna keep bringing up-to-date also?</description>
		<content:encoded><![CDATA[<p>Greetings I recently finished reading through your blog as well as I’m very impressed. I truly do have a couple questions for you personally however. Think you’re thinking about doing a follow-up submitting about this? Will you be gonna keep bringing up-to-date also?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joep</title>
		<link>http://www.hans-eric.com/2009/10/31/the-bad-practices-of-exception-handling/comment-page-1/#comment-37446</link>
		<dc:creator>Joep</dc:creator>
		<pubDate>Tue, 10 Nov 2009 19:48:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.hans-eric.com/?p=218#comment-37446</guid>
		<description>Lol, your last two posts are quite the &quot;ah the world&quot; and subsequent &quot;oh the world&quot;.</description>
		<content:encoded><![CDATA[<p>Lol, your last two posts are quite the &#8220;ah the world&#8221; and subsequent &#8220;oh the world&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans-Eric</title>
		<link>http://www.hans-eric.com/2009/10/31/the-bad-practices-of-exception-handling/comment-page-1/#comment-37410</link>
		<dc:creator>Hans-Eric</dc:creator>
		<pubDate>Mon, 09 Nov 2009 08:49:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.hans-eric.com/?p=218#comment-37410</guid>
		<description>&lt;a href=&quot;#comment-37334&quot; rel=&quot;nofollow&quot;&gt;@Veera &lt;/a&gt; 
I agree - obviously :-)</description>
		<content:encoded><![CDATA[<p><a href="#comment-37334" rel="nofollow">@Veera </a><br />
I agree &#8211; obviously <img src='http://www.hans-eric.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans-Eric</title>
		<link>http://www.hans-eric.com/2009/10/31/the-bad-practices-of-exception-handling/comment-page-1/#comment-37409</link>
		<dc:creator>Hans-Eric</dc:creator>
		<pubDate>Mon, 09 Nov 2009 08:31:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.hans-eric.com/?p=218#comment-37409</guid>
		<description>&lt;a href=&quot;#comment-37308&quot; rel=&quot;nofollow&quot;&gt;@Mike Stone &lt;/a&gt; 
Thank you for your comment Mike.
In the case of Java you&#039;re probably right (it has been a long time since I had the pleasure of working in that great language), but in the case of C# fatal exceptions inherits from the Exception base class (via SystemException in between). That&#039;s why I think catching Exception is a bad idea, except of course at your program&#039;s entry points to implement your own unexcpected exception handling strategy.
And, of course, &quot;a second or so&quot; was an exageration, but not impossible in some cases. It depends on the situation, the depth of the stack trace etc. Anyway, that&#039;s not the biggie for me.</description>
		<content:encoded><![CDATA[<p><a href="#comment-37308" rel="nofollow">@Mike Stone </a><br />
Thank you for your comment Mike.<br />
In the case of Java you&#8217;re probably right (it has been a long time since I had the pleasure of working in that great language), but in the case of C# fatal exceptions inherits from the Exception base class (via SystemException in between). That&#8217;s why I think catching Exception is a bad idea, except of course at your program&#8217;s entry points to implement your own unexcpected exception handling strategy.<br />
And, of course, &#8220;a second or so&#8221; was an exageration, but not impossible in some cases. It depends on the situation, the depth of the stack trace etc. Anyway, that&#8217;s not the biggie for me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Veera</title>
		<link>http://www.hans-eric.com/2009/10/31/the-bad-practices-of-exception-handling/comment-page-1/#comment-37334</link>
		<dc:creator>Veera</dc:creator>
		<pubDate>Fri, 06 Nov 2009 08:45:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.hans-eric.com/?p=218#comment-37334</guid>
		<description>&#039;eating&#039; exceptions is always bad. It destroys the entire stack trace and make the software maintenance, a nightmare.</description>
		<content:encoded><![CDATA[<p>&#8216;eating&#8217; exceptions is always bad. It destroys the entire stack trace and make the software maintenance, a nightmare.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: links for 2009-11-05 &#124; blog@alessandrobozzon.org</title>
		<link>http://www.hans-eric.com/2009/10/31/the-bad-practices-of-exception-handling/comment-page-1/#comment-37317</link>
		<dc:creator>links for 2009-11-05 &#124; blog@alessandrobozzon.org</dc:creator>
		<pubDate>Fri, 06 Nov 2009 00:31:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.hans-eric.com/?p=218#comment-37317</guid>
		<description>[...] www.hans-eric.com » The Bad Practices of Exception Handling (tags: java programming) [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://www.hans-eric.com" rel="nofollow">http://www.hans-eric.com</a> » The Bad Practices of Exception Handling (tags: java programming) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Stone</title>
		<link>http://www.hans-eric.com/2009/10/31/the-bad-practices-of-exception-handling/comment-page-1/#comment-37308</link>
		<dc:creator>Mike Stone</dc:creator>
		<pubDate>Thu, 05 Nov 2009 19:43:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.hans-eric.com/?p=218#comment-37308</guid>
		<description>At least with the case of Java (and I suspect other popular languages), fatal exceptions tend not to actually be Exceptions.  For example, OutOfMemoryError is an Error, which itself is a Throwable.  You won&#039;t be able to catch an Error by just catching Exception.  Also, Error&#039;s are not checked exceptions, so the compiler will never force you to deal with such fatal exceptions.

Personally, I feel catching a general Exception is fine (if you handle it properly and not just swallow it), but catching Throwable or Error should be considered a big risk.

Also, your comment &quot;Throwing an exception with all that’s involved, like building a stack trace, will cost you a second or so&quot; I think is incorrect.  Yes, exceptions are costly (to throw), but they will NOT cost you a second or so.  Do some performance tests if you don&#039;t believe me.  The key point about considering performance with exceptions I believe is to avoid using them when it is the common workflow.  If you are using an exception to regularly break out of a loop, or indicate a common situation in your code... that is when you might start hitting performance costs because of them.  Reserve them for truly exceptional conditions and you should be fine.

Otherwise, good post!</description>
		<content:encoded><![CDATA[<p>At least with the case of Java (and I suspect other popular languages), fatal exceptions tend not to actually be Exceptions.  For example, OutOfMemoryError is an Error, which itself is a Throwable.  You won&#8217;t be able to catch an Error by just catching Exception.  Also, Error&#8217;s are not checked exceptions, so the compiler will never force you to deal with such fatal exceptions.</p>
<p>Personally, I feel catching a general Exception is fine (if you handle it properly and not just swallow it), but catching Throwable or Error should be considered a big risk.</p>
<p>Also, your comment &#8220;Throwing an exception with all that’s involved, like building a stack trace, will cost you a second or so&#8221; I think is incorrect.  Yes, exceptions are costly (to throw), but they will NOT cost you a second or so.  Do some performance tests if you don&#8217;t believe me.  The key point about considering performance with exceptions I believe is to avoid using them when it is the common workflow.  If you are using an exception to regularly break out of a loop, or indicate a common situation in your code&#8230; that is when you might start hitting performance costs because of them.  Reserve them for truly exceptional conditions and you should be fine.</p>
<p>Otherwise, good post!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans-Eric</title>
		<link>http://www.hans-eric.com/2009/10/31/the-bad-practices-of-exception-handling/comment-page-1/#comment-37290</link>
		<dc:creator>Hans-Eric</dc:creator>
		<pubDate>Thu, 05 Nov 2009 07:44:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.hans-eric.com/?p=218#comment-37290</guid>
		<description>&lt;a href=&quot;#comment-37263&quot; rel=&quot;nofollow&quot;&gt;@Al Katawazi &lt;/a&gt; 
I guess that&#039;s the extreme implementation of catching late, the third rule of Effective exception handling. :-)</description>
		<content:encoded><![CDATA[<p><a href="#comment-37263" rel="nofollow">@Al Katawazi </a><br />
I guess that&#8217;s the extreme implementation of catching late, the third rule of Effective exception handling. <img src='http://www.hans-eric.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans-Eric</title>
		<link>http://www.hans-eric.com/2009/10/31/the-bad-practices-of-exception-handling/comment-page-1/#comment-37289</link>
		<dc:creator>Hans-Eric</dc:creator>
		<pubDate>Thu, 05 Nov 2009 07:36:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.hans-eric.com/?p=218#comment-37289</guid>
		<description>&lt;a href=&quot;#comment-37262&quot; rel=&quot;nofollow&quot;&gt;@Bob Santos &lt;/a&gt; 
Great tip Bob. I haven&#039;t thought of it that way myself but it makes perfect sence.</description>
		<content:encoded><![CDATA[<p><a href="#comment-37262" rel="nofollow">@Bob Santos </a><br />
Great tip Bob. I haven&#8217;t thought of it that way myself but it makes perfect sence.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Al Katawazi</title>
		<link>http://www.hans-eric.com/2009/10/31/the-bad-practices-of-exception-handling/comment-page-1/#comment-37263</link>
		<dc:creator>Al Katawazi</dc:creator>
		<pubDate>Wed, 04 Nov 2009 14:39:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.hans-eric.com/?p=218#comment-37263</guid>
		<description>For web development I pretty much has stopped using exception handling entirely. Custom error page pretty much handles everything, I just have an ovveride method that records the error and lets it continue regardless of its location in the application. You wouldn&#039;t believe how much code bloat it destroys.</description>
		<content:encoded><![CDATA[<p>For web development I pretty much has stopped using exception handling entirely. Custom error page pretty much handles everything, I just have an ovveride method that records the error and lets it continue regardless of its location in the application. You wouldn&#8217;t believe how much code bloat it destroys.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

