<?xml version="1.0" encoding="utf-8"?>
<feed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom">
  <title>Steven Rockarts</title>
  <link rel="alternate" type="text/html" href="http://www.stevenrockarts.com/Blog/" />
  <link rel="self" href="http://www.stevenrockarts.com/Blog/SyndicationService.asmx/GetAtom" />
  <icon>favicon.ico</icon>
  <updated>2008-05-12T09:43:28.794-07:00</updated>
  <author>
    <name>Steven Rockarts</name>
  </author>
  <subtitle>Edmonton Software Developer</subtitle>
  <id>http://www.stevenrockarts.com/Blog/</id>
  <generator uri="http://www.dasblog.net" version="2.0.7180.0">DasBlog</generator>
  <entry>
    <title>Edmonton Computer Book Club</title>
    <link rel="alternate" type="text/html" href="http://www.stevenrockarts.com/Blog/2008/05/12/EdmontonComputerBookClub.aspx" />
    <id>http://www.stevenrockarts.com/Blog/PermaLink,guid,17f463f5-c818-443d-ad1e-8a6463bb8490.aspx</id>
    <published>2008-05-12T09:43:28.794-07:00</published>
    <updated>2008-05-12T09:43:28.794-07:00</updated>
    <category term="Programming" label="Programming" scheme="http://www.stevenrockarts.com/Blog/CategoryView,category,Programming.aspx" />
    <category term="Technical" label="Technical" scheme="http://www.stevenrockarts.com/Blog/CategoryView,category,Technical.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
A couple years ago a was in a computer book club located in Philadelphia and participated
remotely. The experience was great by unfortunately the group lost funding from Microsoft
and disbanded.
</p>
        <p>
After gauging a little bit of interest around town I have decided to try and start
one here in Edmonton with the possibility of people being able to participate remotely. 
</p>
        <p>
If you are interested in participating, please join the discussion at the <a href="http://groups.google.com/group/edmonton-computer-book-club">Google
group mailing list</a>. 
</p>
        <img width="0" height="0" src="http://www.stevenrockarts.com/Blog/aggbug.ashx?id=17f463f5-c818-443d-ad1e-8a6463bb8490" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Happily Married</title>
    <link rel="alternate" type="text/html" href="http://www.stevenrockarts.com/Blog/2008/05/11/HappilyMarried.aspx" />
    <id>http://www.stevenrockarts.com/Blog/PermaLink,guid,8faf0458-c248-4cfa-b3de-cf2caaeb3485.aspx</id>
    <published>2008-05-10T21:18:22.82525-07:00</published>
    <updated>2008-05-10T21:18:22.82525-07:00</updated>
    <category term="Fun" label="Fun" scheme="http://www.stevenrockarts.com/Blog/CategoryView,category,Fun.aspx" />
    <category term="Personal" label="Personal" scheme="http://www.stevenrockarts.com/Blog/CategoryView,category,Personal.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">This blog has been really quiet as of late,
as you probably noticed by the lack of updates in your favorite RSS reader. The reason
is because I got married this past weekend and have not had time to update over the
past month. I will make up for it next month but for now I am going to go and enjoy
my honeymoon. 
<br /><p><a href="http://www.flickr.com/photos/stevenrockarts/2472333105/" title="IMG_1524.JPG by stevenrockarts, on Flickr"><img src="http://farm3.static.flickr.com/2155/2472333105_b9718c0019.jpg" alt="IMG_1524.JPG" height="333" width="500" /></a></p><hints id="hah_hints"></hints><img width="0" height="0" src="http://www.stevenrockarts.com/Blog/aggbug.ashx?id=8faf0458-c248-4cfa-b3de-cf2caaeb3485" /></div>
    </content>
  </entry>
  <entry>
    <title>3 Geeks in an Elevator</title>
    <link rel="alternate" type="text/html" href="http://www.stevenrockarts.com/Blog/2008/04/19/3GeeksInAnElevator.aspx" />
    <id>http://www.stevenrockarts.com/Blog/PermaLink,guid,aebf69c2-4d95-4ddd-903f-303bb86d7892.aspx</id>
    <published>2008-04-18T22:16:39.7937434-07:00</published>
    <updated>2008-04-18T22:16:39.7937434-07:00</updated>
    <category term="Programming" label="Programming" scheme="http://www.stevenrockarts.com/Blog/CategoryView,category,Programming.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">I've been in a bit of a blogging slump.
I blame taxes, NHL playoffs and an upcoming wedding for the slump. <a href="http://weblogs.asp.net/bsimser/default.aspx">Bil</a> recently <a href="http://weblogs.asp.net/bsimser/archive/2008/04/16/3-geeks-in-an-elevator.aspx">posted
a meme</a> about being trapped in an elevator with 2 other geeks. The jist of it is
if you were trapped in an elevator with 2 other geeks, who would you be trapped with
and why.*<br /><br />
I would choose to be trapped with:<br /><br /><ul><li>
 <a href="http://weblog.raganwald.com/">Reginald Braithwaite</a> because I like
reading his essays and I believe I could have a meaningful conversation about various
software development topics with him.</li><li><a href="http://www-formal.stanford.edu/jmc/">John McCarthy</a> I would like to talk
programming languages and AI with him. 
<br /></li></ul><br /><br />
* I've actually been trapped in an elevator before for 2 hours with a friend and it
sucks big time. I try and take the stairs now.<br /><p></p><hints id="hah_hints"></hints><img width="0" height="0" src="http://www.stevenrockarts.com/Blog/aggbug.ashx?id=aebf69c2-4d95-4ddd-903f-303bb86d7892" /></div>
    </content>
  </entry>
  <entry>
    <title>A Reason To Switch to Rails</title>
    <link rel="alternate" type="text/html" href="http://www.stevenrockarts.com/Blog/2008/04/01/AReasonToSwitchToRails.aspx" />
    <id>http://www.stevenrockarts.com/Blog/PermaLink,guid,159952f7-90c1-4a0e-b7f3-786eee69415f.aspx</id>
    <published>2008-04-01T14:11:50.92-07:00</published>
    <updated>2008-04-01T14:11:50.92-07:00</updated>
    <category term="Fun" label="Fun" scheme="http://www.stevenrockarts.com/Blog/CategoryView,category,Fun.aspx" />
    <category term="Programming" label="Programming" scheme="http://www.stevenrockarts.com/Blog/CategoryView,category,Programming.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Via <a href="http://macournoyer.wordpress.com/">Marc-Andre Cournoyer</a> on Twitter,
a reason for ASP.NET developers to switch to Rails: <a href="http://www.railsjedi.com/posts/15-Acts-as-ASP-NET-a-Ruby-on-Rails-Plugin">http://www.railsjedi.com/posts/15-Acts-as-ASP-NET-a-Ruby-on-Rails-Plugin</a>- 
</p>
        <p>
Sadly, I bet I could sell Ruby and Rails to local businesses easier by showing them
this page. 
</p>
        <p>
P.S. I am the altnet purse fight blog author. No one ever suspects the quiet guy.
</p>
        <img width="0" height="0" src="http://www.stevenrockarts.com/Blog/aggbug.ashx?id=159952f7-90c1-4a0e-b7f3-786eee69415f" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Problems Installing Visual Studio 2008?</title>
    <link rel="alternate" type="text/html" href="http://www.stevenrockarts.com/Blog/2008/03/28/ProblemsInstallingVisualStudio2008.aspx" />
    <id>http://www.stevenrockarts.com/Blog/PermaLink,guid,3dbe951b-4760-427e-a3c5-2a2cdc9179dc.aspx</id>
    <published>2008-03-28T10:25:21.9145331-07:00</published>
    <updated>2008-03-28T10:25:21.9145331-07:00</updated>
    <category term="Programming" label="Programming" scheme="http://www.stevenrockarts.com/Blog/CategoryView,category,Programming.aspx" />
    <category term="Technical" label="Technical" scheme="http://www.stevenrockarts.com/Blog/CategoryView,category,Technical.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">Last night I tried installing Visual Studio
2008 and the .NET 3.5 Framework. I kept getting the error: "Error: Installation failed
for component Microsoft .NET Framework 3.0a. MSI returned error code 1603".<br /><br />
Not very informative. I eventually ended up getting it installed by temporarily uninstalling
IIS. Hope this helps someone else out who is having the same problem.<br /><p></p><hints id="hah_hints"></hints><img width="0" height="0" src="http://www.stevenrockarts.com/Blog/aggbug.ashx?id=3dbe951b-4760-427e-a3c5-2a2cdc9179dc" /></div>
    </content>
  </entry>
  <entry>
    <title>Boo OSX</title>
    <link rel="alternate" type="text/html" href="http://www.stevenrockarts.com/Blog/2008/03/05/BooOSX.aspx" />
    <id>http://www.stevenrockarts.com/Blog/PermaLink,guid,c81b4d03-432d-4a37-8f05-def8dc9bd0ec.aspx</id>
    <published>2008-03-04T21:51:55.186-08:00</published>
    <updated>2008-03-04T21:52:36.13975-08:00</updated>
    <category term="Programming" label="Programming" scheme="http://www.stevenrockarts.com/Blog/CategoryView,category,Programming.aspx" />
    <category term="Technical" label="Technical" scheme="http://www.stevenrockarts.com/Blog/CategoryView,category,Technical.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Sweetness!
