<?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: Programming with Exceptions: some thoughts.</title>
	<atom:link href="http://kristofmattei.be/2009/11/10/programming-with-exceptions-some-thoughts/feed/" rel="self" type="application/rss+xml" />
	<link>http://kristofmattei.be/2009/11/10/programming-with-exceptions-some-thoughts/</link>
	<description>A blog on my experiences in programming, work, and life!</description>
	<lastBuildDate>Mon, 21 May 2012 04:23:51 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: whoami</title>
		<link>http://kristofmattei.be/2009/11/10/programming-with-exceptions-some-thoughts/comment-page-1/#comment-2199</link>
		<dc:creator>whoami</dc:creator>
		<pubDate>Fri, 08 Jan 2010 20:35:48 +0000</pubDate>
		<guid isPermaLink="false">http://kristofmattei.be/2009/11/10/programming-with-exceptions-some-thoughts/#comment-2199</guid>
		<description>Hmm...
When you &lt;strong&gt;expect&lt;/strong&gt; that the given Id exists, and you did not find a Product for that Id: throw an exception.

When it is very possible that a Product cannot be found given the (user) input, return null, and handle it elsewhere.
(For instance when they (user) search on a business-key (like an invoice number for instance), it is possible that the user makes a typing error, so, I would not throw an exception in such a case, since it is not exceptional that a user makes an error).

And, I think the naming convention of HawVer makes it quite self-explaining as well.</description>
		<content:encoded><![CDATA[<p>Hmm&#8230;<br />
When you <strong>expect</strong> that the given Id exists, and you did not find a Product for that Id: throw an exception.</p>
<p>When it is very possible that a Product cannot be found given the (user) input, return null, and handle it elsewhere.<br />
(For instance when they (user) search on a business-key (like an invoice number for instance), it is possible that the user makes a typing error, so, I would not throw an exception in such a case, since it is not exceptional that a user makes an error).</p>
<p>And, I think the naming convention of HawVer makes it quite self-explaining as well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: HawVer</title>
		<link>http://kristofmattei.be/2009/11/10/programming-with-exceptions-some-thoughts/comment-page-1/#comment-2084</link>
		<dc:creator>HawVer</dc:creator>
		<pubDate>Mon, 30 Nov 2009 14:40:06 +0000</pubDate>
		<guid isPermaLink="false">http://kristofmattei.be/2009/11/10/programming-with-exceptions-some-thoughts/#comment-2084</guid>
		<description>I&#039;d say FindProductById returns null and GetProduct throws an InvalidArgumentException. That&#039;s how most of the collection classes in .Net works. Then how to use GetProduct without breaking our execution:

if (ContainsProduct(id)) 
  Product p = GetProduct(id);</description>
		<content:encoded><![CDATA[<p>I&#8217;d say FindProductById returns null and GetProduct throws an InvalidArgumentException. That&#8217;s how most of the collection classes in .Net works. Then how to use GetProduct without breaking our execution:</p>
<p>if (ContainsProduct(id))<br />
  Product p = GetProduct(id);</p>
]]></content:encoded>
	</item>
</channel>
</rss>

