<?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: Null Creep</title>
	<atom:link href="http://stuffthathappens.com/blog/2008/04/24/null-creep/feed/" rel="self" type="application/rss+xml" />
	<link>http://stuffthathappens.com/blog/2008/04/24/null-creep/</link>
	<description>Technology and Geek Stuff by Eric Burke</description>
	<lastBuildDate>Mon, 26 Jul 2010 14:36:32 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Mark Volkmann</title>
		<link>http://stuffthathappens.com/blog/2008/04/24/null-creep/comment-page-1/#comment-10501</link>
		<dc:creator>Mark Volkmann</dc:creator>
		<pubDate>Fri, 09 May 2008 19:51:14 +0000</pubDate>
		<guid isPermaLink="false">http://stuffthathappens.com/blog/2008/04/24/null-creep/#comment-10501</guid>
		<description>How about using annotations as described here?
http://www.mcs.vuw.ac.nz/~djp/JACK/</description>
		<content:encoded><![CDATA[<p>How about using annotations as described here?<br />
<a href="http://www.mcs.vuw.ac.nz/~djp/JACK/" rel="nofollow">http://www.mcs.vuw.ac.nz/~djp/JACK/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Willis Morse</title>
		<link>http://stuffthathappens.com/blog/2008/04/24/null-creep/comment-page-1/#comment-9986</link>
		<dc:creator>Willis Morse</dc:creator>
		<pubDate>Wed, 30 Apr 2008 19:11:43 +0000</pubDate>
		<guid isPermaLink="false">http://stuffthathappens.com/blog/2008/04/24/null-creep/#comment-9986</guid>
		<description>This NPE solution is nice and simple if your testing (unit or otherwise) can guarantee that all conditions resulting in this NPE have been tested, found and fixed before you ship.

Desktop apps have to be a lot more defensive, however. If this goes into shipping code and occurs in the field, it probably won&#039;t get caught until some high level last defense Throwable catch block, usually at the topmost layer near the event loop. At this point, what can the app to do except quit? Yucch.

I prefer dealing with this at compile time, using the JetBrains @Nullable annotations. It forces you to deal with nulls locally at the level they occur, which is the only place you can recover from them. At that point you can then throw some semantically richer checked exception, giving the next layer up a fighting chance of figuring out what happened.</description>
		<content:encoded><![CDATA[<p>This NPE solution is nice and simple if your testing (unit or otherwise) can guarantee that all conditions resulting in this NPE have been tested, found and fixed before you ship.</p>
<p>Desktop apps have to be a lot more defensive, however. If this goes into shipping code and occurs in the field, it probably won&#8217;t get caught until some high level last defense Throwable catch block, usually at the topmost layer near the event loop. At this point, what can the app to do except quit? Yucch.</p>
<p>I prefer dealing with this at compile time, using the JetBrains @Nullable annotations. It forces you to deal with nulls locally at the level they occur, which is the only place you can recover from them. At that point you can then throw some semantically richer checked exception, giving the next layer up a fighting chance of figuring out what happened.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bert</title>
		<link>http://stuffthathappens.com/blog/2008/04/24/null-creep/comment-page-1/#comment-9908</link>
		<dc:creator>Bert</dc:creator>
		<pubDate>Tue, 29 Apr 2008 10:32:40 +0000</pubDate>
		<guid isPermaLink="false">http://stuffthathappens.com/blog/2008/04/24/null-creep/#comment-9908</guid>
		<description>Actually, when the code tests for &quot;null&quot;, then what the code does if so should be documented somewhere in the specs...</description>
		<content:encoded><![CDATA[<p>Actually, when the code tests for &#8220;null&#8221;, then what the code does if so should be documented somewhere in the specs&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ken Keenan</title>
		<link>http://stuffthathappens.com/blog/2008/04/24/null-creep/comment-page-1/#comment-9883</link>
		<dc:creator>Ken Keenan</dc:creator>
		<pubDate>Mon, 28 Apr 2008 19:21:37 +0000</pubDate>
		<guid isPermaLink="false">http://stuffthathappens.com/blog/2008/04/24/null-creep/#comment-9883</guid>
		<description>I am mostly an SQL programmer but you get exactly the same thing in the database world: people allowing NULLs in database columns for no good reason.</description>
		<content:encoded><![CDATA[<p>I am mostly an SQL programmer but you get exactly the same thing in the database world: people allowing NULLs in database columns for no good reason.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://stuffthathappens.com/blog/2008/04/24/null-creep/comment-page-1/#comment-9765</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Fri, 25 Apr 2008 20:56:44 +0000</pubDate>
		<guid isPermaLink="false">http://stuffthathappens.com/blog/2008/04/24/null-creep/#comment-9765</guid>
		<description>I long ago wrote a NullArgumentException class (which extends IllegalArgumentException) with a static void throwIfNull(Object arg, String parameterName) method

  throwIfNull(id, &quot;id&quot;);
  throwIfNull(name, &quot;name&quot;);

I use a static import to get access to it.</description>
		<content:encoded><![CDATA[<p>I long ago wrote a NullArgumentException class (which extends IllegalArgumentException) with a static void throwIfNull(Object arg, String parameterName) method</p>
<p>  throwIfNull(id, &#8220;id&#8221;);<br />
  throwIfNull(name, &#8220;name&#8221;);</p>
<p>I use a static import to get access to it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ycros</title>
		<link>http://stuffthathappens.com/blog/2008/04/24/null-creep/comment-page-1/#comment-9749</link>
		<dc:creator>Ycros</dc:creator>
		<pubDate>Fri, 25 Apr 2008 14:42:38 +0000</pubDate>
		<guid isPermaLink="false">http://stuffthathappens.com/blog/2008/04/24/null-creep/#comment-9749</guid>
		<description>Hell yes, throwing exceptions is what everyone should be doing - let the caller know they&#039;re doing the wrong thing as soon as possible!

So many programmers just check for null and don&#039;t do anything though. :(</description>
		<content:encoded><![CDATA[<p>Hell yes, throwing exceptions is what everyone should be doing &#8211; let the caller know they&#8217;re doing the wrong thing as soon as possible!</p>
<p>So many programmers just check for null and don&#8217;t do anything though. <img src='http://stuffthathappens.com/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam Halliday</title>
		<link>http://stuffthathappens.com/blog/2008/04/24/null-creep/comment-page-1/#comment-9738</link>
		<dc:creator>Sam Halliday</dc:creator>
		<pubDate>Fri, 25 Apr 2008 09:13:45 +0000</pubDate>
		<guid isPermaLink="false">http://stuffthathappens.com/blog/2008/04/24/null-creep/#comment-9738</guid>
		<description>I use a little static helper method that keeps the code clean

static public void notNull(Object... objects) {
    for (Object o : objects) {
        if (o == null)
            throw new NullPointerException();
    }
}

Just throw that off in a convenience class somewhere and reference it with static imports. Saves the dependency on Google Collections (although, admittedly I use Google Collections, but I&#039;ve been using this since long before that library was released). The Google Collections version is arguably better for debugging (parameter names), but mine is less of a distraction at write time.

I&#039;ve always loved the idea of @Nullable annotations... anyone know if NetBeans supports something similar? (I find NetBeans to be a much cleaner IDE, but always a year or two behind everyone else with auto hints and things like this)

http://javablog.co.uk/2007/05/07/null-parameters-and-returning-null/</description>
		<content:encoded><![CDATA[<p>I use a little static helper method that keeps the code clean</p>
<p>static public void notNull(Object&#8230; objects) {<br />
    for (Object o : objects) {<br />
        if (o == null)<br />
            throw new NullPointerException();<br />
    }<br />
}</p>
<p>Just throw that off in a convenience class somewhere and reference it with static imports. Saves the dependency on Google Collections (although, admittedly I use Google Collections, but I&#8217;ve been using this since long before that library was released). The Google Collections version is arguably better for debugging (parameter names), but mine is less of a distraction at write time.</p>
<p>I&#8217;ve always loved the idea of @Nullable annotations&#8230; anyone know if NetBeans supports something similar? (I find NetBeans to be a much cleaner IDE, but always a year or two behind everyone else with auto hints and things like this)</p>
<p><a href="http://javablog.co.uk/2007/05/07/null-parameters-and-returning-null/" rel="nofollow">http://javablog.co.uk/2007/05/07/null-parameters-and-returning-null/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jesse</title>
		<link>http://stuffthathappens.com/blog/2008/04/24/null-creep/comment-page-1/#comment-9737</link>
		<dc:creator>Jesse</dc:creator>
		<pubDate>Fri, 25 Apr 2008 08:18:44 +0000</pubDate>
		<guid isPermaLink="false">http://stuffthathappens.com/blog/2008/04/24/null-creep/#comment-9737</guid>
		<description>Steve, you&#039;re right about Google collections. I use it with a static import, which makes the null checks almost vanish into the code:
  public Company(String id, String name) {
    this.id = checkNotNull(id, &quot;id&quot;);
    this.name = checkNotNull(name, &quot;name&quot;);
  }</description>
		<content:encoded><![CDATA[<p>Steve, you&#8217;re right about Google collections. I use it with a static import, which makes the null checks almost vanish into the code:<br />
  public Company(String id, String name) {<br />
    this.id = checkNotNull(id, &#8220;id&#8221;);<br />
    this.name = checkNotNull(name, &#8220;name&#8221;);<br />
  }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve McLeod</title>
		<link>http://stuffthathappens.com/blog/2008/04/24/null-creep/comment-page-1/#comment-9731</link>
		<dc:creator>Steve McLeod</dc:creator>
		<pubDate>Fri, 25 Apr 2008 06:55:49 +0000</pubDate>
		<guid isPermaLink="false">http://stuffthathappens.com/blog/2008/04/24/null-creep/#comment-9731</guid>
		<description>Great tip, my sentiment exactly. This small habit has an enormous upstream effect on code cleanliness and stability.

The same effect, but in an even nicer way can be achieved with the Preconditions class in the Google Collections.

 public Company(String id, String name) {
    Preconditions.checkNotNull(id);
    Preconditions.checkNotNull(name);

    this.id = id;
    this.name = name;
  }</description>
		<content:encoded><![CDATA[<p>Great tip, my sentiment exactly. This small habit has an enormous upstream effect on code cleanliness and stability.</p>
<p>The same effect, but in an even nicer way can be achieved with the Preconditions class in the Google Collections.</p>
<p> public Company(String id, String name) {<br />
    Preconditions.checkNotNull(id);<br />
    Preconditions.checkNotNull(name);</p>
<p>    this.id = id;<br />
    this.name = name;<br />
  }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sean M.</title>
		<link>http://stuffthathappens.com/blog/2008/04/24/null-creep/comment-page-1/#comment-9726</link>
		<dc:creator>Sean M.</dc:creator>
		<pubDate>Fri, 25 Apr 2008 03:09:32 +0000</pubDate>
		<guid isPermaLink="false">http://stuffthathappens.com/blog/2008/04/24/null-creep/#comment-9726</guid>
		<description>Null Creep, sounds like a new Dilbert character. :-P

Findbugs can help chase down Null Creep as well.  I seem to remember Bill Pugh and the JetBrains folks having something to do with JSR-305 ;-)</description>
		<content:encoded><![CDATA[<p>Null Creep, sounds like a new Dilbert character. <img src='http://stuffthathappens.com/blog/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' /> </p>
<p>Findbugs can help chase down Null Creep as well.  I seem to remember Bill Pugh and the JetBrains folks having something to do with JSR-305 <img src='http://stuffthathappens.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.251 seconds -->