</p>
        <p>
          <a href="http://www.flickr.com/photos/stevenrockarts/2311214643/" title="booishMac.png by stevenrockarts, on Flickr">
            <img src="http://farm4.static.flickr.com/3257/2311214643_36a86fd147_o.png" alt="booishMac.png" border="0" height="413" width="586" />
          </a>
        </p>
        <p>
          <br />
        </p>
        <hints id="hah_hints">
        </hints>
        <img width="0" height="0" src="http://www.stevenrockarts.com/Blog/aggbug.ashx?id=c81b4d03-432d-4a37-8f05-def8dc9bd0ec" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Quick and Dirty Test Data Builders With Rhino Mocks</title>
    <link rel="alternate" type="text/html" href="http://www.stevenrockarts.com/Blog/2008/02/08/QuickAndDirtyTestDataBuildersWithRhinoMocks.aspx" />
    <id>http://www.stevenrockarts.com/Blog/PermaLink,guid,72e0d847-1756-4f4b-9bcc-449ed6c3cdff.aspx</id>
    <published>2008-02-07T22:56:17.703125-08:00</published>
    <updated>2008-02-07T22:56:17.703125-08:00</updated>
    <category term="Programming" label="Programming" scheme="http://www.stevenrockarts.com/Blog/CategoryView,category,Programming.aspx" />
    <category term="Technical" label="Technical" scheme="http://www.stevenrockarts.com/Blog/CategoryView,category,Technical.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Today I was creating a test data builder for a unit test. I am fairly new to test
data builders, on the last project I was on I relied on the ObjectMother pattern which
became fairly tedious over time. Both the <a href="http://martinfowler.com/bliki/ObjectMother.html">ObjectMother</a> pattern
and the <a href="http://nat.truemesh.com/archives/000714.html">Test Data Builder</a> are <a href="http://xunitpatterns.com/Test%20Helper.html">Test
Helper patterns</a>: 
</p>
        <p>
          <em>"We define a helper class to hold any Test Utility Methods we want to reuse in
several tests."</em> 
</p>
        <p>
If your objects aren't immutable and all you really care about is getting sensible
test data without having to repeat yourself, you can use the Rhino Mocks GenerateStub
feature to provide sensible test data and deal with invariant test data:
</p>
        <p>
 
</p>
        <p>
          <!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red239\green239\blue228;\red128\green0\blue0;\red0\green0\blue150;\red0\green128\blue192;}??\fs20 \cb2\highlight2 [\cf3 {\b TestFixture}\cf0 ]\par ??\cf4 {\b public}\cf0  \cf4 {\b class}\cf0  \cf3 {\b InvoiceTests}\par ??\cf0 \{\par ??    [\cf5 Test\cf0 ]\par ??    \cf4 {\b public}\cf0  \cf4 {\b void}\cf0  \cf5 ShouldCreateInvoiceWithNoPostalCode\cf0 ()\par ??    \{\par ??        \cf3 {\b Invoice}\cf0  \cf5 invoiceWithNoPostalCode\cf0  \cf4 {\b =}\cf0  \par ??                \cf4 {\b new}\cf0  \cf3 {\b InvoiceBuilder}\cf0 ()\par ??                \cf4 {\b .}\cf5 WithRecipient\cf0 (\cf4 {\b new}\cf0  \cf3 {\b RecipientBuilder}\cf0 ()\par ??                    \cf4 {\b .}\cf5 WithAddress\cf0 (\cf4 {\b new}\cf0  \cf3 {\b AddressBuilder}\cf0 ()\par ??                        \cf4 {\b .}\cf5 WithNoPostalCode\cf0 ()\par ??                        \cf4 {\b .}\cf5 Build\cf0 ())\par ??                    \cf4 {\b .}\cf5 Build\cf0 ())\par ??                \cf4 {\b .}\cf5 Build\cf0 ();\par ??\par ??        \cf3 {\b Assert}\cf4 {\b .}\cf5 AreEqual\cf0 (\cf4 {\b string.}\cf5 Empty\cf0 , \par ??            \cf5 invoiceWithNoPostalCode\cf4 {\b .}\cf5 Recipient\cf4 {\b .}\cf5 Address\cf4 {\b .}\cf5 PostalCode\cf0 );\par ??    \}\par ??\par ??    \par ??\}\par ??\par ??\cf4 {\b public}\cf0  \cf4 {\b class}\cf0  \cf3 {\b InvoiceBuilder}\par ??\cf0 \{\par ??    \cf4 {\b private}\cf0  \cf3 {\b Invoice}\cf0  \cf5 invoice\cf0 ;\par ??\par ??    \cf4 {\b public}\cf0  \cf5 InvoiceBuilder\cf0 ()\par ??    \{\par ??        \cf5 invoice\cf0  \cf4 {\b =}\cf0  \cf3 {\b MockRepository}\cf4 {\b .}\cf5 GenerateStub\cf4 {\b &lt;}\cf3 {\b Invoice}\cf4 {\b &gt;}\cf0 ();\par ??    \}\par ??\par ??    \cf4 {\b public}\cf0  \cf3 {\b InvoiceBuilder}\cf0  \cf5 WithRecipient\cf0 (\cf3 {\b Recipient}\cf0  \cf5 recipient\cf0 )\par ??    \{\par ??        \cf5 invoice\cf4 {\b .}\cf5 Recipient\cf0  \cf4 {\b =}\cf0  \cf5 recipient\cf0 ;\par ??        \cf4 {\b return}\cf0  \cf4 {\b this}\cf0 ;\par ??    \}\par ??\par ??    \cf4 {\b public}\cf0  \cf3 {\b Invoice}\cf0  \cf5 Build\cf0 ()\par ??    \{\par ??        \cf4 {\b return}\cf0  \cf5 invoice\cf0 ;\par ??    \}\par ??\}\par ??\par ??\cf4 {\b public}\cf0  \cf4 {\b class}\cf0  \cf3 {\b RecipientBuilder}\par ??\cf0 \{\par ??    \cf4 {\b private}\cf0  \cf3 {\b Recipient}\cf0  \cf5 recipient\cf0 ;\par ??\par ??    \cf4 {\b public}\cf0  \cf5 RecipientBuilder\cf0 ()\par ??    \{\par ??        \cf5 recipient\cf0  \cf4 {\b =}\cf0  \cf3 {\b MockRepository}\cf4 {\b .}\cf5 GenerateStub\cf4 {\b &lt;}\cf3 {\b Recipient}\cf4 {\b &gt;}\cf0 ();\par ??    \}\par ??\par ??    \cf4 {\b public}\cf0  \cf3 {\b RecipientBuilder}\cf0  \cf5 WithAddress\cf0 (\cf3 {\b Address}\cf0  \cf5 address\cf0 )\par ??    \{\par ??        \cf5 recipient\cf4 {\b .}\cf5 Address\cf0  \cf4 {\b =}\cf0  \cf5 address\cf0 ;\par ??        \cf4 {\b return}\cf0  \cf4 {\b this}\cf0 ;\par ??    \}\par ??\par ??    \cf4 {\b public}\cf0  \cf3 {\b Recipient}\cf0  \cf5 Build\cf0 ()\par ??    \{\par ??        \cf4 {\b return}\cf0  \cf5 recipient\cf0 ;\par ??    \}\par ??\}\par ??\par ??\cf4 {\b public}\cf0  \cf4 {\b class}\cf0  \cf3 {\b AddressBuilder}\par ??\cf0 \{\par ??    \cf4 {\b private}\cf0  \cf3 {\b Address}\cf0  \cf5 address\cf0 ;\par ??\par ??    \cf4 {\b public}\cf0  \cf5 AddressBuilder\cf0 ()\par ??    \{\par ??        \cf5 address\cf0  \cf4 {\b =}\cf0  \cf3 {\b MockRepository}\cf4 {\b .}\cf5 GenerateStub\cf4 {\b &lt;}\cf3 {\b Address}\cf4 {\b &gt;}\cf0 ();\par ??    \}\par ??\par ??    \cf4 {\b public}\cf0  \cf3 {\b AddressBuilder}\cf0  \cf5 WithNoPostalCode\cf0 ()\par ??    \{\par ??        \cf5 address\cf4 {\b .}\cf5 PostalCode\cf0  \cf4 {\b =}\cf0  \cf4 {\b string.}\cf5 Empty\cf0 ;\par ??        \cf4 {\b return}\cf0  \cf4 {\b this}\cf0 ;\par ??    \}\par ??\par ??    \cf4 {\b public}\cf0  \cf3 {\b Address}\cf0  \cf5 Build\cf0 ()\par ??    \{\par ??        \cf4 {\b return}\cf0  \cf5 address\cf0 ;\par ??    \}\par ??\}}
