<?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: Using the Null Object Pattern With ActiveRecord</title>
	<atom:link href="http://www.pathf.com/blogs/2008/03/using-the-null/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pathf.com/blogs/2008/03/using-the-null/</link>
	<description>Running commentary about agile development, user experience design and Ajax.</description>
	<lastBuildDate>Fri, 05 Mar 2010 19:33:43 -0600</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Matt Wynne</title>
		<link>http://www.pathf.com/blogs/2008/03/using-the-null/comment-page-1/#comment-3550</link>
		<dc:creator>Matt Wynne</dc:creator>
		<pubDate>Tue, 07 Oct 2008 17:55:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.pathf.com/blogs/?p=65#comment-3550</guid>
		<description>Thanks for this clear explanation Noel.

I was wondering how this would look to clients who were still interested in whether the user was real or not.

Obviously using this pattern should clear up 90% of these cases, but there might still be a few.

As I understand it, it&#039;s impossible in ruby to make a real class look like nil (probably a good thing), so you&#039;d have to do this:

if task.user != user.unassigned_user
  # do something special with this assigned task
end

I think that&#039;s OK. It&#039;s a bit more verbose than just calling task.user? but also very clear about what&#039;s going on. I also like the fact that we&#039;ve introduced the first-class concept of an &#039;unassigned user&#039; into the domain.</description>
		<content:encoded><![CDATA[<p>Thanks for this clear explanation Noel.</p>
<p>I was wondering how this would look to clients who were still interested in whether the user was real or not.</p>
<p>Obviously using this pattern should clear up 90% of these cases, but there might still be a few.</p>
<p>As I understand it, it&#8217;s impossible in ruby to make a real class look like nil (probably a good thing), so you&#8217;d have to do this:</p>
<p>if task.user != user.unassigned_user<br />
  # do something special with this assigned task<br />
end</p>
<p>I think that&#8217;s OK. It&#8217;s a bit more verbose than just calling task.user? but also very clear about what&#8217;s going on. I also like the fact that we&#8217;ve introduced the first-class concept of an &#8216;unassigned user&#8217; into the domain.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kenny Debeck</title>
		<link>http://www.pathf.com/blogs/2008/03/using-the-null/comment-page-1/#comment-2986</link>
		<dc:creator>Kenny Debeck</dc:creator>
		<pubDate>Tue, 12 Aug 2008 20:33:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.pathf.com/blogs/?p=65#comment-2986</guid>
		<description>Hi,

Wouldn&#039;t it be better to have a record with the Unassigned / Anonymous user?  It is a dependence but you can create the record from your application (for example, on startup create_if_not_exists the anonymous user).

The advantage is that you can give AnonymousUser a closer behavior to the normal User.  If you have associations with User, you could have to mimic them in Anonymous.  Say your User has some roles/memberships/privileges, then it is easier to enforce that your Anonymous has some default role/membership/privilege and to modify/add/delete some in the future.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Wouldn&#8217;t it be better to have a record with the Unassigned / Anonymous user?  It is a dependence but you can create the record from your application (for example, on startup create_if_not_exists the anonymous user).</p>
<p>The advantage is that you can give AnonymousUser a closer behavior to the normal User.  If you have associations with User, you could have to mimic them in Anonymous.  Say your User has some roles/memberships/privileges, then it is easier to enforce that your Anonymous has some default role/membership/privilege and to modify/add/delete some in the future.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic page generated in 0.230 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2010-03-19 06:10:29 -->
