<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Geekality &#187; Best practices</title>
	<atom:link href="http://www.geekality.net/tag/best-practices/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.geekality.net</link>
	<description>With a hint of Social Ineptitude</description>
	<lastBuildDate>Tue, 27 Jul 2010 16:15:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>When to check for null</title>
		<link>http://www.geekality.net/2009/01/15/when-to-check-for-null/</link>
		<comments>http://www.geekality.net/2009/01/15/when-to-check-for-null/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 19:13:11 +0000</pubDate>
		<dc:creator>Torleif</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Best practices]]></category>

		<guid isPermaLink="false">http://www.geekality.net/?p=48</guid>
		<description><![CDATA[I often get truly tired of all the null checking when programming. I keep asking myself, is this really necessary? For example, I am the one coding it, and I am the only one who will be sending stuff into &#8230; <a href="http://www.geekality.net/2009/01/15/when-to-check-for-null/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I often get truly tired of all the null checking when programming. I keep asking myself, is this really necessary? For example, I am the one coding it, and I am the only one who will be sending stuff into those methods. This is of course not always the case, but very often it is.</p>
<p>Anyways, I found some good advice on when we should check for null values and thought I could note it down here and share it.</p>
<blockquote><p>One thing to remember is that the code you write today, while it may be a small team and you can have good documentation, will turn into legacy code that someone else will have to maintain. I use the following rules:</p>
<ul>
<li>If I&#8217;m writing a public API that will be exposed to others, then I will do null checks on all reference parameters.</li>
<li>If I&#8217;m writing an internal component to my application, I write null checks when I need to do something special when a null exists, or when I want to make it very clear. Otherwise I don&#8217;t mind getting the null reference exception since that is also fairly clear what is going on.</li>
<li>When working with return data from other peoples frameworks, I only check for null when it is possible and valid to have a null returned. If their contract says it doesn&#8217;t return nulls, I won&#8217;t do the check.</li>
</ul>
</blockquote>
<p>Very good advice <img src='http://www.geekality.net/wp-includes/images/blank.gif' alt=':)' title=':)' class='wp-smiley smiley-1' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekality.net/2009/01/15/when-to-check-for-null/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