-->
        </p>
        <div style="border-right: rgb(221,221,221) 1px dotted; padding-right: 4px; border-top: rgb(221,221,221) 1px dotted; padding-left: 4px; font-size: small; background: rgb(255,255,255); padding-bottom: 4px; margin: 4px; border-left: rgb(221,221,221) 1px dotted; color: rgb(0,0,0); padding-top: 4px; border-bottom: rgb(221,221,221) 1px dotted; font-family: consolas,'Courier New',courier,monospace">[<span style="font-weight: bold; color: maroon">TestFixture</span>]<br /><span style="font-weight: bold; color: #000096">public</span> <span style="font-weight: bold; color: #000096">class</span> <span style="font-weight: bold; color: maroon">InvoiceTests</span><br />
{<br />
    [<span style="color: #0080c0">Test</span>]<br />
    <span style="font-weight: bold; color: #000096">public</span> <span style="font-weight: bold; color: #000096">void</span> <span style="color: #0080c0">ShouldCreateInvoiceWithNoPostalCode</span>()<br />
    {<br />
        <span style="font-weight: bold; color: maroon">Invoice</span> <span style="color: #0080c0">invoiceWithNoPostalCode</span> <span style="font-weight: bold; color: #000096">=</span><br />
                <span style="font-weight: bold; color: #000096">new</span> <span style="font-weight: bold; color: maroon">InvoiceBuilder</span>()<br />
                <span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">WithRecipient</span>(<span style="font-weight: bold; color: #000096">new</span> <span style="font-weight: bold; color: maroon">RecipientBuilder</span>()<br />
                    <span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">WithAddress</span>(<span style="font-weight: bold; color: #000096">new</span> <span style="font-weight: bold; color: maroon">AddressBuilder</span>()<br />
                   
    <span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">WithNoPostalCode</span>()<br />
                   
    <span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">Build</span>())<br />
                    <span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">Build</span>())<br />
                <span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">Build</span>();<br />
 <br />
        <span style="font-weight: bold; color: maroon">Assert</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">AreEqual</span>(<span style="font-weight: bold; color: #000096">string.</span><span style="color: #0080c0">Empty</span>, 
<br />
            <span style="color: #0080c0">invoiceWithNoPostalCode</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">Recipient</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">Address</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">PostalCode</span>);<br />
    }<br />
 <br />
 <br />
}<br />
 <br /><span style="font-weight: bold; color: #000096">public</span> <span style="font-weight: bold; color: #000096">class</span> <span style="font-weight: bold; color: maroon">InvoiceBuilder</span><br />
{<br />
    <span style="font-weight: bold; color: #000096">private</span> <span style="font-weight: bold; color: maroon">Invoice</span> <span style="color: #0080c0">invoice</span>;<br />
 <br />
    <span style="font-weight: bold; color: #000096">public</span> <span style="color: #0080c0">InvoiceBuilder</span>()<br />
    {<br />
        <span style="color: #0080c0">invoice</span> <span style="font-weight: bold; color: #000096">=</span> <span style="font-weight: bold; color: maroon">MockRepository</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">GenerateStub</span><span style="font-weight: bold; color: #000096">&lt;</span><span style="font-weight: bold; color: maroon">Invoice</span><span style="font-weight: bold; color: #000096">&gt;</span>();<br />
    }<br />
 <br />
    <span style="font-weight: bold; color: #000096">public</span> <span style="font-weight: bold; color: maroon">InvoiceBuilder</span> <span style="color: #0080c0">WithRecipient</span>(<span style="font-weight: bold; color: maroon">Recipient</span> <span style="color: #0080c0">recipient</span>)<br />
    {<br />
        <span style="color: #0080c0">invoice</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">Recipient</span> <span style="font-weight: bold; color: #000096">=</span> <span style="color: #0080c0">recipient</span>;<br />
        <span style="font-weight: bold; color: #000096">return</span> <span style="font-weight: bold; color: #000096">this</span>;<br />
    }<br />
 <br />
    <span style="font-weight: bold; color: #000096">public</span> <span style="font-weight: bold; color: maroon">Invoice</span> <span style="color: #0080c0">Build</span>()<br />
    {<br />
        <span style="font-weight: bold; color: #000096">return</span> <span style="color: #0080c0">invoice</span>;<br />
    }<br />
}<br />
 <br /><span style="font-weight: bold; color: #000096">public</span> <span style="font-weight: bold; color: #000096">class</span> <span style="font-weight: bold; color: maroon">RecipientBuilder</span><br />
{<br />
    <span style="font-weight: bold; color: #000096">private</span> <span style="font-weight: bold; color: maroon">Recipient</span> <span style="color: #0080c0">recipient</span>;<br />
 <br />
    <span style="font-weight: bold; color: #000096">public</span> <span style="color: #0080c0">RecipientBuilder</span>()<br />
    {<br />
        <span style="color: #0080c0">recipient</span> <span style="font-weight: bold; color: #000096">=</span> <span style="font-weight: bold; color: maroon">MockRepository</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">GenerateStub</span><span style="font-weight: bold; color: #000096">&lt;</span><span style="font-weight: bold; color: maroon">Recipient</span><span style="font-weight: bold; color: #000096">&gt;</span>();<br />
    }<br />
 <br />
    <span style="font-weight: bold; color: #000096">public</span> <span style="font-weight: bold; color: maroon">RecipientBuilder</span> <span style="color: #0080c0">WithAddress</span>(<span style="font-weight: bold; color: maroon">Address</span> <span style="color: #0080c0">address</span>)<br />
    {<br />
        <span style="color: #0080c0">recipient</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">Address</span> <span style="font-weight: bold; color: #000096">=</span> <span style="color: #0080c0">address</span>;<br />
        <span style="font-weight: bold; color: #000096">return</span> <span style="font-weight: bold; color: #000096">this</span>;<br />
    }<br />
 <br />
    <span style="font-weight: bold; color: #000096">public</span> <span style="font-weight: bold; color: maroon">Recipient</span> <span style="color: #0080c0">Build</span>()<br />
    {<br />
        <span style="font-weight: bold; color: #000096">return</span> <span style="color: #0080c0">recipient</span>;<br />
    }<br />
}<br />
 <br /><span style="font-weight: bold; color: #000096">public</span> <span style="font-weight: bold; color: #000096">class</span> <span style="font-weight: bold; color: maroon">AddressBuilder</span><br />
{<br />
    <span style="font-weight: bold; color: #000096">private</span> <span style="font-weight: bold; color: maroon">Address</span> <span style="color: #0080c0">address</span>;<br />
 <br />
    <span style="font-weight: bold; color: #000096">public</span> <span style="color: #0080c0">AddressBuilder</span>()<br />
    {<br />
        <span style="color: #0080c0">address</span> <span style="font-weight: bold; color: #000096">=</span> <span style="font-weight: bold; color: maroon">MockRepository</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">GenerateStub</span><span style="font-weight: bold; color: #000096">&lt;</span><span style="font-weight: bold; color: maroon">Address</span><span style="font-weight: bold; color: #000096">&gt;</span>();<br />
    }<br />
 <br />
    <span style="font-weight: bold; color: #000096">public</span> <span style="font-weight: bold; color: maroon">AddressBuilder</span> <span style="color: #0080c0">WithNoPostalCode</span>()<br />
    {<br />
        <span style="color: #0080c0">address</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">PostalCode</span> <span style="font-weight: bold; color: #000096">=</span> <span style="font-weight: bold; color: #000096">string.</span><span style="color: #0080c0">Empty</span>;<br />
        <span style="font-weight: bold; color: #000096">return</span> <span style="font-weight: bold; color: #000096">this</span>;<br />
    }<br />
 <br />
    <span style="font-weight: bold; color: #000096">public</span> <span style="font-weight: bold; color: maroon">Address</span> <span style="color: #0080c0">Build</span>()<br />
    {<br />
        <span style="font-weight: bold; color: #000096">return</span> <span style="color: #0080c0">address</span>;<br />
    }<br />
}<br /></div>
        <p>
        </p>
        <p>
Once again be warned that this does not work for immutable objects, I don't recommend
making value objects mutable just to implement this pattern so i'm not sure if it
actually provides any real value. Maybe if it is combined with a mutable entity and
a custom builder for a value object that preserves that value object's immutability. 
</p>
        <p>
If anyone that reads this blog has a way to make Test Data Builders easier I would
be glad to hear it.
</p>
        <p>
 
</p>
        <p>
