<?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/"
	xmlns:series="http://organizeseries.com/"
		>
<channel>
	<title>Comments on: Exceptional PHP: Introduction to Exceptions</title>
	<atom:link href="http://www.brandonsavage.net/exceptional-php-introduction-to-exceptions/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.brandonsavage.net/exceptional-php-introduction-to-exceptions/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=exceptional-php-introduction-to-exceptions</link>
	<description>The personal blog of Brandon Savage. Contains entries of a personal and professional nature focusing on PHP, Apple, LAMP, MySQL and Washington, DC.</description>
	<lastBuildDate>Wed, 15 May 2013 14:54:51 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.2-alpha</generator>
	<item>
		<title>By: Jory Geerts</title>
		<link>http://www.brandonsavage.net/exceptional-php-introduction-to-exceptions/#comment-2011</link>
		<dc:creator>Jory Geerts</dc:creator>
		<pubDate>Tue, 10 Nov 2009 18:54:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=985#comment-2011</guid>
		<description><![CDATA[Brandon, I don&#039;t really think its &quot;much better to define a TwitterException and define the various types as codes&quot;. If I recall correctly, you had some wrapping code around the cURL library, to abstract away from it and make things a bit more re-usable. (I might be wrong, obviously - can&#039;t be bothered to go dig around and find that article.)
If you are then throwing TwitterExceptions in the cURL wrapper, the whole louse coupling idea kinda fails, doesn&#039;t it?

But, nice article. Exceptions are a great way to make your programs more understandable and manageable. (And the rule of thumb you mention is dead-on.)]]></description>
		<content:encoded><![CDATA[<p>Brandon, I don&#8217;t really think its &#8220;much better to define a TwitterException and define the various types as codes&#8221;. If I recall correctly, you had some wrapping code around the cURL library, to abstract away from it and make things a bit more re-usable. (I might be wrong, obviously &#8211; can&#8217;t be bothered to go dig around and find that article.)<br />
If you are then throwing TwitterExceptions in the cURL wrapper, the whole louse coupling idea kinda fails, doesn&#8217;t it?</p>
<p>But, nice article. Exceptions are a great way to make your programs more understandable and manageable. (And the rule of thumb you mention is dead-on.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans</title>
		<link>http://www.brandonsavage.net/exceptional-php-introduction-to-exceptions/#comment-2008</link>
		<dc:creator>Hans</dc:creator>
		<pubDate>Tue, 10 Nov 2009 13:24:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=985#comment-2008</guid>
		<description><![CDATA[Yes thank you. Makes sense to put the result set validation in the application logic (at least in my case). 

Thank you.]]></description>
		<content:encoded><![CDATA[<p>Yes thank you. Makes sense to put the result set validation in the application logic (at least in my case). </p>
<p>Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon Savage</title>
		<link>http://www.brandonsavage.net/exceptional-php-introduction-to-exceptions/#comment-2007</link>
		<dc:creator>Brandon Savage</dc:creator>
		<pubDate>Tue, 10 Nov 2009 12:54:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=985#comment-2007</guid>
		<description><![CDATA[An empty results set is a perfectly valid results set. I would probably allow for an empty results set to be returned, rather than triggering an exception.

You might consider triggering an exception later on in the event that an empty results set should have been impossible. For example:
&lt;div class=&quot;example&quot;&gt;

if(!$id) {
    $user = new User();
} else {
    $user = UserPeer::retrieveByPK($id);
}

if(!$user)
{
    throw new ActionException(&#039;User object not loaded&#039;);
}

&lt;/div&gt;
Hope that helps!]]></description>
		<content:encoded><![CDATA[<p>An empty results set is a perfectly valid results set. I would probably allow for an empty results set to be returned, rather than triggering an exception.</p>
<p>You might consider triggering an exception later on in the event that an empty results set should have been impossible. For example:</p>
<div class="example">
<p>if(!$id) {<br />
    $user = new User();<br />
} else {<br />
    $user = UserPeer::retrieveByPK($id);<br />
}</p>
<p>if(!$user)<br />
{<br />
    throw new ActionException(&#8216;User object not loaded&#8217;);<br />
}</p>
</div>
<p>Hope that helps!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans</title>
		<link>http://www.brandonsavage.net/exceptional-php-introduction-to-exceptions/#comment-2006</link>
		<dc:creator>Hans</dc:creator>
		<pubDate>Tue, 10 Nov 2009 12:38:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=985#comment-2006</guid>
		<description><![CDATA[Hi! Interesting post, would really like to learn more on the subject.

Is it bad coding practise to try and collect non-existant data from the database? Was contemplating the removal of a dbException which is thrown at the return of empty result sets. If yes - why?]]></description>
		<content:encoded><![CDATA[<p>Hi! Interesting post, would really like to learn more on the subject.</p>
<p>Is it bad coding practise to try and collect non-existant data from the database? Was contemplating the removal of a dbException which is thrown at the return of empty result sets. If yes &#8211; why?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy Thompson</title>
		<link>http://www.brandonsavage.net/exceptional-php-introduction-to-exceptions/#comment-2002</link>
		<dc:creator>Andy Thompson</dc:creator>
		<pubDate>Tue, 10 Nov 2009 07:45:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=985#comment-2002</guid>
		<description><![CDATA[Yes, sorry that&#039;s what I meant by being feasible, I just thought from your examples that you were suggesting using the base Exception class and error codes.]]></description>
		<content:encoded><![CDATA[<p>Yes, sorry that&#8217;s what I meant by being feasible, I just thought from your examples that you were suggesting using the base Exception class and error codes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt McKeon</title>
		<link>http://www.brandonsavage.net/exceptional-php-introduction-to-exceptions/#comment-2000</link>
		<dc:creator>Matt McKeon</dc:creator>
		<pubDate>Tue, 10 Nov 2009 04:20:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=985#comment-2000</guid>
		<description><![CDATA[I agree with Andy, extending the base Exception class seems more intuitive and strait forward then adding an error code. Isn&#039;t that some of what Exceptions try and replace, ambiguous error codes?

I somewhat agree with you Brandon, in your example there are to many exceptions defined. But you don&#039;t really need them all anyway. 
Some of those can be lumped under something like NetworkException, ApiException, etc; I&#039;d think most of them would be handled similarly  anyway. So why burden yourself with extra Exception classes *or* confusing error codes.]]></description>
		<content:encoded><![CDATA[<p>I agree with Andy, extending the base Exception class seems more intuitive and strait forward then adding an error code. Isn&#8217;t that some of what Exceptions try and replace, ambiguous error codes?</p>
<p>I somewhat agree with you Brandon, in your example there are to many exceptions defined. But you don&#8217;t really need them all anyway.<br />
Some of those can be lumped under something like NetworkException, ApiException, etc; I&#8217;d think most of them would be handled similarly  anyway. So why burden yourself with extra Exception classes *or* confusing error codes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon Savage</title>
		<link>http://www.brandonsavage.net/exceptional-php-introduction-to-exceptions/#comment-1998</link>
		<dc:creator>Brandon Savage</dc:creator>
		<pubDate>Tue, 10 Nov 2009 00:55:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=985#comment-1998</guid>
		<description><![CDATA[I think it would be really rather silly to have an exception for each and every file in a library or action. For example, under your model, for a Twitter library we&#039;d have:

* CurlException
* BadRequestException
* MessagePostFailedException
* ReadStreamFailedException
* and so on...

It&#039;d be much better to define a TwitterException and define the various types as codes.]]></description>
		<content:encoded><![CDATA[<p>I think it would be really rather silly to have an exception for each and every file in a library or action. For example, under your model, for a Twitter library we&#8217;d have:</p>
<p>* CurlException<br />
* BadRequestException<br />
* MessagePostFailedException<br />
* ReadStreamFailedException<br />
* and so on&#8230;</p>
<p>It&#8217;d be much better to define a TwitterException and define the various types as codes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy Thompson</title>
		<link>http://www.brandonsavage.net/exceptional-php-introduction-to-exceptions/#comment-1995</link>
		<dc:creator>Andy Thompson</dc:creator>
		<pubDate>Mon, 09 Nov 2009 21:52:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=985#comment-1995</guid>
		<description><![CDATA[I&#039;d disagree on the use of the error code to differentiate between exceptions. It would be better to define clear subclassing of Exception as much as is feasible before involving error codes.

Also, following that, throwing/catching the base Exception should probably be avoided, as all exceptions are based on it, so making it hard to differentiate between them.]]></description>
		<content:encoded><![CDATA[<p>I&#8217;d disagree on the use of the error code to differentiate between exceptions. It would be better to define clear subclassing of Exception as much as is feasible before involving error codes.</p>
<p>Also, following that, throwing/catching the base Exception should probably be avoided, as all exceptions are based on it, so making it hard to differentiate between them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Coallier</title>
		<link>http://www.brandonsavage.net/exceptional-php-introduction-to-exceptions/#comment-1987</link>
		<dc:creator>David Coallier</dc:creator>
		<pubDate>Mon, 09 Nov 2009 14:38:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=985#comment-1987</guid>
		<description><![CDATA[Good article, however I think you should dive into the spl exceptions in order to get people interested in various types of exceptions (Exceptions we are encouraging in the upcoming PHP Recommended Standards for framework (or whichever the form that it&#039;s being given))

http://php.net/manual/en/spl.exceptions.php]]></description>
		<content:encoded><![CDATA[<p>Good article, however I think you should dive into the spl exceptions in order to get people interested in various types of exceptions (Exceptions we are encouraging in the upcoming PHP Recommended Standards for framework (or whichever the form that it&#8217;s being given))</p>
<p><a href="http://php.net/manual/en/spl.exceptions.php" rel="nofollow">http://php.net/manual/en/spl.exceptions.php</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic (Feed is rejected)
Page Caching using disk: enhanced (User agent is rejected)
Object Caching 560/562 objects using apc
Content Delivery Network via Amazon Web Services: S3: brandonsavage-net-files.s3.amazonaws.com

 Served from: www.brandonsavage.net @ 2013-05-21 11:41:05 by W3 Total Cache -->