<?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: Do Not Litter Your Code With Null Checks</title>
	<atom:link href="http://davybrion.com/blog/2008/12/do-not-litter-your-code-with-null-check/feed/" rel="self" type="application/rss+xml" />
	<link>http://davybrion.com/blog/2008/12/do-not-litter-your-code-with-null-check/</link>
	<description>Trying to walk that thin line between intelligence and ignorance</description>
	<lastBuildDate>Sun, 14 Mar 2010 15:41:46 +0100</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Filip Duyck</title>
		<link>http://davybrion.com/blog/2008/12/do-not-litter-your-code-with-null-check/comment-page-1/#comment-5921</link>
		<dc:creator>Filip Duyck</dc:creator>
		<pubDate>Wed, 03 Dec 2008 18:48:45 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=670#comment-5921</guid>
		<description>I can&#039;t but agree to that point :-)</description>
		<content:encoded><![CDATA[<p>I can&#8217;t but agree to that point <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2008/12/do-not-litter-your-code-with-null-check/comment-page-1/#comment-5919</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Wed, 03 Dec 2008 18:24:37 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=670#comment-5919</guid>
		<description>possibly... like i said in the post, i wasn&#039;t entirely sure about what he really meant

but the whole &#039;avoid exceptions/use return values&#039; argument is something i _really_ dislike so i tend to go off when i hear it, or think i hear it ;)</description>
		<content:encoded><![CDATA[<p>possibly&#8230; like i said in the post, i wasn&#8217;t entirely sure about what he really meant</p>
<p>but the whole &#8216;avoid exceptions/use return values&#8217; argument is something i _really_ dislike so i tend to go off when i hear it, or think i hear it <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Filip Duyck</title>
		<link>http://davybrion.com/blog/2008/12/do-not-litter-your-code-with-null-check/comment-page-1/#comment-5918</link>
		<dc:creator>Filip Duyck</dc:creator>
		<pubDate>Wed, 03 Dec 2008 18:18:22 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=670#comment-5918</guid>
		<description>Davy, you definitely misinterpreted the post. As you quote, it says &quot;Code defensively rather than catching exceptions wherever possible&quot; -- not &quot;.. rather than throwing exceptions wherever possible&quot;.

This doesn&#039;t nullify your point about return values and null checking, it just makes it a bit irrelevant to the original post.</description>
		<content:encoded><![CDATA[<p>Davy, you definitely misinterpreted the post. As you quote, it says &#8220;Code defensively rather than catching exceptions wherever possible&#8221; &#8212; not &#8220;.. rather than throwing exceptions wherever possible&#8221;.</p>
<p>This doesn&#8217;t nullify your point about return values and null checking, it just makes it a bit irrelevant to the original post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gilbert Marlowe</title>
		<link>http://davybrion.com/blog/2008/12/do-not-litter-your-code-with-null-check/comment-page-1/#comment-5912</link>
		<dc:creator>Gilbert Marlowe</dc:creator>
		<pubDate>Wed, 03 Dec 2008 16:04:00 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=670#comment-5912</guid>
		<description>Sigh... I&#039;ve inherited more than one piece of code that was written (somewhat) defensively. Yes, you should attempt to identify issues and code intelligently to account for and recover from them. BUT, some things are out of your control and some things you&#039;ll miss. 

In the case of errors caused by user inputs, never, ever, underestimate the power of a user to do something you hadn&#039;t considered because &quot;it&#039;s stupid&quot; or &quot;nobody will *ever* do that&quot;. Users don&#039;t have the same background/history as you do and won&#039;t make the same assumptions.

If your appplication/system relies on the outside world (whether it&#039;s the internet or a subsystem/input source you don&#039;t directly control), well then prepare for something to go wrong. Mr. Murphy&#039;s law applies to systems of any kind.

The purpose of exceptions is to allow a strongly-typed response to unexpected events. If you know what kind of thing when wrong, you&#039;re in a much better position to respond appropriately, even if that means throwing the exception back up to the caller.

Yes, exceptions are costly, but much, much less costly than aborting the running process or blindly changing database values without notifying the user. Avoid them if it&#039;s reasonable, but rely on them when necessary.</description>
		<content:encoded><![CDATA[<p>Sigh&#8230; I&#8217;ve inherited more than one piece of code that was written (somewhat) defensively. Yes, you should attempt to identify issues and code intelligently to account for and recover from them. BUT, some things are out of your control and some things you&#8217;ll miss. </p>
<p>In the case of errors caused by user inputs, never, ever, underestimate the power of a user to do something you hadn&#8217;t considered because &#8220;it&#8217;s stupid&#8221; or &#8220;nobody will *ever* do that&#8221;. Users don&#8217;t have the same background/history as you do and won&#8217;t make the same assumptions.</p>
<p>If your appplication/system relies on the outside world (whether it&#8217;s the internet or a subsystem/input source you don&#8217;t directly control), well then prepare for something to go wrong. Mr. Murphy&#8217;s law applies to systems of any kind.</p>
<p>The purpose of exceptions is to allow a strongly-typed response to unexpected events. If you know what kind of thing when wrong, you&#8217;re in a much better position to respond appropriately, even if that means throwing the exception back up to the caller.</p>
<p>Yes, exceptions are costly, but much, much less costly than aborting the running process or blindly changing database values without notifying the user. Avoid them if it&#8217;s reasonable, but rely on them when necessary.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reflective Perspective - Chris Alcock &#187; The Morning Brew #236</title>
		<link>http://davybrion.com/blog/2008/12/do-not-litter-your-code-with-null-check/comment-page-1/#comment-5902</link>
		<dc:creator>Reflective Perspective - Chris Alcock &#187; The Morning Brew #236</dc:creator>
		<pubDate>Wed, 03 Dec 2008 10:04:24 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=670#comment-5902</guid>
		<description>[...] Do Not Litter Your Code With Null Checks - Davy Brion responds to one of the posts linked in yesterday&#8217;s edition of the Morning Brew about defensive programming and the throwing of exceptions [...]</description>
		<content:encoded><![CDATA[<p>[...] Do Not Litter Your Code With Null Checks &#8211; Davy Brion responds to one of the posts linked in yesterday&#8217;s edition of the Morning Brew about defensive programming and the throwing of exceptions [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2008/12/do-not-litter-your-code-with-null-check/comment-page-1/#comment-5879</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Tue, 02 Dec 2008 20:45:32 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=670#comment-5879</guid>
		<description>coding defensively against user input is definitely a good thing... but i don&#039;t think his point was to avoid empty catch blocks (which really should be avoided), but that throwing/catching exceptions was costly and should be avoided because of that.

In his examples, the catch blocks are empty because he doesn&#039;t have anything useful to do with them for the tests</description>
		<content:encoded><![CDATA[<p>coding defensively against user input is definitely a good thing&#8230; but i don&#8217;t think his point was to avoid empty catch blocks (which really should be avoided), but that throwing/catching exceptions was costly and should be avoided because of that.</p>
<p>In his examples, the catch blocks are empty because he doesn&#8217;t have anything useful to do with them for the tests</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pho</title>
		<link>http://davybrion.com/blog/2008/12/do-not-litter-your-code-with-null-check/comment-page-1/#comment-5878</link>
		<dc:creator>pho</dc:creator>
		<pubDate>Tue, 02 Dec 2008 20:40:07 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=670#comment-5878</guid>
		<description>i think you actually misread the author. 
in the examples he never throws exceptions &quot;upwards&quot; or promotes the use of returning useless null references/error codes. the main point he was trying to make is to avoid empty catch blocks, or avoid try/catch blocks in general if you could otherwise simply rewrite it with an if statement. 
i quote:
&quot;Code defensively against user input, so that you don&#039;t have to rely on try/catch blocks to deal with exceptions&quot;

and he&#039;s right; everyone has come across some useless empty catch block while browsing a codebase that could have been way more elegantly written with &quot;defensive coding&quot; as he put it</description>
		<content:encoded><![CDATA[<p>i think you actually misread the author.<br />
in the examples he never throws exceptions &#8220;upwards&#8221; or promotes the use of returning useless null references/error codes. the main point he was trying to make is to avoid empty catch blocks, or avoid try/catch blocks in general if you could otherwise simply rewrite it with an if statement.<br />
i quote:<br />
&#8220;Code defensively against user input, so that you don&#8217;t have to rely on try/catch blocks to deal with exceptions&#8221;</p>
<p>and he&#8217;s right; everyone has come across some useless empty catch block while browsing a codebase that could have been way more elegantly written with &#8220;defensive coding&#8221; as he put it</p>
]]></content:encoded>
	</item>
</channel>
</rss>