[Currently Listening To: Young Galaxy- Young Galaxy - Wailing Wall]
</p>
        <img width="0" height="0" src="http://www.stevenrockarts.com/Blog/aggbug.ashx?id=72e0d847-1756-4f4b-9bcc-449ed6c3cdff" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Donald Belcham Birthday Tribute</title>
    <link rel="alternate" type="text/html" href="http://www.stevenrockarts.com/Blog/2008/02/05/DonaldBelchamBirthdayTribute.aspx" />
    <id>http://www.stevenrockarts.com/Blog/PermaLink,guid,e8b43129-2b09-4719-947b-1d2111e7c41f.aspx</id>
    <published>2008-02-05T12:20:52.92525-08:00</published>
    <updated>2008-02-05T12:20:52.92525-08:00</updated>
    <category term="Personal" label="Personal" scheme="http://www.stevenrockarts.com/Blog/CategoryView,category,Personal.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Justice <a href="http://graysmatter.codivation.com/HappyBirthdayDonaldBelcham.aspx">asked
a bunch of us to write a treasured memory</a> that we have of Donald Belcham as a
birthday tribute to Don. I am in a bit of a blogging slump so I figured I would oblige
his request.
</p>
        <p>
My memory is from DevTeach Vancouver last year. It all started at the Party with Palermo.
Donald started the night off having a great conversation with a bunch of us about
the merits of TDD and how it relates to life, the universe and everything.
</p>
        <p>
Then someone told him that the booze was free.
</p>
        <p>
Donald proceeded to order the finest scotch available in the bar. For those that don't
know him Scotch to Donald is like Beer to <a href="http://en.wikipedia.org/wiki/Bender_%28Futurama%29">Bender</a>.
Donald was ok but then <a href="http://codebetter.com/blogs/jeffrey.palermo/default.aspx">Jeffery
Palermo</a> announced that booze would only be free for the next 5 minutes.
</p>
        <p>
I was standing at the bar when the announcement was made and I heard Donald yell "LETS
DO SHOTS!!!". Luckily Donald kept it classy and suggested that everyone do Prairie
Fires (tequila and Tabasco). Knowing the dangers that Prairie Fires can bring, I tried
to convince Donald that he should do something less harsh like Whiskey. 
</p>
        <p>
After 10 Prairie Fires everyone was amazed that Donald had proceeded to keep them
down and we went for more drinks at The Earls on Robson Street. After 10 minutes I
look over at down who is slumped over and hiccupping. 10 more minutes pass and Donald's
cheeks are full with a finger holding in the gray liquid that eventually shot out
into <a href="http://geekswithblogs.net/dlussier/Default.aspx">D'Arcy Lussier's</a> hot
chocolate (that whole sentence just sounded wrong).
</p>
        <p>
          <a title="DSCF1702 by stevenrockarts, on Flickr" href="http://www.flickr.com/photos/stevenrockarts/558755731/">
            <img height="180" alt="DSCF1702" src="http://farm2.static.flickr.com/1135/558755731_3a6783448d_m.jpg" width="240" />
          </a>
        </p>
        <p>
The next day Donald was scheduled to present and he lays out a great metaphor which
to me, is pure Donald Belcham:
</p>
        <p>
"A development shop without Cruise Control and NAnt is like having too many prairie
fires here at DevTeach. Everything looks ok on the outside but sooner or later things
are going to blow up."
</p>
        <p>
PHENOMINAL!
</p>
        <p>
If this blows your mind, make sure to check out Donald at this year's DevTeach Toronto.
He will be presenting not one, count em 4 different presentations all likely to be
fuelled by prairie fires and scotch.
</p>
        <img width="0" height="0" src="http://www.stevenrockarts.com/Blog/aggbug.ashx?id=e8b43129-2b09-4719-947b-1d2111e7c41f" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Personal Look Back at 2007</title>
    <link rel="alternate" type="text/html" href="http://www.stevenrockarts.com/Blog/2008/01/08/PersonalLookBackAt2007.aspx" />
    <id>http://www.stevenrockarts.com/Blog/PermaLink,guid,d1e543dc-10c0-4f85-ab82-e74e0dec9806.aspx</id>
    <published>2008-01-08T07:31:19.672-08:00</published>
    <updated>2008-01-08T07:31:19.672-08:00</updated>
    <category term="Personal" label="Personal" scheme="http://www.stevenrockarts.com/Blog/CategoryView,category,Personal.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I like reading other people's posts on the year that was 2007 so I thought I would
try it myself. 
</p>
        <p>
          <u>During 2007 I had a lot of fun in software development</u>
        </p>
        <p>
- I managed to somehow do 3 speaking engagments, 2 at the Calgary and Edmonton Code
Camps and one at DevTeach. Although I had fun presenting, i'm not sure if the spotlight
is for me. Helping the community has always been one of my main goals but I got into
software development because I like coding. I could care less if I get my way paid
to various conferences based on my speaking ability I would rather be recognized for
my coding ability.
</p>
        <p>
- I completed all of my goals that I had for <a href="http://www.stevenrockarts.com/blog/PermaLink,guid,943ea1d8-655d-4d14-8692-1cc1ff135500.aspx">becoming
a better developer</a>. This surprised me as I thought I was way behind on them. 
</p>
        <p>
- I contributed to a couple OSS projects. In 2008 my main goal will be to give away
even more code. Take it, its yours. 
</p>
        <p>
- I found something new that I am going to use to motivate myself to get my skills another
level, I'll probably write about it sometime in the future but now is to soon.
</p>
        <p>
 
</p>
        <p>
          <u>Non-Technical Stuff</u>
        </p>
        <p>
- Last year started out very poorly for me. I lost my last remaining Grandfather a
year ago today, he was my hero and things haven't been the same without him.
</p>
        <p>
- I was finally able to move into a new condo that I bought with my fiance. No more
paying rent for me. Despite having a flood and still waiting on our floor to be replaced
I am happy with the new place. 
</p>
        <p>
- I got to help my fiance Catherine celebrate a special birthday this year. 
</p>
        <p>
- My dog somehow got published in a book and featured on Entertainment Tonight (blog
post dog mention quota met).
</p>
        <p>
          <u>Whats in store for 2008</u>
        </p>
        <p>
- I am getting married in May of 2008. At least if we can get organized in time.
</p>
        <p>
- More OSS coding than last year.
</p>
        <p>
- Many more things that I have yet to find out about.
</p>
        <img width="0" height="0" src="http://www.stevenrockarts.com/Blog/aggbug.ashx?id=d1e543dc-10c0-4f85-ab82-e74e0dec9806" />
      </div>
    </content>
  </entry>
  <entry>
    <title>DevTeach Resources</title>
    <link rel="alternate" type="text/html" href="http://www.stevenrockarts.com/Blog/2007/12/01/DevTeachResources.aspx" />
    <id>http://www.stevenrockarts.com/Blog/PermaLink,guid,f6668471-6bd6-4abb-bcf5-a8d1af24566d.aspx</id>
    <published>2007-11-30T21:12:27.633-08:00</published>
    <updated>2007-11-30T21:12:27.633-08:00</updated>
    <category term="Programming" label="Programming" scheme="http://www.stevenrockarts.com/Blog/CategoryView,category,Programming.aspx" />
    <category term="Technical" label="Technical" scheme="http://www.stevenrockarts.com/Blog/CategoryView,category,Technical.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
For everyone that was at my DevTeach presentation thank you for showing up and listening
to me. I had my adrenaline flowing and ended up finishing a little to early, if only
I could code like that day to day!
</p>
        <p>
If you have svn installed, you can download my presentation from the command line
with the following command:
</p>
        <p>
          <tt>svn checkout <b><i>http</i></b>://stevenrockartspresentations.googlecode.com/svn/trunk/
devteachgenericspresentation</tt>
        </p>
        <p>
I still have to do one more check-in to add my reduce implementation and to clean
up the code. I am also going to upload a zipped version of the code to the downloads
section located here: <a title="http://code.google.com/p/stevenrockartspresentations/downloads/list" href="http://code.google.com/p/stevenrockartspresentations/downloads/list">http://code.google.com/p/stevenrockartspresentations/downloads/list</a></p>
        <p>
 
</p>
        <p>
Here is a list of resources from the presentation:
</p>
        <p>
- <a href="http://www.stevenrockarts.com/blog/PermaLink,guid,299cf8b7-1e21-4171-b3bf-7b9e3493a2f7.aspx">Combining
Generics, Specifications and Functional Programming Part 1</a></p>
        <p>
- <a href="http://www.stevenrockarts.com/blog/PermaLink,guid,bd821e5f-36aa-4ed6-bd54-101b797da574.aspx">Combining
Generics, Specifications and Functional Programming Part 2</a></p>
        <p>
- <a href="http://www.stevenrockarts.com/blog/PermaLink,guid,44f6d314-457a-4993-9e15-f4713424d5f0.aspx">Combining
Generics, Specifications and Functional Programming Part 3</a></p>
        <p>
- <a href="http://www.stevenrockarts.com/blog/PermaLink,guid,4bd20641-8c9e-4342-b843-3a9f16afa3ec.aspx">Combining
Generics, Specifications and Functional Programming Part 4</a></p>
        <p>
