<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<title type="text">Comments for Roop says</title>
	<subtitle type="text">I created gravity?</subtitle>

	<updated>2009-12-02T22:59:45Z</updated>
	<generator uri="http://wordpress.org/" version="2.3.3">WordPress</generator>

	<link rel="alternate" type="text/html" href="http://danielroop.com/blog" />
	
	<id>http://danielroop.com/blog/comments/feed/atom/</id>

	<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/CommentsForRoopSays" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="commentsforroopsays" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry>
		<title>Comment on Why Defensive Programming is Rubbish by Russell Centanni</title>
		<link rel="alternate" href="http://danielroop.com/blog/2009/10/15/why-defensive-programming-is-rubbish/#comment-32330" type="text/html" />

		<author>
			<name>Russell Centanni</name>
			
		</author>

		<id>http://danielroop.com/blog/2009/10/15/why-defensive-programming-is-rubbish/#comment-32330</id>
		<updated>2009-12-02T22:59:45Z</updated>
		<published>2009-12-02T22:59:45Z</published>
		<content type="html" xml:base="http://danielroop.com/blog/2009/10/15/why-defensive-programming-is-rubbish/#comment-32330"><![CDATA[<p>I&#8217;m a fan of the fail-fast approach. Lately I&#8217;ve been writing methods with parameter assertions up front that throw descriptive exceptions when there&#8217;s a problem. Spring has some utility methods in org.springframework.util.Assert that are used for this purpose.</p>
<p>In my opinion, the only appropriate time for null checks is when null means something in the system.. and if that&#8217;s the case the check should be done in a method with a meaningful name. Having said that, I feel like groovy&#8217;s ? operator makes playing &#8220;hide the problem&#8221; even easier, resulting in a drop in code quality.</p>
]]></content>
	</entry>
	<entry>
		<title>Comment on Why Defensive Programming is Rubbish by Daniel Roop</title>
		<link rel="alternate" href="http://danielroop.com/blog/2009/10/15/why-defensive-programming-is-rubbish/#comment-30830" type="text/html" />

		<author>
			<name>Daniel Roop</name>
			<uri>http://danielroop.com</uri>
		</author>

		<id>http://danielroop.com/blog/2009/10/15/why-defensive-programming-is-rubbish/#comment-30830</id>
		<updated>2009-10-18T00:49:46Z</updated>
		<published>2009-10-18T00:49:46Z</published>
		<content type="html" xml:base="http://danielroop.com/blog/2009/10/15/why-defensive-programming-is-rubbish/#comment-30830"><![CDATA[<p>@Brian<br />
This does help solve the readability problem, but it still keeps the &#8220;hide the problem&#8221; aspect of your code.  That being said I agree there are times when a null check is appropriate, and I am a fan of what the dynamic languages do to make this easier.  Groovy has the ? operator (which is probably the best) and ruby let&#8217;s you add the conditional at the end of the line (allowing you to focus on the action not the conditions)</p>
]]></content>
	</entry>
	<entry>
		<title>Comment on Why Defensive Programming is Rubbish by Michael Sica</title>
		<link rel="alternate" href="http://danielroop.com/blog/2009/10/15/why-defensive-programming-is-rubbish/#comment-30816" type="text/html" />

		<author>
			<name>Michael Sica</name>
			<uri>http://michaelsica.com</uri>
		</author>

		<id>http://danielroop.com/blog/2009/10/15/why-defensive-programming-is-rubbish/#comment-30816</id>
		<updated>2009-10-17T15:58:42Z</updated>
		<published>2009-10-17T15:58:42Z</published>
		<content type="html" xml:base="http://danielroop.com/blog/2009/10/15/why-defensive-programming-is-rubbish/#comment-30816"><![CDATA[<p>I agree. Imagine if you actually tested every path through the code? The danger in your code samples (for a large application) is that understanding the different states your application could end up in is insane. There are much better ways to message a user when something goes wrong than to allow about half your code to work.</p>
]]></content>
	</entry>
	<entry>
		<title>Comment on Why Defensive Programming is Rubbish by Brian</title>
		<link rel="alternate" href="http://danielroop.com/blog/2009/10/15/why-defensive-programming-is-rubbish/#comment-30771" type="text/html" />

		<author>
			<name>Brian</name>
			<uri>http://brianlegros.com/blog</uri>
		</author>

		<id>http://danielroop.com/blog/2009/10/15/why-defensive-programming-is-rubbish/#comment-30771</id>
		<updated>2009-10-16T13:30:29Z</updated>
		<published>2009-10-16T13:30:29Z</published>
		<content type="html" xml:base="http://danielroop.com/blog/2009/10/15/why-defensive-programming-is-rubbish/#comment-30771"><![CDATA[<p>It&#8217;s ok, Groovy has an operator for that.  The ? can be used to chain null checks for more readable code.  So you could say:</p>
<p>if(person?.size() &gt; 0) &#8230;</p>
<p>Now all you have to do is use Groovy where you want to place null checks.  Seems like a reasonable goal to me <img src='http://danielroop.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p>
]]></content>
	</entry>
	<entry>
		<title>Comment on Java to Coldfusion HashMap by Shane</title>
		<link rel="alternate" href="http://danielroop.com/blog/2007/02/12/java-to-coldfusion-hashmap/#comment-30010" type="text/html" />

		<author>
			<name>Shane</name>
			
		</author>

		<id>http://danielroop.com/blog/2007/02/12/java-to-coldfusion-hashmap/#comment-30010</id>
		<updated>2009-09-23T23:23:34Z</updated>
		<published>2009-09-23T23:23:34Z</published>
		<content type="html" xml:base="http://danielroop.com/blog/2007/02/12/java-to-coldfusion-hashmap/#comment-30010"><![CDATA[<p>Thanks for posting this! Saved me some headache&#8230;</p>
]]></content>
	</entry>
	<entry>
		<title>Comment on Actionscript 3.0 Object Equality by Carlos Valdez</title>
		<link rel="alternate" href="http://danielroop.com/blog/2007/09/02/actionscript-30-object-equality/#comment-29761" type="text/html" />

		<author>
			<name>Carlos Valdez</name>
			
		</author>

		<id>http://danielroop.com/blog/2007/09/02/actionscript-30-object-equality/#comment-29761</id>
		<updated>2009-09-18T03:30:52Z</updated>
		<published>2009-09-18T03:30:52Z</published>
		<content type="html" xml:base="http://danielroop.com/blog/2007/09/02/actionscript-30-object-equality/#comment-29761"><![CDATA[<p>Thanks!</p>
]]></content>
	</entry>
	<entry>
		<title>Comment on EasyMock Exception when calling createMock by Mattias</title>
		<link rel="alternate" href="http://danielroop.com/blog/2008/05/22/easymock-exception-when-calling-createmock/#comment-28786" type="text/html" />

		<author>
			<name>Mattias</name>
			
		</author>

		<id>http://danielroop.com/blog/2008/05/22/easymock-exception-when-calling-createmock/#comment-28786</id>
		<updated>2009-08-25T12:11:15Z</updated>
		<published>2009-08-25T12:11:15Z</published>
		<content type="html" xml:base="http://danielroop.com/blog/2008/05/22/easymock-exception-when-calling-createmock/#comment-28786"><![CDATA[<p>Thanks! Fixed the problem for me <img src='http://danielroop.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content>
	</entry>
	<entry>
		<title>Comment on Program to an interface not an Interface by Jason</title>
		<link rel="alternate" href="http://danielroop.com/blog/2008/06/28/program-to-an-interface-not-an-interface/#comment-27663" type="text/html" />

		<author>
			<name>Jason</name>
			
		</author>

		<id>http://danielroop.com/blog/2008/06/28/program-to-an-interface-not-an-interface/#comment-27663</id>
		<updated>2009-07-28T22:34:55Z</updated>
		<published>2009-07-28T22:34:55Z</published>
		<content type="html" xml:base="http://danielroop.com/blog/2008/06/28/program-to-an-interface-not-an-interface/#comment-27663"><![CDATA[<p>Another reason why you might not want to use an interface is if you need the object to have a certain method available but you don&#8217;t want to make that method public.  You can&#8217;t do that with an interface.  An abstract class is the best alternative but IMO it makes just as much sense to make a concrete class.  A concrete class can still be extended and overridden and in a worst case scenario that concrete class can be turned into an abstract class without impacting the client of that class as long as the concrete class cannot be constructed outside of your control.  What I have proposed is the use of concrete classes with package, or lower, access constructors.  This gives you all the benefits of programming to an &#8220;interface&#8221; without unnecessary code waste.</p>
]]></content>
	</entry>
	<entry>
		<title>Comment on Program to an interface not an Interface by Justin Holzer</title>
		<link rel="alternate" href="http://danielroop.com/blog/2008/06/28/program-to-an-interface-not-an-interface/#comment-25574" type="text/html" />

		<author>
			<name>Justin Holzer</name>
			
		</author>

		<id>http://danielroop.com/blog/2008/06/28/program-to-an-interface-not-an-interface/#comment-25574</id>
		<updated>2009-06-11T18:36:06Z</updated>
		<published>2009-06-11T18:36:06Z</published>
		<content type="html" xml:base="http://danielroop.com/blog/2008/06/28/program-to-an-interface-not-an-interface/#comment-25574"><![CDATA[<p>IMO, the whole point of programming against interfaces is to be able to define expected behavior without having to go in to details about how the system will be implemented to carry out the behavior. Sure, you can inherit from a concrete or abstract class, but at that point, you are combining the definition of the expected behavior (i.e. method signatures), with the actual implementation of that behavior (optional for an abstract class of course).</p>
<p>Also, inheriting from a base/super class is not a substitute for a Java/C# interface, as you cannot force the sub-class to override non abstract methods. Sure, you could build an abstract class and declare all methods abstract, but at that point, why not just use an interface? Definition of expected behavior and implementation of that behavior should be kept separate, if possible. If you have the Interface (in the Java/C# sense of the word), why not then take advantage of it?</p>
]]></content>
	</entry>
	<entry>
		<title>Comment on Program to an interface not an Interface by Fat Agnus » Program to an interface, not an implementation</title>
		<link rel="alternate" href="http://danielroop.com/blog/2008/06/28/program-to-an-interface-not-an-interface/#comment-24689" type="text/html" />

		<author>
			<name>Fat Agnus » Program to an interface, not an implementation</name>
			<uri>http://fatagnus.com/program-to-an-interface-not-an-implementation/</uri>
		</author>

		<id>http://danielroop.com/blog/2008/06/28/program-to-an-interface-not-an-interface/#comment-24689</id>
		<updated>2009-05-20T10:48:22Z</updated>
		<published>2009-05-20T10:48:22Z</published>
		<content type="html" xml:base="http://danielroop.com/blog/2008/06/28/program-to-an-interface-not-an-interface/#comment-24689"><![CDATA[<p>[&#8230;] A java guy talks about Interface vs. Interface [&#8230;]</p>
]]></content>
	</entry>
</feed><!-- Dynamic Page Served (once) in 0.719 seconds --><!-- Cached page served by WP-Cache -->
