<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2" -->
<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/"
	>

<channel>
	<title>Rabbit Creative</title>
	<link>http://www.rabbitcreative.com</link>
	<description>ruby, rails, objects and politics</description>
	<pubDate>Mon, 16 Jun 2008 23:54:08 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2</generator>
	<language>en</language>
			<item>
		<title>David Black writes again!</title>
		<link>http://www.rabbitcreative.com/2008/06/06/david-black-writes-again/</link>
		<comments>http://www.rabbitcreative.com/2008/06/06/david-black-writes-again/#comments</comments>
		<pubDate>Fri, 06 Jun 2008 20:53:20 +0000</pubDate>
		<dc:creator>Rabbit</dc:creator>
		
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.rabbitcreative.com/2008/06/06/david-black-writes-again/</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[]]></content:encoded>
			<wfw:commentRss>http://www.rabbitcreative.com/2008/06/06/david-black-writes-again/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Retris lives. Gosu rocks. Object thinking prevails.</title>
		<link>http://www.rabbitcreative.com/2008/06/01/retris-lives-gosu-rocks-object-thinking-prevails/</link>
		<comments>http://www.rabbitcreative.com/2008/06/01/retris-lives-gosu-rocks-object-thinking-prevails/#comments</comments>
		<pubDate>Sun, 01 Jun 2008 07:40:02 +0000</pubDate>
		<dc:creator>Rabbit</dc:creator>
		
		<category><![CDATA[game programming]]></category>

		<category><![CDATA[gosu]]></category>

		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.rabbitcreative.com/2008/06/01/retris-lives-gosu-rocks-object-thinking-prevails/</guid>
		<description><![CDATA[I pushed the first version of Retris to github about ten minutes ago. It feels pretty good.






Retris screen cast (large version)
Github repo: http://github.com/angryrabbit/retris/tree/master
gosu library

There are quite a few missing features, but it&#8217;s playable. There are probably a small handful of bugs. I&#8217;m only aware of one or two. Both are documented in the readme.
I want [...]]]></description>
			<content:encoded><![CDATA[<p>I pushed the first version of Retris to github about ten minutes ago. It feels pretty good.</p>
<p><object type="application/x-shockwave-flash" width="398" height="400" data="http://www.flickr.com/apps/video/stewart.swf?v=49235" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
<param name="flashvars" value="intl_lang=en-us&amp;photo_secret=0eee4a0757&amp;photo_id=2540254537"></param>
<param name="movie" value="http://www.flickr.com/apps/video/stewart.swf?v=49235"></param>
<param name="bgcolor" value="#000000"></param>
<param name="allowFullScreen" value="true"></param><embed type="application/x-shockwave-flash" src="http://www.flickr.com/apps/video/stewart.swf?v=49235" bgcolor="#000000" allowfullscreen="true" flashvars="intl_lang=en-us&amp;photo_secret=0eee4a0757&amp;photo_id=2540254537" height="400" width="398"></embed></object></p>
<ul>
<li><a href="http://rabbitcreative.com/retris.mov">Retris screen cast (large version)</a></li>
<li>Github repo: <a href="http://github.com/angryrabbit/retris/tree/master">http://github.com/angryrabbit/retris/tree/master</a></li>
<li><a href="http://code.google.com/p/gosu/">gosu library</a></li>
</ul>
<p>There are quite a few missing features, but it&#8217;s playable. There are probably a small handful of bugs. I&#8217;m only aware of one or two. Both are documented in the readme.</p>
<p>I want to thank Julian Raschke and the other gosu contributors. I love Ruby and it&#8217;s awesome to be able to concentrate on my game rather than dick around with low-level details.</p>
<p>As happy as I am that I&#8217;ve &#8220;finally made a game&#8221;, I have to confess, I don&#8217;t care for Tetris. I suck at it, too. I wrote it because I read in an old game programming book that Tetris is a good first game.</p>
<p>So what&#8217;s next? Well, I have a few things I want to finish up. As <a href="http://www.fastgraph.com/makegames/sidescroller/">Diana Gruber</a> says, &#8220;the last 10% of the game takes as long as the first 90%&#8221;. Or something like that.</p>
<p>At the very least I need to instate loss conditions. Currently, overflowing the grid simply causes the game to go on a freak rampage, creating shape after shape in the grid&#8217;s origin. It doesn&#8217;t crash, but you can&#8217;t do anything but exit when you reach that point.</p>
<p>I&#8217;d also like to put in a menu, pause feature, difficulty levels and a menu.</p>
<p>When those things are done I&#8217;ll start to think about another game.</p>
<p>I&#8217;d like to point out that I ditched the idea of using a matrix (nested arrays, actually) to model either the grid or shape objects. I made this move for several reasons:</p>
<ul>
<li>Nested arrays require some math</li>
<li>I can&#8217;t ask a nested array meaningful questions</li>
<li>Previous attempts at using nested arrays fell short for me</li>
<li>It doesn&#8217;t feel very object oriented</li>
</ul>
<p>There&#8217;s no doubt in my mind nested arrays are a viable implementation to Tetris, but personally, I prefer objects.</p>
<p>True, I could have wrapped the nested arrays into an object and queried that, but it&#8217;s just not decomposed enough for my tastes. My landscape (objectscape?) includes Grid, GridLocation, Cursor, Shape, Location and Block objects to orchestrate the interactions required of Tetris. (There are a few more objects, but the ones I listed are my solution to NOT using nested arrays.)</p>
<p>Similar to my <a href="http://www.rabbitcreative.com/2007/05/11/object-oriented-solution-to-the-tower-of-hanoi/">object-oriented solution to the Tower of Hanoi</a>, (portions of) my code read like a story. Stories are easier to grasp than mathematics. At least for now they are. I&#8217;ve decided to go back to school primarily for math.</p>
<p>I imagine though, that even as I become more proficient with math, the &#8220;stage&#8221; my code lives in, and the messages passed back and forth, will remain largely true to my current style.</p>
<p>In fact, if object-oriented programming is really all it&#8217;s cracked up to be, my style will only get tighter and more nuanced; only the implementations will change.</p>
<p>Five years from now I just might use an (actual!) matrix object to handle the implementation for Tetris interactions. But, my guess (indeed, my hope) is that the act of sending messages to create a story will remain in force.</p>
<p>Here&#8217;s to the human mind.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rabbitcreative.com/2008/06/01/retris-lives-gosu-rocks-object-thinking-prevails/feed/</wfw:commentRss>
<enclosure url="http://rabbitcreative.com/retris.mov" length="4420351" type="video/quicktime" />
		</item>
		<item>
		<title>Retris.</title>
		<link>http://www.rabbitcreative.com/2008/05/31/retris/</link>
		<comments>http://www.rabbitcreative.com/2008/05/31/retris/#comments</comments>
		<pubDate>Sat, 31 May 2008 07:25:05 +0000</pubDate>
		<dc:creator>Rabbit</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.rabbitcreative.com/2008/05/31/retris/</guid>
		<description><![CDATA[It&#8217;s coming along.

]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s coming along.</p>
<p><a href='http://www.rabbitcreative.com/wp-content/uploads/2008/05/picture-3.png' title='picture-3.png'><img src='http://www.rabbitcreative.com/wp-content/uploads/2008/05/picture-3.png' alt='picture-3.png' /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rabbitcreative.com/2008/05/31/retris/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Our situation in a nutshell.</title>
		<link>http://www.rabbitcreative.com/2008/05/21/our-situation-in-a-nutshell/</link>
		<comments>http://www.rabbitcreative.com/2008/05/21/our-situation-in-a-nutshell/#comments</comments>
		<pubDate>Thu, 22 May 2008 05:52:20 +0000</pubDate>
		<dc:creator>Rabbit</dc:creator>
		
		<category><![CDATA[Politics]]></category>

		<guid isPermaLink="false">http://www.rabbitcreative.com/2008/05/21/our-situation-in-a-nutshell/</guid>
		<description><![CDATA[Damn good comment high-jacked from Alternet:

One of the chief detriments of the so-called “information revolution” is the nature of information delivery: we get “factoids” &#8212; dismembered fragments of data delivered in such great numbers at so great a speed that developing the context and critical thinking necessary for real comprehension is, in most peoples’ cases, [...]]]></description>
			<content:encoded><![CDATA[<p>Damn good comment <a href="http://www.alternet.org/environment/84960/?comments=view&#038;cID=903323&#038;pID=903291#c903323">high-jacked from Alternet</a>:</p>
<p><em><br />
One of the chief detriments of the so-called “information revolution” is the nature of information delivery: we get “factoids” &#8212; dismembered fragments of data delivered in such great numbers at so great a speed that developing the context and critical thinking necessary for real comprehension is, in most peoples’ cases, obviated. This easily places media like television and the internet almost by default at the service of prevailing establishment power. All that needs be done is to keep bombarding the populace with byte-sized disconnected chunks of emotionally resonant information which, given this dislocation from any corresponding or conflicting data and from any grounded theory of historic process, debases the very essential question of &#8220;how are we to live&#8221; to the point that such a question is little more than hollow entertainment. Fewer and fewer of us, struggling to keep body and soul together, have the time, energy, or inclination to develop the patience and epistemological grounding requisite to taking a well-reasoned, humane and ethical orientation to the constantly streaming flood of factoids which create in our minds “the world.”</p>
<p>The authors claim that historic perspective allows one to recognize that the ever-widening shockwaves of 500 years of Eurocentric imperialism are really ” heralding the beginning of a large-scale shift at the deepest levels of cultural organization.” Really? Sounds as exciting and easy to grasp as The Celestine Prophecy. Cloudy attempts to “envision alternate futures” while avoiding taking a particular historic and conceptual stance only reinforce the status quo, which I feel sure is not the authors’ intent. Our present ecohumanitarian crisis is a direct consequence of an already extant scenario developed by politico-economic forces which have prevailed in the US roughly since 1948.</p>
<p>Articles like this are just pipedreams if not grasped in the context, for example, of the planned underwriting of increased reliance on the automobile with how the National Interstate and Defense Highways Act of 1956 was imlemented, and the corresponding deterioration of community following the post WWII FHA boom in “suburbanization.” All of this was part of “urban” design as envisaged from the perspective of power and wealth and designed to serve those interests. This has been discussed widely for many years, for example in Bertram Gross’ Friendly Fascism: The New Face of Power in America (1980) and in The City in History (1961) and The Myth of the Machine (1967-1970), both by Lewis Mumford.</p>
<p>The crisis addressed here is neither unintended nor unforeseen, nor will there be any viable and meaningful recovery unless policy which has today the status of revealed truth becomes recognized for the totalitarian system it is and overthrown from the bottom up. Frankly, there doesn’t appear to be a lot of reason for optimism. Feel-good affirmations may be just fine between you and your bathroom mirror, but have no place in any serious discourse about social change when the terms of the debate are as confused and the situation as dire as where we find ourselves today.</p>
<p>It is essential that any well-intentioned vision of alternative futures not replace or sap a persistent effort to perceive, oppose and deconstruct the immoral, inhumane establishment structure of power and ideology. Until we are agreed on a clear and well-detailed picture of what we hope to change, to “envision alternate futures” is all too often just time and energy stolen from the liberation and transformation we pay lip service to and, through that distraction, perpetuation of the cruelties and injustices we all hope to remedy.<br />
</em></p>
<p>Here two opposing viewpoints:</p>
<p><strong>Viewpoint 1:</strong></p>
<p><em><br />
Actually I can&#8230; we live on finite planet with finite resources. We<br />
now have over 6.6 billion people here. The more people on the earth,<br />
the smaller the resource pie becomes, especially when non- renewable<br />
resources are starting to decline.</p>
<p>This is not rocket science folks. Next year, this will look like the<br />
good old days. If higher prices do not curb consumption rationing and<br />
shortages are next. The thin veil of civility will evaporate once that<br />
happens. It is going to get very ugly, very soon.</p>
<p>Do what you can to mitigate these impacts on your live. Get out of<br />
debt, become super efficient, and conserve as much as possible.<br />
Investing in active renewables and growing a garden and planting an<br />
orchard might be wise as well.</p>
<p>What an interesting time to be alive.<br />
</em></p>
<p><strong>Viewpoint 2:</strong></p>
<p><em><br />
So you say we live on a finite planet with finite resources? Billions<br />
of watts of power fall on our planet from an outside source every day.</p>
<p>And with enough power, one can do practically anything.</p>
<p>And, to a great extent, it IS rocket science, and science and<br />
technology in general, that will allow us to make better use of the<br />
resources we have, and find and create more.</p>
<p>If anything, it&#8217;s the zero-sum, finite-resource type of thinking tht&#8217;s<br />
going to get us into trouble. Don&#8217;t fight over the pie, bake new<br />
ones&#8230;</em></p>
<p>Given the dichotomy between viewpoint 1 and 2, I say the root problem is, as I&#8217;ve said before, fear.</p>
<p>Fear that if you don&#8217;t, someone else will; and the person that does will not be kind towards you.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rabbitcreative.com/2008/05/21/our-situation-in-a-nutshell/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Creeping fingers.</title>
		<link>http://www.rabbitcreative.com/2008/05/21/creeping-fingers/</link>
		<comments>http://www.rabbitcreative.com/2008/05/21/creeping-fingers/#comments</comments>
		<pubDate>Wed, 21 May 2008 20:02:19 +0000</pubDate>
		<dc:creator>Rabbit</dc:creator>
		
		<category><![CDATA[Politics]]></category>

		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://www.rabbitcreative.com/2008/05/21/creeping-fingers/</guid>
		<description><![CDATA[It&#8217;s sad when common sense is eaten alive by fear and a cover-your-ass attitude.
I&#8217;m glad I was given the opportunity to see it firsthand, but I&#8217;m disheartened that it was there to see in the first place.
An entity claiming responsibility for all happenings that lacks the resources, expertise or motivation to actually act responsibly is [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s sad when common sense is eaten alive by fear and a cover-your-ass attitude.</p>
<p>I&#8217;m glad I was given the opportunity to see it firsthand, but I&#8217;m disheartened that it was there to see in the first place.</p>
<p>An entity claiming responsibility for all happenings that lacks the resources, expertise or motivation to actually <em>act</em> responsibly is not an entity that should exist. Doing otherwise sounds like a narcissistic god delusion to me. Proponents of god, like those of big government, claim their benevolent dictator can do more that it can.</p>
<p>The government (state-level government, I&#8217;m assuming here) dipped its creeping fingers into something it didn&#8217;t understand, or, more likely, didn&#8217;t care to understand. The result is a free iPhone, some nice code, decent designs and another nail in the coffin of the &#8220;land of the free and the home of the brave&#8221;.</p>
<p>Free indeed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rabbitcreative.com/2008/05/21/creeping-fingers/feed/</wfw:commentRss>
		</item>
		<item>
		<title>RSpec, meet Flow.</title>
		<link>http://www.rabbitcreative.com/2008/05/15/rspec-meet-flow/</link>
		<comments>http://www.rabbitcreative.com/2008/05/15/rspec-meet-flow/#comments</comments>
		<pubDate>Fri, 16 May 2008 00:20:12 +0000</pubDate>
		<dc:creator>Rabbit</dc:creator>
		
		<category><![CDATA[rspec]]></category>

		<category><![CDATA[Object Thinking]]></category>

		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.rabbitcreative.com/2008/05/15/rspec-meet-flow/</guid>
		<description><![CDATA[Flow is the demon that appears after about an hour of using RSpec. He sits on my shoulder and watches me code.
After a few minutes he stands up. I know to turn down the music. He whispers into my ear. I nod in agreement and mouth back a response.
Flow understands my frustration with testing individual [...]]]></description>
			<content:encoded><![CDATA[<p>Flow is the demon that appears after about an hour of using RSpec. He sits on my shoulder and watches me code.</p>
<p>After a few minutes he stands up. I know to turn down the music. He whispers into my ear. I nod in agreement and mouth back a response.</p>
<p>Flow understands my frustration with testing individual methods outside any greater context or usage scenario.</p>
<p>RSpec is a beautiful tool. Leaps and bounds ahead of the standard testing framework built into Rails. It does this, I believe, by allowing you to use more natural language. But it can be be misused. Which is actually closer to abuse, because unless you&#8217;re paying respect to flow, you&#8217;re fucking yourself.</p>
<p><strong>Don&#8217;t test methods outside of the context in which they should be used.</strong> It doesn&#8217;t mean shit to the person reading your code &#8212; even if that person is you.</p>
<p>Your program is a play. Your objects are actors. You are the writer and director. You say action! You say cut! You know all the lines, but it&#8217;s not your job to voice them. You assign those roles to your actors, and they carry it out much better than your sorry ass ever could.</p>
<p>Context. Acknowledge it. If your tests look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby">describe <span style="color:#996600;">'An InterestList'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
  before<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:each</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    <span style="color:#0066ff; font-weight:bold;">@interest_list</span> = InterestList.<span style="color:#9900CC;">create</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  describe <span style="color:#996600;">'upon creation'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
    it <span style="color:#996600;">'should not be a new record'</span>
    it <span style="color:#996600;">'should be empty'</span>
    it <span style="color:#996600;">'should report having zero Interest objects'</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  describe <span style="color:#996600;">'when adding a ProductInventoryPrototype'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
    before<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:each</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      <span style="color:#0066ff; font-weight:bold;">@cheese</span> = inventory_prototypes<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:cheese</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    it <span style="color:#996600;">'should answer true'</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  describe <span style="color:#996600;">'with one ProductInventoryPrototype in it'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
    before<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:each</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      <span style="color:#0066ff; font-weight:bold;">@cheese</span> = inventory_prototypes<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:cheese</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#0066ff; font-weight:bold;">@interest_list</span>.<span style="color:#9900CC;">add</span><span style="color:#006600; font-weight:bold;">&#40;</span>@cheese<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    it <span style="color:#996600;">'should not be empty'</span>
    it <span style="color:#996600;">'should report having one interest'</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  describe <span style="color:#996600;">'removing a ProductInventoryPrototype'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
    before<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:each</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      <span style="color:#0066ff; font-weight:bold;">@cheese</span> = inventory_prototypes<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:cheese</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#0066ff; font-weight:bold;">@interest_list</span>.<span style="color:#9900CC;">add</span><span style="color:#006600; font-weight:bold;">&#40;</span>@cheese<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    it <span style="color:#996600;">'should answer with the item when that item is removed'</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  describe <span style="color:#996600;">'after removing a ProductInventoryPrototype'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
    before<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:each</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      <span style="color:#0066ff; font-weight:bold;">@cheese</span> = inventory_prototypes<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:cheese</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#0066ff; font-weight:bold;">@interest_list</span>.<span style="color:#9900CC;">add</span><span style="color:#006600; font-weight:bold;">&#40;</span>@cheese<span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#0066ff; font-weight:bold;">@interest_list</span>.<span style="color:#9900CC;">remove</span><span style="color:#006600; font-weight:bold;">&#40;</span>@cheese<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    it <span style="color:#996600;">'should be empty when that item is removed'</span>
    it <span style="color:#996600;">'should report having zero items'</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>You&#8217;re fucking with the laws of nature, and you will be smitten.</p>
<p>What&#8217;s wrong with it? The
<pre>#before</pre>
<p> code is reinitializing all the steps you&#8217;ve just accomplished.</p>
<p>Make it look like this.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby">describe <span style="color:#996600;">'When working with an InterestList,'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
  before<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:each</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    <span style="color:#0066ff; font-weight:bold;">@interest_list</span> = InterestList.<span style="color:#9900CC;">create</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  describe <span style="color:#996600;">'it must first be created.'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
    it <span style="color:#996600;">'It should not be a new record.'</span>
    it <span style="color:#996600;">'It should be empty.'</span>
    it <span style="color:#996600;">'It should report having zero Interest objects.'</span>
&nbsp;
    describe <span style="color:#996600;">' After which you can add a product.'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
      before<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:each</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
        <span style="color:#0066ff; font-weight:bold;">@cheese</span> = inventory_prototypes<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:cheese</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
      it <span style="color:#996600;">'To which it should answer true.'</span>
&nbsp;
      describe <span style="color:#996600;">'It now has one product in it.'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
        before<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:each</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
          <span style="color:#0066ff; font-weight:bold;">@interest_list</span>.<span style="color:#9900CC;">add</span><span style="color:#006600; font-weight:bold;">&#40;</span>@cheese<span style="color:#006600; font-weight:bold;">&#41;</span>
        <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
        it <span style="color:#996600;">'It should not be empty.'</span>
        it <span style="color:#996600;">'It should report having one interest.'</span>
&nbsp;
        describe <span style="color:#996600;">'Now we remove a ProductInventoryPrototype.'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
          it <span style="color:#996600;">'It should answer with the item when that item is removed.'</span>
&nbsp;
          describe <span style="color:#996600;">'After removing a ProductInventoryPrototype,'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
            before<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:each</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
              <span style="color:#0066ff; font-weight:bold;">@interest_list</span>.<span style="color:#9900CC;">remove</span><span style="color:#006600; font-weight:bold;">&#40;</span>@cheese<span style="color:#006600; font-weight:bold;">&#41;</span>
            <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
            it <span style="color:#996600;">'it should be empty when that item is removed.'</span>
            it <span style="color:#996600;">'it should report having zero items'</span>
&nbsp;
          <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
        <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
      <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Of primary importance is a subtle point. I didn&#8217;t illustrate it in the two examples above, but I will now:</p>
<p>Before:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby">describe <span style="color:#996600;">'When working with an InterestList,'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
  before<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:each</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    <span style="color:#0066ff; font-weight:bold;">@interest_list</span> = InterestList.<span style="color:#9900CC;">create</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  describe <span style="color:#996600;">'it must first be created.'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
    it <span style="color:#996600;">'It should not be a new record.'</span>
    it <span style="color:#996600;">'It should be empty.'</span>
    it <span style="color:#996600;">'It should report having zero Interest objects.'</span>
&nbsp;
    describe <span style="color:#996600;">' After which you can add a product.'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
      before<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:each</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
        <span style="color:#0066ff; font-weight:bold;">@cheese</span> = inventory_prototypes<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:cheese</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
      it <span style="color:#996600;">'To which it should answer true.'</span>
      it <span style="color:#996600;">'It should not be empty.'</span>
      it <span style="color:#996600;">'It should report having one interest.'</span>
...</pre></div></div>

<p>After:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby">describe <span style="color:#996600;">'When working with an InterestList,'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
  before<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:each</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    <span style="color:#0066ff; font-weight:bold;">@interest_list</span> = InterestList.<span style="color:#9900CC;">create</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  describe <span style="color:#996600;">'it must first be created.'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
    it <span style="color:#996600;">'It should not be a new record.'</span>
    it <span style="color:#996600;">'It should be empty.'</span>
    it <span style="color:#996600;">'It should report having zero Interest objects.'</span>
&nbsp;
    describe <span style="color:#996600;">' After which you can add a product.'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
      before<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:each</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
        <span style="color:#0066ff; font-weight:bold;">@cheese</span> = inventory_prototypes<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:cheese</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
      it <span style="color:#996600;">'To which it should answer true.'</span>
&nbsp;
      describe <span style="color:#996600;">' At which point'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
        it <span style="color:#996600;">'it should not be empty.'</span>
        it <span style="color:#996600;">'it should report having one interest.'</span>
...</pre></div></div>

<p>On the surface it&#8217;s just another level of nesting. After meditation, you realize you are <em>first</em> testing the object&#8217;s answer to your message. <em>Second</em>, you are testing the state of the universe after that action is made. The difference is subtle, but important. If you don&#8217;t understand the importance, recall the indifference you felt when you first saw RSpec: <em>it&#8217;s Rails&#8217; standard test framework with different words thrown in.</em></p>
<p>You were wrong then and you&#8217;re wrong now.</p>
<blockquote><p>Words offer the means to meaning, and for those who will listen, the enunciation of truth. - V</p></blockquote>
<p>If an object&#8217;s answer to the message passed violates expectations, flow stops. You know, not that a <em>method</em> is broken, but that <em>flow</em> is broken.</p>
<p>Of secondary importance is that your
<pre>#before</pre>
<p> methods are no longer redundant.</p>
<p>The result of running your tests now looks like:</p>
<pre>
When working with an InterestList, it must first be created. It should not be a new record. (Not Yet Implemented)
When working with an InterestList, it must first be created. It should be empty. (Not Yet Implemented)
When working with an InterestList, it must first be created. It should report having zero Interest objects. (Not Yet Implemented)
When working with an InterestList, it must first be created. After which you can add a product. To which it should answer true. (Not Yet Implemented)
When working with an InterestList, it must first be created. After which you can add a product. It now has one product in it. It should not be empty. (Not Yet Implemented)
When working with an InterestList, it must first be created. After which you can add a product. It now has one product in it. It should report having one interest. (Not Yet Implemented)
When working with an InterestList, it must first be created. After which you can add a product. It now has one product in it. Now we remove a ProductInventoryPrototype. It should answer with the item when that item is removed. (Not Yet Implemented)
When working with an InterestList, it must first be created. After which you can add a product. It now has one product in it. Now we remove a ProductInventoryPrototype. After removing a ProductInventoryPrototype, it should be empty when that item is removed. (Not Yet Implemented)
When working with an InterestList, it must first be created. After which you can add a product. It now has one product in it. Now we remove a ProductInventoryPrototype. After removing a ProductInventoryPrototype, it should report having zero items (Not Yet Implemented)
</pre>
<p>This is easier to read and understand than a series of isolated tests. You&#8217;re made aware of the context in which each test is being run, which is priceless when you&#8217;re attempting to understand the system from a high level.</p>
<p><strong>Congratulations.</strong> You are no longer a moron coding outside the realm of the context in which your code lives.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rabbitcreative.com/2008/05/15/rspec-meet-flow/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Since when does initialize not take arguments?</title>
		<link>http://www.rabbitcreative.com/2008/05/02/since-when-does-initialize-not-take-arguments/</link>
		<comments>http://www.rabbitcreative.com/2008/05/02/since-when-does-initialize-not-take-arguments/#comments</comments>
		<pubDate>Fri, 02 May 2008 17:45:37 +0000</pubDate>
		<dc:creator>Rabbit</dc:creator>
		
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.rabbitcreative.com/2008/05/02/since-when-does-initialize-not-take-arguments/</guid>
		<description><![CDATA[Since WHEN?!

def initialze&#40;attributes&#41;
  @attributes = attributes
  load_xml_request
end

Since you SPELLED IT WRONG! :)
]]></description>
			<content:encoded><![CDATA[<p>Since WHEN?!</p>

<div class="wp_syntax"><div class="code"><pre class="ruby"><span style="color:#9966CC; font-weight:bold;">def</span> initialze<span style="color:#006600; font-weight:bold;">&#40;</span>attributes<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#0066ff; font-weight:bold;">@attributes</span> = attributes
  load_xml_request
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Since you SPELLED IT WRONG! :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rabbitcreative.com/2008/05/02/since-when-does-initialize-not-take-arguments/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Hi? Uh, yeah, hi. I need&#8230; it&#8217;s pretty simple actually I just need the world, uh, yeah on my desk Tuesday morning. Um&#8230; Can I give you the specs tomorrow? Thanks!</title>
		<link>http://www.rabbitcreative.com/2008/04/20/i-need-the-world-by-tuesday/</link>
		<comments>http://www.rabbitcreative.com/2008/04/20/i-need-the-world-by-tuesday/#comments</comments>
		<pubDate>Sun, 20 Apr 2008 21:33:37 +0000</pubDate>
		<dc:creator>Rabbit</dc:creator>
		
		<category><![CDATA[Rant]]></category>

		<guid isPermaLink="false">http://www.rabbitcreative.com/2008/04/20/ill-this-whatever-this-is-on-your-desk-tuesday-morning/</guid>
		<description><![CDATA[
I have a very urgent asp.net project that I need done by Tuesday.
I want it to be designed using 3 tier model
1- Data Access Layer &#8216;DAL&#8217;. I want to use subsonic for that. Also stored procedures. Did you work with subsonic?
2- Business Logic Layer &#8216;BLL&#8217;
3- User interface &#8216;UI&#8217; (The UI has 5 pages)
I need very [...]]]></description>
			<content:encoded><![CDATA[<div style="margin: 10px; padding: 5px; background: #F2F2F2; border: 2px solid #CCCCCC;">
<p>I have a very urgent asp.net project that I need done by Tuesday.</p>
<p>I want it to be designed using 3 tier model</p>
<p>1- Data Access Layer &#8216;DAL&#8217;. I want to use subsonic for that. Also stored procedures. Did you work with subsonic?</p>
<p>2- Business Logic Layer &#8216;BLL&#8217;</p>
<p>3- User interface &#8216;UI&#8217; (The UI has 5 pages)</p>
<p>I need very high OO code quaity. I am a programmer myself and I will review the code.</p>
<p>Also, the database is MS SQL 2005.</p>
<p>Let me know asap if you can do it and I will forward the specs to you.</p>
<p>Thanks
</p></div>
<p>The kittens are crying.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rabbitcreative.com/2008/04/20/i-need-the-world-by-tuesday/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Walking backwards in the opposite direction.</title>
		<link>http://www.rabbitcreative.com/2008/04/06/walking-backwards-in-the-opposite-direction/</link>
		<comments>http://www.rabbitcreative.com/2008/04/06/walking-backwards-in-the-opposite-direction/#comments</comments>
		<pubDate>Mon, 07 Apr 2008 03:37:54 +0000</pubDate>
		<dc:creator>Rabbit</dc:creator>
		
		<category><![CDATA[math]]></category>

		<guid isPermaLink="false">http://www.rabbitcreative.com/2008/04/06/walking-backwards-in-the-opposite-direction/</guid>
		<description><![CDATA[Or&#8230; -2 * -2 = 4
]]></description>
			<content:encoded><![CDATA[<p>Or&#8230; -2 * -2 = 4</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rabbitcreative.com/2008/04/06/walking-backwards-in-the-opposite-direction/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Infinitely iterate through an array in Ruby.</title>
		<link>http://www.rabbitcreative.com/2008/04/06/infinitely-iterate-through-an-array-in-ruby/</link>
		<comments>http://www.rabbitcreative.com/2008/04/06/infinitely-iterate-through-an-array-in-ruby/#comments</comments>
		<pubDate>Sun, 06 Apr 2008 23:12:35 +0000</pubDate>
		<dc:creator>Rabbit</dc:creator>
		
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.rabbitcreative.com/2008/04/06/infinitely-iterate-through-an-array-in-ruby/</guid>
		<description><![CDATA[
class Array
&#160;
  def roll
    loop &#123; each &#123; &#124;e&#124; yield&#40;e&#41; &#125; &#125;
  end
&#160;
end


>> a = [ 'a', 'b', 'c' ]
=> ["a", "b", "c"]
>> a.roll { &#124;e&#124; puts e; sleep 1 }
a
b
c
a
b
c
a
...

]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="ruby"><span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#CC0066; font-weight:bold;">Array</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> roll
    <span style="color:#CC0066; font-weight:bold;">loop</span> <span style="color:#006600; font-weight:bold;">&#123;</span> each <span style="color:#006600; font-weight:bold;">&#123;</span> |e| <span style="color:#9966CC; font-weight:bold;">yield</span><span style="color:#006600; font-weight:bold;">&#40;</span>e<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<pre>
>> a = [ 'a', 'b', 'c' ]
=> ["a", "b", "c"]
>> a.roll { |e| puts e; sleep 1 }
a
b
c
a
b
c
a
...
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.rabbitcreative.com/2008/04/06/infinitely-iterate-through-an-array-in-ruby/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