- <a href="http://www.stevenrockarts.com/blog/PermaLink,guid,021e73b1-c715-40a7-9bc9-88d77dc81f42.aspx">Follow
up to Generics Presentation Feedback</a></p>
        <p>
- <a href="http://www.stevenrockarts.com/blog/PermaLink,guid,1432a5c7-93f2-4722-9cbc-b960a92024ab.aspx">Reduce
in C#</a></p>
        <img width="0" height="0" src="http://www.stevenrockarts.com/Blog/aggbug.ashx?id=f6668471-6bd6-4abb-bcf5-a8d1af24566d" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Follow Up to Generics Presentation Feedback</title>
    <link rel="alternate" type="text/html" href="http://www.stevenrockarts.com/Blog/2007/12/01/FollowUpToGenericsPresentationFeedback.aspx" />
    <id>http://www.stevenrockarts.com/Blog/PermaLink,guid,021e73b1-c715-40a7-9bc9-88d77dc81f42.aspx</id>
    <published>2007-11-30T19:39:40.586125-08:00</published>
    <updated>2007-11-30T19:39:40.586125-08:00</updated>
    <category term="Programming" label="Programming" scheme="http://www.stevenrockarts.com/Blog/CategoryView,category,Programming.aspx" />
    <category term="Technical" label="Technical" scheme="http://www.stevenrockarts.com/Blog/CategoryView,category,Technical.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I got a couple of emails with great feedback from my <a href="http://www.stevenrockarts.com/blog/PermaLink,guid,299cf8b7-1e21-4171-b3bf-7b9e3493a2f7.aspx">last</a><a href="http://www.stevenrockarts.com/blog/PermaLink,guid,bd821e5f-36aa-4ed6-bd54-101b797da574.aspx">couple</a><a href="http://www.stevenrockarts.com/blog/PermaLink,guid,44f6d314-457a-4993-9e15-f4713424d5f0.aspx">of</a><a href="http://www.stevenrockarts.com/blog/PermaLink,guid,4bd20641-8c9e-4342-b843-3a9f16afa3ec.aspx">posts</a>.
I think I could probably turn this presentation into 2 different presentations but
it is curing my blogging writers block so i'll post the responses here for everyone's
benefit.
</p>
        <p>
          <a href="http://www.jscconsulting.ca/">Shane</a> was very quick to point out that
the method signature in Customer is kind of misleading:
</p>
        <p>
          <!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue150;\red239\green239\blue228;\red0\green0\blue0;\red0\green128\blue192;\red128\green0\blue128;\red128\green0\blue0;}??\fs20 \cf1\cb2\highlight2 {\b public}\cf0  \cf1 {\b bool}\cf0  \cf4 IsAnActiveCustomer\cf0 (\cf5 {\b ISpecification}\cf1 {\b &lt;}\cf6 {\b Customer}\cf1 {\b &gt;}\cf0  \cf4 activeCustomerSpecification\cf0 )}
-->
        </p>
        <div style="border-right: rgb(221,221,221) 1px dotted; padding-right: 4px; border-top: rgb(221,221,221) 1px dotted; padding-left: 4px; font-size: small; background: rgb(255,255,255); padding-bottom: 4px; margin: 4px; border-left: rgb(221,221,221) 1px dotted; color: rgb(0,0,0); padding-top: 4px; border-bottom: rgb(221,221,221) 1px dotted; font-family: consolas,'Courier New',courier,monospace">
          <span style="font-weight: bold; color: #000096">public</span> <span style="font-weight: bold; color: #000096">bool</span> <span style="color: #0080c0">IsAnActiveCustomer</span>(<span style="font-weight: bold; color: purple">ISpecification</span><span style="font-weight: bold; color: #000096">&lt;</span><span style="font-weight: bold; color: maroon">Customer</span><span style="font-weight: bold; color: #000096">&gt;</span> <span style="color: #0080c0">activeCustomerSpecification</span>)<br /></div>
        <p>
We could actually pass any specification that implements the ISpecification interface
into this function. We can refactor a little to make it a little more clear to someone
consuming the Customer class:
</p>
        <p>
          <!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue150;\red239\green239\blue228;\red0\green0\blue0;\red0\green128\blue192;\red128\green0\blue0;\red128\green0\blue128;}??\fs20 \cf1\cb2\highlight2 {\b public}\cf0  \cf1 {\b bool}\cf0  \cf4 IsAnActiveCustomer\cf0 ()\par ??\{\par ??    \cf1 {\b return}\cf0  \cf1 {\b this.}\cf4 Matches\cf0 (\cf1 {\b new}\cf0  \cf5 {\b ActiveCustomerSpecification}\cf0 ());\par ??\}\par ??\par ??\cf1 {\b public}\cf0  \cf1 {\b bool}\cf0  \cf4 Matches\cf0 (\cf6 {\b ISpecification}\cf1 {\b &lt;}\cf5 {\b Customer}\cf1 {\b &gt;}\cf0  \cf4 specification\cf0 )\par ??\{\par ??    \cf1 {\b return}\cf0  \cf4 specification\cf1 {\b .}\cf4 IsSatisfiedBy\cf0 (\cf1 {\b this}\cf0 );\par ??\}}
-->
        </p>
        <div style="border-right: rgb(221,221,221) 1px dotted; padding-right: 4px; border-top: rgb(221,221,221) 1px dotted; padding-left: 4px; font-size: small; background: rgb(255,255,255); padding-bottom: 4px; margin: 4px; border-left: rgb(221,221,221) 1px dotted; color: rgb(0,0,0); padding-top: 4px; border-bottom: rgb(221,221,221) 1px dotted; font-family: consolas,'Courier New',courier,monospace">
          <span style="font-weight: bold; color: #000096">public</span> <span style="font-weight: bold; color: #000096">bool</span> <span style="color: #0080c0">IsAnActiveCustomer</span>()<br />
{<br />
    <span style="font-weight: bold; color: #000096">return</span> <span style="font-weight: bold; color: #000096">this.</span><span style="color: #0080c0">Matches</span>(<span style="font-weight: bold; color: #000096">new</span> <span style="font-weight: bold; color: maroon">ActiveCustomerSpecification</span>());<br />
}<br />
 <br /><span style="font-weight: bold; color: #000096">public</span> <span style="font-weight: bold; color: #000096">bool</span> <span style="color: #0080c0">Matches</span>(<span style="font-weight: bold; color: purple">ISpecification</span><span style="font-weight: bold; color: #000096">&lt;</span><span style="font-weight: bold; color: maroon">Customer</span><span style="font-weight: bold; color: #000096">&gt;</span> <span style="color: #0080c0">specification</span>)<br />
{<br />
    <span style="font-weight: bold; color: #000096">return</span> <span style="color: #0080c0">specification</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">IsSatisfiedBy</span>(<span style="font-weight: bold; color: #000096">this</span>);<br />
}
</div>
        <p>
Using this approach we supply consumers of our class with a default for an active
customer and allow them to specify their own specification for what constitutes an
active customer.
</p>
        <p>
One thing that I should have mentioned in my post is that Filter and Map are included
in the List class in .NET 2.0. Filter == FindAll and Map==ConvertAll, here is the
code from Reflector:
</p>
        <p>
          <!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue150;\red239\green239\blue228;\red0\green0\blue0;\red0\green128\blue192;\red128\green0\blue0;\red255\green0\blue0;}??\fs20 \cf1\cb2\highlight2 {\b public}\cf0  \cf4 List\cf1 {\b &lt;}\cf4 T\cf1 {\b &gt;}\cf0  \cf4 FindAll\cf0 (\cf5 {\b Predicate}\cf1 {\b &lt;}\cf4 T\cf1 {\b &gt;}\cf0  \cf4 match\cf0 )\par ??\{\par ??    \cf1 {\b if}\cf0  (\cf4 match\cf0  \cf1 {\b ==}\cf0  \cf1 {\b null}\cf0 )\par ??    \{\par ??        \cf4 ThrowHelper\cf1 {\b .}\cf4 ThrowArgumentNullException\cf0 (\cf4 ExceptionArgument\cf1 {\b .}\cf4 match\cf0 );\par ??    \}\par ??    \cf4 List\cf1 {\b &lt;}\cf4 T\cf1 {\b &gt;}\cf0  \cf4 list\cf0  \cf1 {\b =}\cf0  \cf1 {\b new}\cf0  \cf4 List\cf1 {\b &lt;}\cf4 T\cf1 {\b &gt;}\cf0 ();\par ??    \cf1 {\b for}\cf0  (\cf1 {\b int}\cf0  \cf4 i\cf0  \cf1 {\b =}\cf0  \cf6 0\cf0 ; \cf4 i\cf0  \cf1 {\b &lt;}\cf0  \cf1 {\b this.}\cf4 _size\cf0 ; \cf4 i\cf1 {\b ++}\cf0 )\par ??    \{\par ??        \cf1 {\b if}\cf0  (\cf4 match\cf0 (\cf1 {\b this.}\cf4 _items\cf0 [\cf4 i\cf0 ]))\par ??        \{\par ??           \cf4 list\cf1 {\b .}\cf4 Add\cf0 (\cf1 {\b this.}\cf4 _items\cf0 [\cf4 i\cf0 ]);\par ??        \}\par ??    \}\par ??    \cf1 {\b return}\cf0  \cf4 list\cf0 ;\par ??\}\par ??\par ??\cf1 {\b public}\cf0  \cf4 List\cf1 {\b &lt;}\cf4 TOutput\cf1 {\b &gt;}\cf0  \cf4 ConvertAll\cf1 {\b &lt;}\cf4 TOutput\cf1 {\b &gt;}\cf0 (\cf5 {\b Converter}\cf1 {\b &lt;}\cf4 T\cf0 , \cf4 TOutput\cf1 {\b &gt;}\cf0  \cf4 converter\cf0 )\par ??\{\par ??    \cf1 {\b if}\cf0  (\cf4 converter\cf0  \cf1 {\b ==}\cf0  \cf1 {\b null}\cf0 )\par ??    \{\par ??        \cf4 ThrowHelper\cf1 {\b .}\cf4 ThrowArgumentNullException\cf0 (\cf4 ExceptionArgument\cf1 {\b .}\cf4 converter\cf0 );\par ??    \}\par ??    \cf4 List\cf1 {\b &lt;}\cf4 TOutput\cf1 {\b &gt;}\cf0  \cf4 list\cf0  \cf1 {\b =}\cf0  \cf1 {\b new}\cf0  \cf4 List\cf1 {\b &lt;}\cf4 TOutput\cf1 {\b &gt;}\cf0 (\cf1 {\b this.}\cf4 _size\cf0 );\par ??    \cf1 {\b for}\cf0  (\cf1 {\b int}\cf0  \cf4 i\cf0  \cf1 {\b =}\cf0  \cf6 0\cf0 ; \cf4 i\cf0  \cf1 {\b &lt;}\cf0  \cf1 {\b this.}\cf4 _size\cf0 ; \cf4 i\cf1 {\b ++}\cf0 )\par ??    \{\par ??        \cf4 list\cf1 {\b .}\cf4 _items\cf0 [\cf4 i\cf0 ] \cf1 {\b =}\cf0  \cf4 converter\cf0 (\cf1 {\b this.}\cf4 _items\cf0 [\cf4 i\cf0 ]);\par ??    \}\par ??    \cf4 list\cf1 {\b .}\cf4 _size\cf0  \cf1 {\b =}\cf0  \cf1 {\b this.}\cf4 _size\cf0 ;\par ??    \cf1 {\b return}\cf0  \cf4 list\cf0 ;\par ??\}}
-->
        </p>
        <div style="border-right: rgb(221,221,221) 1px dotted; padding-right: 4px; border-top: rgb(221,221,221) 1px dotted; padding-left: 4px; font-size: small; background: rgb(255,255,255); padding-bottom: 4px; margin: 4px; border-left: rgb(221,221,221) 1px dotted; color: rgb(0,0,0); padding-top: 4px; border-bottom: rgb(221,221,221) 1px dotted; font-family: consolas,'Courier New',courier,monospace">
          <span style="font-weight: bold; color: #000096">public</span> <span style="color: #0080c0">List</span><span style="font-weight: bold; color: #000096">&lt;</span><span style="color: #0080c0">T</span><span style="font-weight: bold; color: #000096">&gt;</span> <span style="color: #0080c0">FindAll</span>(<span style="font-weight: bold; color: maroon">Predicate</span><span style="font-weight: bold; color: #000096">&lt;</span><span style="color: #0080c0">T</span><span style="font-weight: bold; color: #000096">&gt;</span> <span style="color: #0080c0">match</span>)<br />
{<br />
    <span style="font-weight: bold; color: #000096">if</span> (<span style="color: #0080c0">match</span> <span style="font-weight: bold; color: #000096">==</span> <span style="font-weight: bold; color: #000096">null</span>)<br />
    {<br />
        <span style="color: #0080c0">ThrowHelper</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">ThrowArgumentNullException</span>(<span style="color: #0080c0">ExceptionArgument</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">match</span>);<br />
    }<br />
    <span style="color: #0080c0">List</span><span style="font-weight: bold; color: #000096">&lt;</span><span style="color: #0080c0">T</span><span style="font-weight: bold; color: #000096">&gt;</span> <span style="color: #0080c0">list</span> <span style="font-weight: bold; color: #000096">=</span> <span style="font-weight: bold; color: #000096">new</span> <span style="color: #0080c0">List</span><span style="font-weight: bold; color: #000096">&lt;</span><span style="color: #0080c0">T</span><span style="font-weight: bold; color: #000096">&gt;</span>();<br />
    <span style="font-weight: bold; color: #000096">for</span> (<span style="font-weight: bold; color: #000096">int</span> <span style="color: #0080c0">i</span> <span style="font-weight: bold; color: #000096">=</span> <span style="color: red">0</span>; <span style="color: #0080c0">i</span> <span style="font-weight: bold; color: #000096">&lt;</span> <span style="font-weight: bold; color: #000096">this.</span><span style="color: #0080c0">_size</span>; <span style="color: #0080c0">i</span><span style="font-weight: bold; color: #000096">++</span>)<br />
    {<br />
        <span style="font-weight: bold; color: #000096">if</span> (<span style="color: #0080c0">match</span>(<span style="font-weight: bold; color: #000096">this.</span><span style="color: #0080c0">_items</span>[<span style="color: #0080c0">i</span>]))<br />
        {<br />
           <span style="color: #0080c0">list</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">Add</span>(<span style="font-weight: bold; color: #000096">this.</span><span style="color: #0080c0">_items</span>[<span style="color: #0080c0">i</span>]);<br />
        }<br />
    }<br />
    <span style="font-weight: bold; color: #000096">return</span> <span style="color: #0080c0">list</span>;<br />
}<br />
 <br /><span style="font-weight: bold; color: #000096">public</span> <span style="color: #0080c0">List</span><span style="font-weight: bold; color: #000096">&lt;</span><span style="color: #0080c0">TOutput</span><span style="font-weight: bold; color: #000096">&gt;</span> <span style="color: #0080c0">ConvertAll</span><span style="font-weight: bold; color: #000096">&lt;</span><span style="color: #0080c0">TOutput</span><span style="font-weight: bold; color: #000096">&gt;</span>(<span style="font-weight: bold; color: maroon">Converter</span><span style="font-weight: bold; color: #000096">&lt;</span><span style="color: #0080c0">T</span>, <span style="color: #0080c0">TOutput</span><span style="font-weight: bold; color: #000096">&gt;</span> <span style="color: #0080c0">converter</span>)<br />
{<br />
    <span style="font-weight: bold; color: #000096">if</span> (<span style="color: #0080c0">converter</span> <span style="font-weight: bold; color: #000096">==</span> <span style="font-weight: bold; color: #000096">null</span>)<br />
    {<br />
        <span style="color: #0080c0">ThrowHelper</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">ThrowArgumentNullException</span>(<span style="color: #0080c0">ExceptionArgument</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">converter</span>);<br />
    }<br />
    <span style="color: #0080c0">List</span><span style="font-weight: bold; color: #000096">&lt;</span><span style="color: #0080c0">TOutput</span><span style="font-weight: bold; color: #000096">&gt;</span> <span style="color: #0080c0">list</span> <span style="font-weight: bold; color: #000096">=</span> <span style="font-weight: bold; color: #000096">new</span> <span style="color: #0080c0">List</span><span style="font-weight: bold; color: #000096">&lt;</span><span style="color: #0080c0">TOutput</span><span style="font-weight: bold; color: #000096">&gt;</span>(<span style="font-weight: bold; color: #000096">this.</span><span style="color: #0080c0">_size</span>);<br />
    <span style="font-weight: bold; color: #000096">for</span> (<span style="font-weight: bold; color: #000096">int</span> <span style="color: #0080c0">i</span> <span style="font-weight: bold; color: #000096">=</span> <span style="color: red">0</span>; <span style="color: #0080c0">i</span> <span style="font-weight: bold; color: #000096">&lt;</span> <span style="font-weight: bold; color: #000096">this.</span><span style="color: #0080c0">_size</span>; <span style="color: #0080c0">i</span><span style="font-weight: bold; color: #000096">++</span>)<br />
    {<br />
        <span style="color: #0080c0">list</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">_items</span>[<span style="color: #0080c0">i</span>] <span style="font-weight: bold; color: #000096">=</span> <span style="color: #0080c0">converter</span>(<span style="font-weight: bold; color: #000096">this.</span><span style="color: #0080c0">_items</span>[<span style="color: #0080c0">i</span>]);<br />
    }<br />
    <span style="color: #0080c0">list</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">_size</span> <span style="font-weight: bold; color: #000096">=</span> <span style="font-weight: bold; color: #000096">this.</span><span style="color: #0080c0">_size</span>;<br />
    <span style="font-weight: bold; color: #000096">return</span> <span style="color: #0080c0">list</span>;<br />
}<br /></div>
        <img width="0" height="0" src="http://www.stevenrockarts.com/Blog/aggbug.ashx?id=021e73b1-c715-40a7-9bc9-88d77dc81f42" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Reduce in C#</title>
    <link rel="alternate" type="text/html" href="http://www.stevenrockarts.com/Blog/2007/12/01/ReduceInC.aspx" />
    <id>http://www.stevenrockarts.com/Blog/PermaLink,guid,1432a5c7-93f2-4722-9cbc-b960a92024ab.aspx</id>
    <published>2007-11-30T17:21:02.383-08:00</published>
    <updated>2007-11-30T20:19:01.85175-08:00</updated>
    <category term="Programming" label="Programming" scheme="http://www.stevenrockarts.com/Blog/CategoryView,category,Programming.aspx" />
    <category term="Technical" label="Technical" scheme="http://www.stevenrockarts.com/Blog/CategoryView,category,Technical.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
At my DevTeach presentation I showed how you can do Map and Filter from Functional
programming right now in C# 2.0. In mathematics <a href="http://en.wikipedia.org/wiki/Reduction_%28mathematics%29">Reduce</a> is
"<em>the process of manipulating a series of equations or matrices into a desired
'simpler' format</em>". In C# you can think of it as taking a list and reducing
it down to one value. 
</p>
        <p>
Here is my implementation of Reduce in C# 2.0:
</p>
        <p>
          <!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red239\green239\blue228;\red0\green128\blue192;\red0\green0\blue150;\red128\green0\blue128;\red128\green0\blue0;\red255\green0\blue0;\red0\green0\blue255;}??\fs20 \cb2\highlight2 [\cf3 Test\cf0 ]\par ??\cf4 {\b public}\cf0  \cf4 {\b void}\cf0  \cf3 ShouldReduceListOfIntegersToTotal\cf0 ()\par ??\{\par ??    \cf5 {\b IList}\cf4 {\b &lt;int&gt;}\cf0  \cf3 numbers\cf0  \cf4 {\b =}\cf0  \cf4 {\b new}\cf0  \cf6 {\b List}\cf4 {\b &lt;int&gt;}\cf0 ();\par ??    \cf3 numbers\cf4 {\b .}\cf3 Add\cf0 (\cf7 1\cf0 );\par ??    \cf3 numbers\cf4 {\b .}\cf3 Add\cf0 (\cf7 2\cf0 );\par ??    \cf3 numbers\cf4 {\b .}\cf3 Add\cf0 (\cf7 3\cf0 );\par ??    \cf3 numbers\cf4 {\b .}\cf3 Add\cf0 (\cf7 4\cf0 );\par ??\par ??    \cf6 {\b RecordBook}\cf4 {\b &lt;int&gt;}\cf0  \cf3 recordBook\cf0  \cf4 {\b =}\cf0  \cf4 {\b new}\cf0  \cf6 {\b RecordBook}\cf4 {\b &lt;int&gt;}\cf0 (\cf3 numbers\cf0 );\par ??\par ??    \cf6 {\b Assert}\cf4 {\b .}\cf3 AreEqual\cf0 (\cf7 10\cf0 , \cf3 recordBook\cf4 {\b .}\cf3 Reduce\cf4 {\b &lt;int}\cf0 , \cf4 {\b int&gt;}\cf0 (\cf3 numbers\cf0 , \cf3 Add\cf0 ));\par ??\}\par ??\par ??[\cf3 Test\cf0 ]\par ??\cf4 {\b public}\cf0  \cf4 {\b void}\cf0  \cf3 ShouldPrintIntegersAsOneString\cf0 ()\par ??\{\par ??    \cf5 {\b IList}\cf4 {\b &lt;int&gt;}\cf0  \cf3 numbers\cf0  \cf4 {\b =}\cf0  \cf4 {\b new}\cf0  \cf6 {\b List}\cf4 {\b &lt;int&gt;}\cf0 ();\par ??    \cf3 numbers\cf4 {\b .}\cf3 Add\cf0 (\cf7 1\cf0 );\par ??    \cf3 numbers\cf4 {\b .}\cf3 Add\cf0 (\cf7 2\cf0 );\par ??    \cf3 numbers\cf4 {\b .}\cf3 Add\cf0 (\cf7 3\cf0 );\par ??    \cf3 numbers\cf4 {\b .}\cf3 Add\cf0 (\cf7 4\cf0 );\par ??\par ??    \cf6 {\b RecordBook}\cf4 {\b &lt;int&gt;}\cf0  \cf3 recordBook\cf0  \cf4 {\b =}\cf0  \cf4 {\b new}\cf0  \cf6 {\b RecordBook}\cf4 {\b &lt;int&gt;}\cf0 (\cf3 numbers\cf0 );\par ??\par ??    \cf6 {\b Assert}\cf4 {\b .}\cf3 AreEqual\cf0 (\cf8 "1234"\cf0 , \cf3 recordBook\cf4 {\b .}\cf3 Reduce\cf4 {\b &lt;int}\cf0 , \cf4 {\b string&gt;}\cf0 (\cf3 numbers\cf0 , \cf3 BuildStringFromIntegers\cf0 ));\par ??\}\par ??\par ??\cf4 {\b private}\cf0  \cf4 {\b string}\cf0  \cf3 BuildStringFromIntegers\cf0 (\cf4 {\b int}\cf0  \cf3 number\cf0 , \cf4 {\b string}\cf0  \cf3 test\cf0 )\par ??\{\par ??    \cf4 {\b return}\cf0  \cf3 test\cf0  \cf4 {\b +}\cf0  \cf3 number\cf0 ;\par ??\}\par ??\par ??\cf4 {\b private}\cf0  \cf4 {\b int}\cf0  \cf3 Add\cf0 (\cf4 {\b int}\cf0  \cf3 number1\cf0 , \cf4 {\b int}\cf0  \cf3 number2\cf0 )\par ??\{\par ??    \cf4 {\b return}\cf0  \cf3 number1\cf0  \cf4 {\b +}\cf0  \cf3 number2\cf0 ;\par ??\}}
-->
        </p>
        <div style="border-right: rgb(221,221,221) 1px dotted; padding-right: 4px; border-top: rgb(221,221,221) 1px dotted; padding-left: 4px; font-size: small; background: rgb(255,255,255); padding-bottom: 4px; margin: 4px; border-left: rgb(221,221,221) 1px dotted; color: rgb(0,0,0); padding-top: 4px; border-bottom: rgb(221,221,221) 1px dotted; font-family: consolas,'Courier New',courier,monospace">[<span style="color: #0080c0">Test</span>]<br /><span style="font-weight: bold; color: #000096">public</span> <span style="font-weight: bold; color: #000096">void</span> <span style="color: #0080c0">ShouldReduceListOfIntegersToTotal</span>()<br />
{<br />
    <span style="font-weight: bold; color: purple">IList</span><span style="font-weight: bold; color: #000096">&lt;int&gt;</span> <span style="color: #0080c0">numbers</span> <span style="font-weight: bold; color: #000096">=</span> <span style="font-weight: bold; color: #000096">new</span> <span style="font-weight: bold; color: maroon">List</span><span style="font-weight: bold; color: #000096">&lt;int&gt;</span>();<br />
    <span style="color: #0080c0">numbers</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">Add</span>(<span style="color: red">1</span>);<br />
    <span style="color: #0080c0">numbers</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">Add</span>(<span style="color: red">2</span>);<br />
    <span style="color: #0080c0">numbers</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">Add</span>(<span style="color: red">3</span>);<br />
    <span style="color: #0080c0">numbers</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">Add</span>(<span style="color: red">4</span>);<br />
 <br />
    <span style="font-weight: bold; color: maroon">RecordBook</span><span style="font-weight: bold; color: #000096">&lt;int&gt;</span> <span style="color: #0080c0">recordBook</span> <span style="font-weight: bold; color: #000096">=</span> <span style="font-weight: bold; color: #000096">new</span> <span style="font-weight: bold; color: maroon">RecordBook</span><span style="font-weight: bold; color: #000096">&lt;int&gt;</span>(<span style="color: #0080c0">numbers</span>);<br />
 <br />
    <span style="font-weight: bold; color: maroon">Assert</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">AreEqual</span>(<span style="color: red">10</span>, <span style="color: #0080c0">recordBook</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">Reduce</span><span style="font-weight: bold; color: #000096">&lt;int</span>, <span style="font-weight: bold; color: #000096">int&gt;</span>(<span style="color: #0080c0">numbers</span>, <span style="color: #0080c0">Add</span>));<br />
}<br />
 <br />
[<span style="color: #0080c0">Test</span>]<br /><span style="font-weight: bold; color: #000096">public</span> <span style="font-weight: bold; color: #000096">void</span> <span style="color: #0080c0">ShouldPrintIntegersAsOneString</span>()<br />
{<br />
    <span style="font-weight: bold; color: purple">IList</span><span style="font-weight: bold; color: #000096">&lt;int&gt;</span> <span style="color: #0080c0">numbers</span> <span style="font-weight: bold; color: #000096">=</span> <span style="font-weight: bold; color: #000096">new</span> <span style="font-weight: bold; color: maroon">List</span><span style="font-weight: bold; color: #000096">&lt;int&gt;</span>();<br />
    <span style="color: #0080c0">numbers</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">Add</span>(<span style="color: red">1</span>);<br />
    <span style="color: #0080c0">numbers</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">Add</span>(<span style="color: red">2</span>);<br />
    <span style="color: #0080c0">numbers</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">Add</span>(<span style="color: red">3</span>);<br />
    <span style="color: #0080c0">numbers</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">Add</span>(<span style="color: red">4</span>);<br />
 <br />
    <span style="font-weight: bold; color: maroon">RecordBook</span><span style="font-weight: bold; color: #000096">&lt;int&gt;</span> <span style="color: #0080c0">recordBook</span> <span style="font-weight: bold; color: #000096">=</span> <span style="font-weight: bold; color: #000096">new</span> <span style="font-weight: bold; color: maroon">RecordBook</span><span style="font-weight: bold; color: #000096">&lt;int&gt;</span>(<span style="color: #0080c0">numbers</span>);<br />
 <br />
    <span style="font-weight: bold; color: maroon">Assert</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">AreEqual</span>(<span style="color: blue">"1234"</span>, <span style="color: #0080c0">recordBook</span><span style="font-weight: bold; color: #000096">.</span><span style="color: #0080c0">Reduce</span><span style="font-weight: bold; color: #000096">&lt;int</span>, <span style="font-weight: bold; color: #000096">string&gt;</span>(<span style="color: #0080c0">numbers</span>, <span style="color: #0080c0">BuildStringFromIntegers</span>));<br />
}<br />
 <br /><span style="font-weight: bold; color: #000096">private</span> <span style="font-weight: bold; color: #000096">string</span> <span style="color: #0080c0">BuildStringFromIntegers</span>(<span style="font-weight: bold; color: #000096">int</span> <span style="color: #0080c0">number</span>, <span style="font-weight: bold; color: #000096">string</span> <span style="color: #0080c0">test</span>)<br />
{<br />
    <span style="font-weight: bold; color: #000096">return</span> <span style="color: #0080c0">test</span> <span style="font-weight: bold; color: #000096">+</span> <span style="color: #0080c0">number</span>;<br />
}<br />
 <br /><span style="font-weight: bold; color: #000096">private</span> <span style="font-weight: bold; color: #000096">int</span> <span style="color: #0080c0">Add</span>(<span style="font-weight: bold; color: #000096">int</span> <span style="color: #0080c0">number1</span>, <span style="font-weight: bold; color: #000096">int</span> <span style="color: #0080c0">number2</span>)<br />
{<br />
    <span style="font-weight: bold; color: #000096">return</span> <span style="color: #0080c0">number1</span> <span style="font-weight: bold; color: #000096">+</span> <span style="color: #0080c0">number2</span>;<br />
}<br /></div>
        <p>
and the implementation of the tests:
</p>
        <p>
          <!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue150;\red239\green239\blue228;\red0\green0\blue0;\red0\green128\blue192;\red128\green0\blue0;\red128\green0\blue128;}??\fs20 \cf1\cb2\highlight2 {\b public}\cf0  \cf1 {\b delegate}\cf0  \cf4 TResult\cf0  \cf5 {\b Accumulator}\cf1 {\b &lt;}\cf4 TSource\cf0 , \cf4 TResult\cf1 {\b &gt;}\cf0 (\cf4 TSource\cf0  \cf4 x\cf0 , \cf4 TResult\cf0  \cf4 y\cf0 );\par ??\par ??\cf1 {\b public}\cf0  \cf4 TResult\cf0  \cf4 Reduce\cf1 {\b &lt;}\cf4 TSource\cf0 , \cf4 TResult\cf1 {\b &gt;}\cf0 (\cf6 {\b IEnumerable}\cf1 {\b &lt;}\cf4 TSource\cf1 {\b &gt;}\cf0  \cf4 source\cf0 , \cf5 {\b Accumulator}\cf1 {\b &lt;}\cf4 TSource\cf0 , \cf4 TResult\cf1 {\b &gt;}\cf0  \cf4 accumulator\cf0 )\par ??\{\par ??    \cf4 TResult\cf0  \cf4 result\cf0  \cf1 {\b =}\cf0  \cf1 {\b default}\cf0 (\cf4 TResult\cf0 );\par ??    \par ??    \cf1 {\b foreach}\cf0  (\cf4 TSource\cf0  \cf4 item\cf0  \cf1 {\b in}\cf0  \cf4 source\cf0 )\par ??        \cf4 result\cf0  \cf1 {\b =}\cf0  \cf4 accumulator\cf0 (\cf4 item\cf0 , \cf4 result\cf0 );\par ??    \par ??    \cf1 {\b return}\cf0  \cf4 result\cf0 ;\par ??\}}
-->
        </p>
        <div style="border-right: rgb(221,221,221) 1px dotted; padding-right: 4px; border-top: rgb(221,221,221) 1px dotted; padding-left: 4px; font-size: small; background: rgb(255,255,255); padding-bottom: 4px; margin: 4px; border-left: rgb(221,221,221) 1px dotted; color: rgb(0,0,0); padding-top: 4px; border-bottom: rgb(221,221,221) 1px dotted; font-family: consolas,'Courier New',courier,monospace">
          <span style="font-weight: bold; color: #000096">public</span> <span style="font-weight: bold; color: #000096">delegate</span> <span style="color: #0080c0">TResult</span> <span style="font-weight: bold; color: maroon">Accumulator</span><span style="font-weight: bold; color: #000096">&lt;</span><span style="color: #0080c0">TSource</span>, <span style="color: #0080c0">TResult</span><span style="font-weight: bold; color: #000096">&gt;</span>(<span style="color: #0080c0">TSource</span> <span style="color: #0080c0">x</span>, <span style="color: #0080c0">TResult</span> <span style="color: #0080c0">y</span>);<br />
 <br /><span style="font-weight: bold; color: #000096">public</span> <span style="color: #0080c0">TResult</span> <span style="color: #0080c0">Reduce</span><span style="font-weight: bold; color: #000096">&lt;</span><span style="color: #0080c0">TSource</span>, <span style="color: #0080c0">TResult</span><span style="font-weight: bold; color: #000096">&gt;</span>(<span style="font-weight: bold; color: purple">IList</span><span style="font-weight: bold; color: #000096">&lt;</span><span style="color: #0080c0">TSource</span><span style="font-weight: bold; color: #000096">&gt;</span> <span style="color: #0080c0">source</span>, <span style="font-weight: bold; color: maroon">Accumulator</span><span style="font-weight: bold; color: #000096">&lt;</span><span style="color: #0080c0">TSource</span>, <span style="color: #0080c0">TResult</span><span style="font-weight: bold; color: #000096">&gt;</span> <span style="color: #0080c0">accumulator</span>)<br />
{<br />
    <span style="color: #0080c0">TResult</span> <span style="color: #0080c0">result</span> <span style="font-weight: bold; color: #000096">=</span> <span style="font-weight: bold; color: #000096">default</span>(<span style="color: #0080c0">TResult</span>);<br />
 <br />
    <span style="font-weight: bold; color: #000096">foreach</span> (<span style="color: #0080c0">TSource</span> <span style="color: #0080c0">item</span> <span style="font-weight: bold; color: #000096">in</span> <span style="color: #0080c0">source</span>)<br />
        <span style="color: #0080c0">result</span> <span style="font-weight: bold; color: #000096">=</span> <span style="color: #0080c0">accumulator</span>(<span style="color: #0080c0">item</span>, <span style="color: #0080c0">result</span>);<br />
 <br />
    <span style="font-weight: bold; color: #000096">return</span> <span style="color: #0080c0">result</span>;<br />
}<br /></div>
        <p>
The first test calculates the sum of adding all the integers in the list together
using the add function. The second test takes an integer and concatenates it to a
string producing a string of all the integers in the list.
</p>
        <p>
The Reduce function introduces the <a href="http://msdn2.microsoft.com/en-us/library/xwth0h0d(VS.80).aspx">default
keyword</a> that you can leverage with generics. This will give you the default value
for value types (0 for integers, 0.0 for decimals, null for string). 
</p>
        <img width="0" height="0" src="http://www.stevenrockarts.com/Blog/aggbug.ashx?id=1432a5c7-93f2-4722-9cbc-b960a92024ab" />
      </div>
    </content>
  </entry>
</feed>