<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>//FIXME &#187; Coding</title>
	<atom:link href="http://eraserhead.net/category/philosophizing-over-coding/feed/" rel="self" type="application/rss+xml" />
	<link>http://eraserhead.net</link>
	<description>Jason Felice's blog</description>
	<lastBuildDate>Sat, 04 Sep 2010 03:13:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>A Dirty C++ Testing Trick</title>
		<link>http://eraserhead.net/2010/08/a-dirty-c-testing-trick/</link>
		<comments>http://eraserhead.net/2010/08/a-dirty-c-testing-trick/#comments</comments>
		<pubDate>Sun, 15 Aug 2010 16:25:22 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://eraserhead.net/?p=584</guid>
		<description><![CDATA[Say you need access to a private member when testing.  In my current case, I haven&#8217;t invented the machinery for state transitions, but I&#8217;m writing the OpenGL rendering based on our hero&#8217;s state (this is for my Impossible Mission clone).
Boost often provides friend classes and template friends to do this, but this can be [...]]]></description>
			<content:encoded><![CDATA[<p>Say you need access to a private member when testing.  In my current case, I haven&#8217;t invented the machinery for state transitions, but I&#8217;m writing the OpenGL rendering based on our hero&#8217;s state (this is for my Impossible Mission clone).</p>
<p>Boost often provides friend classes and template friends to do this, but this can be a lot of work.  What I&#8217;ve done is made the member protected, then:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">struct</span> TestableGuy <span style="color: #008080;">:</span> <span style="color: #0000ff;">public</span> Guy <span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">inline</span> State<span style="color: #000040;">&amp;</span> state<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> <span style="color: #0000ff;">return</span> state_<span style="color: #008080;">;</span> <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span></pre></div></div>

<p>In my testing code:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">      Guy g<span style="color: #008000;">&#40;</span>Point<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">99</span>,<span style="color: #0000dd;">99</span><span style="color: #008000;">&#41;</span>, ts<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
      <span style="color: #0000ff;">reinterpret_cast</span><span style="color: #000080;">&lt;</span>TestableGuy<span style="color: #000040;">&amp;</span><span style="color: #000080;">&gt;</span><span style="color: #008000;">&#40;</span>g<span style="color: #008000;">&#41;</span>.<span style="color: #007788;">state</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #000080;">=</span> s<span style="color: #008080;">;</span></pre></div></div>

<p>I&#8217;m using reinterpret_cast&lt;&gt; to avoid needing to maintain constructors on TestableGuy as I add them or change them on Guy.  Since no new data members or virtual functions were added, we can be assured that the classes have the same binary representation.</p>
]]></content:encoded>
			<wfw:commentRss>http://eraserhead.net/2010/08/a-dirty-c-testing-trick/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using hstest to Run Haskell Tests</title>
		<link>http://eraserhead.net/2010/06/collecting-tests-in-haskell/</link>
		<comments>http://eraserhead.net/2010/06/collecting-tests-in-haskell/#comments</comments>
		<pubDate>Sun, 27 Jun 2010 17:00:22 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[hstest]]></category>
		<category><![CDATA[HUnit]]></category>
		<category><![CDATA[QuickCheck]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[test-framework]]></category>

		<guid isPermaLink="false">http://eraserhead.net/?p=558</guid>
		<description><![CDATA[Unit Testing in Haskell
QuickCheck is the gold standard for testing pure functional (side-effect free) code in Haskell. It allows you to assert properties of functions, such as &#8220;this function returns a non-negative result for any input.&#8221; QuickCheck generates input cases and checks the proposition automatically.
HUnit is the usual xUnit clone for Haskell. It deals with [...]]]></description>
			<content:encoded><![CDATA[<h2>Unit Testing in Haskell</h2>
<p><a href="http://www.haskell.org/haskellwiki/Introduction_to_QuickCheck">QuickCheck</a> is the gold standard for testing pure functional (side-effect free) code in Haskell. It allows you to assert properties of functions, such as &#8220;this function returns a non-negative result for any input.&#8221; QuickCheck generates input cases and checks the proposition automatically.</p>
<p><a href="http://hunit.sourceforge.net/">HUnit</a> is the usual xUnit clone for Haskell. It deals with actions (Haskell&#8217;s term for functions having side-effects). You perform some action then assert the resulting state has been correctly mutated.</p>
<p>It is mighty convenient to use both for TDD on any non-trivial program.</p>
<h2>Test Collection</h2>
<p>Relying on the coder to remember to add tests to suites will eventually produce orphaned suites.  Then comes the false confidence: <em>I ran all the tests and they passed, and I </em>know<em> it doesn&#8217;t break assertion X, because there&#8217;s a test for that.  I&#8217;ve seen it.</em></p>
<p>As <a href="http://onesock.cc/">OneSock</a> has gotten a little bit bigger (it&#8217;s still small, don&#8217;t worry), I start to worry about this.  I did a bit of research and found some test-collection tools:</p>
<h3><a href="http://hackage.haskell.org/package/quickcheck-script">quickcheck-script</a></h3>
<p>This script will scan the source files supplied on the command-line for QuickCheck assertions and run them.  It is very useful and easy to use.  The drawback here is that it will not run my HUnit tests.</p>
<h3><a href="http://bitbucket.org/dave4420/hstest/wiki/Home">hstest</a></h3>
<p>This program will scan for QuickCheck1 and HUnit tests in all sources in the current directory and run them.  The drawback is its current lack of support for QuickCheck2.  The philosophy is right for what I want to do &#8211; have a simple &#8220;brain idle&#8221; command for my TDD cycle that runs all the tests.</p>
<h3><a href="http://batterseapower.github.com/test-framework/">test-framework</a></h3>
<p>This package provides a class with instances for HUnit, QuickCheck1, and QuickCheck2.  For the most part, manual collection is required; however, there is a <a href="http://hackage.haskell.org/package/test-framework-th">test-framework-th</a> package which uses the <a href="http://www.haskell.org/haskellwiki/Template_Haskell">TemplateHaskell</a> extension to provide a meta-function that scans the current source file for tests and collects them.</p>
<h2>The Decision</h2>
<p>I&#8217;ve decided to go with hstest.  </p>
<p><tt>quickcheck-script</tt> doesn&#8217;t run HUnit tests.</p>
<p>While <tt>test-framework</tt> seems to have more mindshare and also seems to be well-thought-out, there is no script to automatically collect tests.  The TemplateHaskell trick is nice; however, introducing another layer of complexity just for test collection is a bit overwhelming at this early stage&#8212;especially because it doesn&#8217;t solve the original problem: now a programmer must remember to register all source files rather than all tests in a test-runner program.</p>
<p>To work around the current lack of support for QuickCheck2, you can supply parameters to hide and expose packages.  I&#8217;ve written this shell function:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> t<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
	hstest <span style="color: #660033;">--expose-package</span>=QuickCheck-1.2.0.0 <span style="color: #660033;">--hide-package</span>=QuickCheck-2.1.0.3
	<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span> hugsin
	<span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #007800;">$?</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>I&#8217;ve found that my current few properties run unaltered under QuickCheck1.</p>
<p>I&#8217;ve also specified QuickCheck1 in my cabal file for the moment so that I don&#8217;t use features that hstest doesn&#8217;t like.  This provokes a warning:</p>
<pre>
jfelice@flarp64:~/src/onesock$ cabal configure
Resolving dependencies...
Configuring OneSock-0.1...
Warning: This package indirectly depends on multiple versions of the same
package. This is highly likely to cause a compile failure.
package OneSock-0.1 requires QuickCheck-1.2.0.0
package Crypto-4.2.1 requires QuickCheck-2.1.0.3
jfelice@flarp64:~/src/onesock$
</pre>
<p>No build issues occur.  Maybe the linker is eliminating all QuickCheck references (which are unreachable from <tt>main</tt>).</p>
]]></content:encoded>
			<wfw:commentRss>http://eraserhead.net/2010/06/collecting-tests-in-haskell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Five Line Hex Dump</title>
		<link>http://eraserhead.net/2010/06/five-line-hex-dump/</link>
		<comments>http://eraserhead.net/2010/06/five-line-hex-dump/#comments</comments>
		<pubDate>Fri, 11 Jun 2010 15:57:36 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Hex]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://eraserhead.net/?p=556</guid>
		<description><![CDATA[I work with message formats a lot.  Being able to conjure up a hex dump on the spot is an invaluable skill.  You&#8217;d think that you should have a library function for this; however, there&#8217;s often problems &#8211; it&#8217;s not in the path for this project, the built-in one doesn&#8217;t work on this [...]]]></description>
			<content:encoded><![CDATA[<p>I work with message formats a lot.  Being able to conjure up a hex dump on the spot is an invaluable skill.  You&#8217;d think that you should have a library function for this; however, there&#8217;s often problems &#8211; it&#8217;s not in the path for this project, the built-in one doesn&#8217;t work on this JVM, the link settings aren&#8217;t right to use it, etc.  So I&#8217;ve typed this hundreds of times:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">  <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> data.<span style="color: #006633;">length</span><span style="color: #339933;">;</span> <span style="color: #339933;">++</span>i<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>i<span style="color: #339933;">%</span>16<span style="color: #339933;">==</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #003399;">System</span>.<span style="color: #006633;">err</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003399;">System</span>.<span style="color: #006633;">err</span>.<span style="color: #006633;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;%02x &quot;</span>,data<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #003399;">System</span>.<span style="color: #006633;">err</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The C and C++ equivalents are almost identical.</p>
]]></content:encoded>
			<wfw:commentRss>http://eraserhead.net/2010/06/five-line-hex-dump/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Too Much TDD</title>
		<link>http://eraserhead.net/2010/05/too-much-tdd/</link>
		<comments>http://eraserhead.net/2010/05/too-much-tdd/#comments</comments>
		<pubDate>Mon, 24 May 2010 16:30:22 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[Pair Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://eraserhead.net/?p=549</guid>
		<description><![CDATA[A couple weeks ago, I met up Attila Domokos and did the LCD rubyquiz.  Let me set the scene about the pattern in use at these Hackabous:

Pair up.
One test is written first.
Only as much functionality as is needed to make the test pass is written.
The next test is written&#8230;

&#8230;and so forth.
We moved through parsing [...]]]></description>
			<content:encoded><![CDATA[<p>A couple weeks ago, I met up Attila Domokos and did the <a href="http://www.rubyquiz.com/quiz14.html">LCD rubyquiz</a>.  Let me set the scene about the pattern in use at these Hackabous:</p>
<ol>
<li>Pair up.
<li>One test is written first.
<li>Only as much functionality as is needed to make the test pass is written.
<li>The next test is written&#8230;
</ol>
<p>&#8230;and so forth.</p>
<p>We moved through parsing the command-line easily, then coded the test for displaying a single digit.  We noticed we were at a particular sort of impasse:</p>
<p><em>Implementing as little code as possible to pass this test could not produce code which could survive the next test.</em>  At least, not in a way that I can see.</p>
<p>What should you do?  Should you write the code, debug it and pass the test, then add the next test and delete the code?  This seems like an odd question to ask. The only reason I even ask it now is I&#8217;ve found some people who really advocate this.</p>
<p>Another example: I listened during the Roman Numerals kata as one team made first I, then II and III pass by coding:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  <span style="color:#9966CC; font-weight:bold;">def</span> convert<span style="color:#006600; font-weight:bold;">&#40;</span>n<span style="color:#006600; font-weight:bold;">&#41;</span>
    n.<span style="color:#CC0066; font-weight:bold;">split</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">size</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>If I understand proponents&#8217; arguments, in writing the code you are learning, and this learning will dominate the inefficiencies in this process over time.</p>
<p>I honestly think this is a misreading of agile.  Agile was built in the context of an industry addicted to wasteful, heavy and rigid process.  Should TDD become a wasteful, heavy and rigid process?</p>
<p>How do I proceed in these cases?  First, I have nothing against writing more than one test up front.  If I can think of several of the corner cases and potential pitfalls right now, I will write them down in xUnit. Sometimes switching from researching the requirements to coding is an expensive operation, and in these cases, I&#8217;ll lay out five or ten tests documenting the requirements.  Sometimes, I have no idea how I&#8217;m going to implement something.  Writing a batch of tests up front allows me to explore the corner cases and think more about designing a useful approach.</p>
<p>Given the multiple tests, I have no problem writing the more complicated algorithm first.  We&#8217;ve already determined that we can&#8217;t (or perhaps just don&#8217;t know how) to evolve it, so we&#8217;re going to end up going for it anyway.</p>
]]></content:encoded>
			<wfw:commentRss>http://eraserhead.net/2010/05/too-much-tdd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wishing for &#8220;let rec&#8221; in Java</title>
		<link>http://eraserhead.net/2010/04/wishing-for-let-rec-in-java/</link>
		<comments>http://eraserhead.net/2010/04/wishing-for-let-rec-in-java/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 13:03:08 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Functional Programming]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://eraserhead.net/?p=544</guid>
		<description><![CDATA[
    public void testCallsRollbackIfSendingAuthResponseFails&#40;&#41; throws Exception &#123;
        final MockSender sender = new MockSender&#40;&#41;;
        final MockSession session = new MockSession&#40;&#41; &#123;
            @Override
       [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testCallsRollbackIfSendingAuthResponseFails<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">final</span> MockSender sender <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MockSender<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">final</span> MockSession session <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MockSession<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            @Override
            <span style="color: #000000; font-weight: bold;">public</span> DASAuthObj authorize<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> DASAuthObj authObj<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                mgr.<span style="color: #006633;">dispatch</span><span style="color: #009900;">&#40;</span> ... <span style="color: #666666; font-style: italic;">// AGHAGHAGH!</span>
                <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">authorize</span><span style="color: #009900;">&#40;</span>authObj<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">final</span> DASSessionManager mgr <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DASSessionManager<span style="color: #009900;">&#40;</span>session, sender<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        ...</pre></div></div>

<p>[EDIT: OK, you can do it manually with Java arrays.  Still icky.]</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testCallsRollbackIfSendingAuthResponseFails<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">final</span> MockSender sender <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MockSender<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">final</span> DASSessionManager<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> mgrHolder <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DASSessionManager<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">final</span> MockSession session <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MockSession<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            @Override
            <span style="color: #000000; font-weight: bold;">public</span> DASAuthObj authorize<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> DASAuthObj authObj<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                mgrHolder<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #006633;">dispatch</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> DASCloseAuthSinkPacket<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span>, <span style="color: #000066; font-weight: bold;">true</span>, <span style="color: #cc66cc;">42</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">authorize</span><span style="color: #009900;">&#40;</span>authObj<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">final</span> DASSessionManager mgr <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DASSessionManager<span style="color: #009900;">&#40;</span>session, sender<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        mgrHolder<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> mgr<span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://eraserhead.net/2010/04/wishing-for-let-rec-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>R Utilities for Software Kanban &#8211; Plotting Your CFD</title>
		<link>http://eraserhead.net/2010/04/r-utilities-for-software-kanban-plotting-your-cfd/</link>
		<comments>http://eraserhead.net/2010/04/r-utilities-for-software-kanban-plotting-your-cfd/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 13:59:53 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Guerilla Software Recovery]]></category>
		<category><![CDATA[CFD]]></category>
		<category><![CDATA[Kanban]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://eraserhead.net/?p=537</guid>
		<description><![CDATA[I&#8217;ve started a set of R utilities for software kanban at GitHub.  I&#8217;ve been using the R environment more lately, and I really like how easy it makes visualizing and working with data.  It has a bit of an &#8220;old-school&#8221; environment feel as well and it is functional and efficient.  If you [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve started a set of <a href="http://github.com/eraserhd/rkanban">R utilities for software kanban</a> at <a href="http://github.com/">GitHub</a>.  I&#8217;ve been using the R environment more lately, and I really like how easy it makes visualizing and working with data.  It has a bit of an &#8220;old-school&#8221; environment feel as well and it is functional and efficient.  If you are an R guru (I&#8217;m not really, though I&#8217;m learning) and you have utilities, please contribute!</p>
<p>The utilities expect data to be stored in a <tt>data.frame</tt>.  The first column must be named &#8220;Date&#8221; and have &#8220;Date&#8221; class.  The second column is currently ignored; however, the intention is that it indicates the ticket category (usually represented on the board by ticket color), and so it should be a factor.  Columns three onward (as many as you have flow steps) are tallies of each work flow step for the day, in reverse chronological order &#8211; starting with &#8220;Done&#8221; and ending with &#8220;Backlog&#8221;, in other words.</p>
<p>The easiest way to get this data into R is to store it in a CSV file and use <tt>read.csv</tt> to load it.  Here is some sample data:</p>
<pre>
Date,Category,Done,QA,Development,Ready,Backlog
2009/10/20,Project,0,2,2,0,0
2009/10/20,Urgent,0,0,1,0,0
2009/10/22,Project,1,2,1,0,0
2009/10/22,Urgent,0,0,2,0,0
2009/10/23,Project,1,2,2,0,0
2009/10/23,Urgent,0,0,2,0,0
</pre>
<p>Load this into R with:</p>
<pre>
> my.data <- read.csv("my_data.csv")
</pre>
<p>An alternate method for maintaining your data within R is to use the <tt>fix()</tt> function on a daily basis, which is what I do.  Two warnings, however:</p>
<ol>
<li>Make sure to save your workspace so that you don't lose your stats.</p>
<li><tt>fix()</tt> will strip the "Date" class from the Date column.
</ol>
<p>To re-add the Date class after using <tt>fix()</tt>, do this:</p>
<pre>
> my.data$Date <- as.Date(my.data$Date)
</pre>
<h2>Plotting your CFD</h2>
<p>Check out the <a href="http://github.com/eraserhd/rkanban">rkanban</a> sources into the "rkanban" directory under your R working directory and source the <tt>kanban.R</tt> file.</p>
<p>You can then plot your CFD from within R like so:</p>
<pre>
> source("rkanban/kanban.R")
> PlotCFD(my.data)
</pre>
<p><img src="http://eraserhead.net/files/plotcfd.png"></p>
]]></content:encoded>
			<wfw:commentRss>http://eraserhead.net/2010/04/r-utilities-for-software-kanban-plotting-your-cfd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating boilerplate with Google Guice</title>
		<link>http://eraserhead.net/2010/03/creating-boilerplate-with-google-guice/</link>
		<comments>http://eraserhead.net/2010/03/creating-boilerplate-with-google-guice/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 04:09:39 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Dependency Injection]]></category>
		<category><![CDATA[Guice]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Patterns]]></category>
		<category><![CDATA[Singleton]]></category>

		<guid isPermaLink="false">http://eraserhead.net/?p=508</guid>
		<description><![CDATA[We&#8217;ve been Guicing up XPay for a couple weeks.  For those not familiar with Guice, it is a dependency injection framework.
Guice in Ten Seconds
You annotate your classes types&#8217; primary constructors, create &#8220;modules&#8221; which bind concrete types or singleton instances to interface and abstract types, then ask Guice to create you one of some type. [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve been <a href="http://code.google.com/p/google-guice/">Guicing up</a> XPay for a couple weeks.  For those not familiar with Guice, it is a <a href="http://en.wikipedia.org/wiki/Dependency_injection">dependency injection</a> framework.</p>
<h2>Guice in Ten Seconds</h2>
<p>You annotate your classes types&#8217; primary constructors, create &#8220;modules&#8221; which bind concrete types or singleton instances to interface and abstract types, then ask Guice to create you one of some type.  Guice will automatically create all dependencies (constructor parameters) for that type before invoking the primary constructor, and if any of those types require dependencies create those first, and so forth.  For example, if your class <tt>Foo</tt> needs some kind of <tt>PackagingStrategy</tt> (presumably an interface) passed to its constructor, and your module binds <tt>PackagingStrategy.class</tt> to <tt>BinaryPackagingStrategy.class</tt>, then when you ask Guice for an instance of <tt>Foo</tt>, it will create a new <tt>BinaryPackagingStrategy</tt>, &#8220;newing up&#8221; its constructor parameters recursively, and pass this to <tt>Foo</tt>&#8217;s constructor.</p>
<p>The benefits of this scheme are in the class of &#8220;hard to describe, but definitely there.&#8221;  First and foremost, it improves system design, making interfaces clearer and more self-documenting by removing hidden dependencies on things like Singletons and Monostates.  This improves testability because mucking with the global state encapsulated in Singleton and Monostate patterns requires a much deeper knowledge of classes under test and some often-shady practices.  Without a good DI framework, passing a dependency down several layers of object graph is complicated and provides extra coupling, making the Singleton pattern much more attractive.  With the DI framework, there&#8217;s really no inclination to make the dependency of a class anything other than a constructor parameter.</p>
<h2>But, More Boilerplate?</h2>
<p>There&#8217;s plenty of boilerplate that Guice removes, mostly in the &#8220;bean wiring&#8221; category, and this is good.  Interestingly, there are areas in which I&#8217;ve found myself writing <em>more</em> boilerplate with Guice, and an instance of this is what I&#8217;d like to discuss today.</p>
<p>I work with some people who have become thoroughly disgusted with OOP and advocate for functional style with immutable data types.  I appreciate functional style with immutable data types, but I must say that the <a href="http://en.wikipedia.org/wiki/Strategy_pattern">Strategy pattern</a> is something OOP does well and not something that FP does nearly as well.  I tend to use strategy pattern quite a bit in our XPay (and in our C++ product, DAS).  One reason to <a href="http://c2.com/cgi/wiki?SwitchStatementsSmell">prefer Strategy pattern to switch statements</a> is to have a single point of control over <em>which</em> strategy implementation to use.  This use case usually conjures itself into being in a <a href="http://en.wikipedia.org/wiki/Factory_method_pattern">Factory method pattern</a> which has the single switch statement which provides an instance of the concrete type based on input parameters.</p>
<p>In Guice, you can inject a <tt>Provider&lt;Foo&gt;</tt> and Guice will automatically create a type that produces instances of <tt>Foo</tt>.  This is useful for dependencies.  So our factory ends up looking something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> FooFactory <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">final</span> Provider<span style="color: #339933;">&lt;</span>TypeAFoo<span style="color: #339933;">&gt;</span> typeAFooProvider<span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">final</span> Provider<span style="color: #339933;">&lt;</span>TypeBFoo<span style="color: #339933;">&gt;</span> typeBFooProvider<span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">final</span> Provider<span style="color: #339933;">&lt;</span>TypeCAFoo<span style="color: #339933;">&gt;</span> typeCAFooProvider<span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">final</span> Provider<span style="color: #339933;">&lt;</span>TypeCBFoo<span style="color: #339933;">&gt;</span> typeCBFooProvider<span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">final</span> Provider<span style="color: #339933;">&lt;</span>TypeDFoo<span style="color: #339933;">&gt;</span> typeDFooProvider<span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">final</span> Provider<span style="color: #339933;">&lt;</span>TypeEFoo<span style="color: #339933;">&gt;</span> typeEFooProvider<span style="color: #339933;">;</span>
&nbsp;
    @Inject
    <span style="color: #000000; font-weight: bold;">public</span> FooFactory<span style="color: #009900;">&#40;</span>
            <span style="color: #000000; font-weight: bold;">final</span> Provider<span style="color: #339933;">&lt;</span>TypeAFoo<span style="color: #339933;">&gt;</span> typeAFooProvider,
            <span style="color: #000000; font-weight: bold;">final</span> Provider<span style="color: #339933;">&lt;</span>TypeBFoo<span style="color: #339933;">&gt;</span> typeBFooProvider,
            <span style="color: #000000; font-weight: bold;">final</span> Provider<span style="color: #339933;">&lt;</span>TypeCAFoo<span style="color: #339933;">&gt;</span> typeCAFooProvider,
            <span style="color: #000000; font-weight: bold;">final</span> Provider<span style="color: #339933;">&lt;</span>TypeCBFoo<span style="color: #339933;">&gt;</span> typeCBFooProvider,
            <span style="color: #000000; font-weight: bold;">final</span> Provider<span style="color: #339933;">&lt;</span>TypeDFoo<span style="color: #339933;">&gt;</span> typeDFooProvider,
            <span style="color: #000000; font-weight: bold;">final</span> Provider<span style="color: #339933;">&lt;</span>TypeEFoo<span style="color: #339933;">&gt;</span> typeEFooProvider
            <span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">typeAFooProvider</span> <span style="color: #339933;">=</span> typeAFooProvider<span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">typeBFooProvider</span> <span style="color: #339933;">=</span> typeBFooProvider<span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">typeCAFooProvider</span> <span style="color: #339933;">=</span> typeCAFooProvider<span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">typeCBFooProvider</span> <span style="color: #339933;">=</span> typeCBFooProvider<span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">typeDFooProvider</span> <span style="color: #339933;">=</span> typeDFooProvider<span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">typeEFooProvider</span> <span style="color: #339933;">=</span> typeEFooProvider<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> Foo get<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">char</span> type, <span style="color: #000066; font-weight: bold;">boolean</span> inverted<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">switch</span> <span style="color: #009900;">&#40;</span>type<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #0000ff;">'A'</span><span style="color: #339933;">:</span>
            <span style="color: #000000; font-weight: bold;">return</span> typeAFooProvider.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>         
        <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #0000ff;">'B'</span><span style="color: #339933;">:</span>
            <span style="color: #000000; font-weight: bold;">return</span> typeBFooProvider.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>         
        <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #0000ff;">'C'</span><span style="color: #339933;">:</span>
            <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>inverted<span style="color: #009900;">&#41;</span>
                <span style="color: #000000; font-weight: bold;">return</span> typeCAFooProvider.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">else</span>
                <span style="color: #000000; font-weight: bold;">return</span> typeCBFooProvider.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #0000ff;">'D'</span><span style="color: #339933;">:</span>
            <span style="color: #000000; font-weight: bold;">return</span> typeBFooProvider.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>         
        <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #0000ff;">'E'</span><span style="color: #339933;">:</span>
            <span style="color: #000000; font-weight: bold;">return</span> typeBFooProvider.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>         
        <span style="color: #000000; font-weight: bold;">default</span><span style="color: #339933;">:</span>
            <span style="color: #000000; font-weight: bold;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> FooFactoryException<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Can't determine type.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Ugh!</p>
<p>This is &#8220;better&#8221; boilerplate than the bean wiring before in that it hints that we might be able to concoct a general solution; however, I haven&#8217;t yet found it.  One solution which I&#8217;ve rejected is the &#8220;injecting an injector&#8221; solution:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> FooFactory <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">final</span> Injector injector<span style="color: #339933;">;</span>
&nbsp;
    @Inject
    <span style="color: #000000; font-weight: bold;">public</span> FooFactory<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> Injector injector<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
         <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">injector</span> <span style="color: #339933;">=</span> injector<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">public</span> Foo get<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">char</span> type, <span style="color: #000066; font-weight: bold;">boolean</span> inverted<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">switch</span> <span style="color: #009900;">&#40;</span>type<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #0000ff;">'A'</span><span style="color: #339933;">:</span>
            <span style="color: #000000; font-weight: bold;">return</span> injector.<span style="color: #006633;">createInstance</span><span style="color: #009900;">&#40;</span>TypeAFoo.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #0000ff;">'B'</span><span style="color: #339933;">:</span>
            <span style="color: #000000; font-weight: bold;">return</span> injector.<span style="color: #006633;">createInstance</span><span style="color: #009900;">&#40;</span>TypeBFoo.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #0000ff;">'C'</span><span style="color: #339933;">:</span>
            <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>inverted<span style="color: #009900;">&#41;</span>
                <span style="color: #000000; font-weight: bold;">return</span> injector.<span style="color: #006633;">createInstance</span><span style="color: #009900;">&#40;</span>TypeCAFoo.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">else</span>
                <span style="color: #000000; font-weight: bold;">return</span> injector.<span style="color: #006633;">createInstance</span><span style="color: #009900;">&#40;</span>TypeCBFoo.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #0000ff;">'D'</span><span style="color: #339933;">:</span>
            <span style="color: #000000; font-weight: bold;">return</span> injector.<span style="color: #006633;">createInstance</span><span style="color: #009900;">&#40;</span>TypeDFoo.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #0000ff;">'E'</span><span style="color: #339933;">:</span>
            <span style="color: #000000; font-weight: bold;">return</span> injector.<span style="color: #006633;">createInstance</span><span style="color: #009900;">&#40;</span>TypeEFoo.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">default</span><span style="color: #339933;">:</span>
            <span style="color: #000000; font-weight: bold;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> FooFactoryException<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Can't determine type.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The reason I&#8217;ve rejected this approach is that it prevents Guice from checking the entire dependency graph at boot &#8211; Guice doesn&#8217;t know which types you are going to create with the injector, and this <em>has</em> to defeat a lot of it&#8217;s validation magic.</p>
]]></content:encoded>
			<wfw:commentRss>http://eraserhead.net/2010/03/creating-boilerplate-with-google-guice/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making MSVC6 Crash</title>
		<link>http://eraserhead.net/2010/03/making-msvc6-crash/</link>
		<comments>http://eraserhead.net/2010/03/making-msvc6-crash/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 13:00:25 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[MSVC6]]></category>

		<guid isPermaLink="false">http://eraserhead.net/?p=116</guid>
		<description><![CDATA[I&#8217;ve been collecting these for a little while.  Since we are now well under way in migrating to VS2005, now is a good time to post them.
.\Components/CommComponents/FDMSInterleaveTcpipComm/Test_FDMSInterleaveTcpipComm.h(106) : fatal error C1001: INTERNAL COMPILER ERROR
        (compiler file 'msc1.cpp', line 1794)
         [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been collecting these for a little while.  Since we are now well under way in migrating to VS2005, now is a good time to post them.</p>
<pre>.\Components/CommComponents/FDMSInterleaveTcpipComm/Test_FDMSInterleaveTcpipComm.h(106) : fatal error C1001: INTERNAL COMPILER ERROR
        (compiler file 'msc1.cpp', line 1794)
         Please choose the Technical Support command on the Visual C++
         Help menu, or open the Technical Support help file for more information
</pre>
<p>was caused by:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">    <span style="color: #0000ff;">template</span><span style="color: #000080;">&lt;</span><span style="color: #0000ff;">typename</span> VersionPolicy<span style="color: #000080;">&gt;</span> <span style="color: #0000ff;">class</span> SVDotPacketProductionPolicy<span style="color: #008080;">;</span>
    <span style="color: #0000ff;">class</span> SVDotPacketProductionPolicy<span style="color: #000080;">&lt;</span>SV24VersionPolicy<span style="color: #000080;">&gt;</span><span style="color: #008080;">;</span>
    <span style="color: #0000ff;">friend</span> <span style="color: #0000ff;">class</span> SVDotPacketProductionPolicy<span style="color: #000080;">&lt;</span>SV24VersionPolicy<span style="color: #000080;">&gt;</span><span style="color: #008080;">;</span>
    <span style="color: #0000ff;">class</span> SVDotPacketProductionPolicy<span style="color: #000080;">&lt;</span>SV40VersionPolicy<span style="color: #000080;">&gt;</span><span style="color: #008080;">;</span>
    <span style="color: #0000ff;">friend</span> <span style="color: #0000ff;">class</span> SVDotPacketProductionPolicy<span style="color: #000080;">&lt;</span>SV40VersionPolicy<span style="color: #000080;">&gt;</span><span style="color: #008080;">;</span></pre></div></div>

<hr />
<pre>Include\boost/bind/arg.hpp(25) : fatal error C1001: INTERNAL COMPILER ERROR
        (compiler file 'msc1.cpp', line 1794)
         Please choose the Technical Support command on the Visual C++
         Help menu, or open the Technical Support help file for more information
</pre>
<p>This one started after I added</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#include &lt;boost/bind.hpp&gt;</span></pre></div></div>

<p> to a file and a simple, every-day use of <tt>boost::bind()</tt>.  Moving the <tt>#include</tt> directive up before a number of other standard includes resolved the issue.</p>
<pre>
C:\projects\DASV2>scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
cl /FoComponents\AuthComponents\Credit\CCMps\Release\Tests.obj /c Components\AuthComponents\Credit\CCMps\Release\Tests.cpp /nologo /
TP /nologo /MT /W2 /GX /GR /O2 /Zi /Zm200 /D "WIN32" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /FD /D "_WIN32_WINNT=0x0400" /D "_WIN32_DC
OM" /IWindowsSDK\Include /IInclude /Icryptlib /IXML\Xerces\src /I. /IComponents\AuthComponents\Credit\CCMps
Tests.cpp
Include\boost/function/function_template.hpp(514) : fatal error C1001: INTERNAL COMPILER ERROR
        (compiler file 'msc1.cpp', line 1794)
         Please choose the Technical Support command on the Visual C++
         Help menu, or open the Technical Support help file for more information
scons: *** [Components\AuthComponents\Credit\CCMps\Release\Tests.obj] Error 2
scons: building terminated because of errors.
</pre>
<p>06/01/2009 &#8211; This one was the result of passing a pointer to a static member function to <tt>boost::function1&lt;&gt;</tt>.</p>
<pre>
C:\projects\DASV2>scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
python.exe Utilities/CxxTest/cxxtestgen.py --runner=XmlPrinter --have-eh --have-std --check-memory -o CBase\ISOMsg\Debug\Tests.cpp CBase\ISOMsg\Test_Fields.h
cl /FoCBase\ISOMsg\Debug\Tests.obj /c CBase\ISOMsg\Debug\Tests.cpp /nologo /TP /nologo /MTd /Od /W2 /GX /GR /Zi /Zm200 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /FD /D "_WIN32_WINNT=0x0400" /D "_WIN32_DCOM" /D "DEBUG" /D "_DEBUG" /IWindowsSDK\Include /IInclude /Icryptlib /IXML\Xerces\src /I. /ICBase\ISOMsg
Tests.cpp
.\CBase/ISOMsg/Test_Fields.h(157) : fatal error C1001: INTERNAL COMPILER ERROR
        (compiler file 'msc1.cpp', line 1794)
         Please choose the Technical Support command on the Visual C++
         Help menu, or open the Technical Support help file for more information
scons: *** [CBase\ISOMsg\Debug\Tests.obj] Error 2
scons: building terminated because of errors.
</pre>
<p>06/18/2009 &#8211; This one is the result of attempting to use a template member of template class.  Here&#8217;s the (abbreviated) code:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">template</span><span style="color: #000080;">&lt;</span><span style="color: #0000ff;">typename</span> C, C v<span style="color: #000080;">&gt;</span>
<span style="color: #0000ff;">struct</span> ThreeArgConstructor
<span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">template</span><span style="color: #000080;">&lt;</span><span style="color: #0000ff;">class</span> BaseT<span style="color: #000080;">&gt;</span>
    <span style="color: #0000ff;">struct</span> Type <span style="color: #008080;">:</span> <span style="color: #0000ff;">public</span> BaseT
    <span style="color: #008000;">&#123;</span>
        Type<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> length<span style="color: #008000;">&#41;</span>
            <span style="color: #008080;">:</span> BaseT<span style="color: #008000;">&#40;</span>length, <span style="color: #FF0000;">&quot;TEST FIELD PACKAGER&quot;</span>, v<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span><span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">template</span><span style="color: #000080;">&lt;</span>
      BaseT
    , ConstructorT
    <span style="color: #000080;">&gt;</span>
<span style="color: #0000ff;">class</span> Foo
<span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">typedef</span> <span style="color: #0000ff;">typename</span> ConstructorT<span style="color: #008080;">::</span><span style="color: #0000ff;">template</span> Type<span style="color: #000080;">&lt;</span>BaseT<span style="color: #000080;">&gt;</span> TestPackager<span style="color: #008080;">;</span>
&nbsp;
    <span style="color: #0000ff;">void</span> run<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
        TestPackager<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">10</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">int</span> main<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
    Foo<span style="color: #000080;">&lt;</span>Bar, ThreeArgConstructor<span style="color: #000080;">&lt;</span><span style="color: #0000ff;">bool</span>, <span style="color: #0000ff;">false</span><span style="color: #000080;">&gt;</span> <span style="color: #000080;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>.<span style="color: #007788;">run</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://eraserhead.net/2010/03/making-msvc6-crash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make Work Visible</title>
		<link>http://eraserhead.net/2010/03/make-work-visible/</link>
		<comments>http://eraserhead.net/2010/03/make-work-visible/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 04:24:34 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Guerilla Software Recovery]]></category>
		<category><![CDATA[Patterns]]></category>

		<guid isPermaLink="false">http://eraserhead.net/?p=497</guid>
		<description><![CDATA[Context
A significant portion of your activities aren&#8217;t visible to your management, possibly because

you have become the &#8220;product expert&#8221; which consults with others or
your products&#8217; production deployments require significant developer attention
  
Therefore,
Divide your whiteboard up into columns representing your work flow (e.g. &#8220;Backlog,&#8221; &#8220;Ready&#8221;, &#8220;Develop&#8221;, &#8220;QA&#8221;, &#8220;Done&#8221;) and obtain a large supply of Post-It(tm) notes. [...]]]></description>
			<content:encoded><![CDATA[<h2>Context</h2>
<p>A significant portion of your activities aren&#8217;t visible to your management, possibly because
<ul>
<li>you have become the &#8220;product expert&#8221; which consults with others or
<li>your products&#8217; production deployments require significant developer attention
  </ul>
<h2>Therefore,</h2>
<p>Divide your whiteboard up into columns representing your work flow (e.g. &#8220;Backlog,&#8221; &#8220;Ready&#8221;, &#8220;Develop&#8221;, &#8220;QA&#8221;, &#8220;Done&#8221;) and obtain a large supply of Post-It(tm) notes.  Use separate colors for the items assigned to you by your management and the items which come to you as the domain expert.  If necessary, track enough information to build a cumulative flow diagram.</p>
<h2>Discussion</h2>
<p>There is something visceral about this approach that conveys understanding in a way which is not possible by explanation or discussion.  It may be the case that your management <em>knows</em> what is happening but doesn&#8217;t quite &#8220;<em>get it</em>.&#8221;</p>
<p>This is a minimum useful subset of <a href="http://limitedwipsociety.org/">software kanban</a> and an instance of &#8220;Information Radiator.&#8221;</p>
<p>A cumulative flow diagram can be created by simply counting the number of tickets in each bucket each morning and entering these into a spreadsheet in backwards order.  You can read your average work-in-process (WIP) and cycle time from this diagram, making it an incredibly inexpensive way to measure the amount of effort spent on visible work versus other work.</p>
<h2>Observed Instances</h2>
<h3>One</h3>
<p>[to be filled in]</p>
]]></content:encoded>
			<wfw:commentRss>http://eraserhead.net/2010/03/make-work-visible/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automate Release Checks</title>
		<link>http://eraserhead.net/2010/03/automate-release-checks/</link>
		<comments>http://eraserhead.net/2010/03/automate-release-checks/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 13:00:58 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Guerilla Software Recovery]]></category>
		<category><![CDATA[Patterns]]></category>
		<category><![CDATA[Process]]></category>

		<guid isPermaLink="false">http://eraserhead.net/?p=485</guid>
		<description><![CDATA[Context

Each release of your product has some unique aspect to it, for example an intended customer-specific configuration.
Releases of your product are frequently made which fail in some, though not necessarily always the same, downstream step.
Verifying correct operation of each build empirically is time consuming or costly.

Therefore

Write a program which is the simplest possible wrapper for [...]]]></description>
			<content:encoded><![CDATA[<h2>Context</h2>
<ul>
<li>Each release of your product has some unique aspect to it, for example an intended customer-specific configuration.
<li>Releases of your product are frequently made which fail in some, though not necessarily always the same, downstream step.
<li>Verifying correct operation of each build empirically is time consuming or costly.
</ul>
<h2>Therefore</h2>
<ol>
<li>Write a program which is the simplest possible wrapper for your release of the artifact consumed downstream.
<li>Each time a failure causes a flow interruption, modify the program to detect this problem with the artifact and fail loudly, refusing to produce the artifact.
</ol>
<h2>Discussion</h2>
<p>This pattern operates on the general principle that a shorter feedback loop for failures will have less negative effect on effort hours and throughput.  This is the same principle embodied by test-driven development applied in a slightly different context.  To build on the analogy, consider instituting a policy of adding the automated release check to your artifact-builder <em>before</em> correcting the downstream problem, and verifying the release check by attempting to release a new build without correcting the original problem.</p>
<p>This is a kind of test-driven development which is fed by downstream regressions.  It is an attempt to introduce a positive <a href="http://en.wikipedia.org/wiki/Ratchet_effect">rachet effect</a>.</p>
<p>If you do not have some unique aspect to each release, you could simply add unit tests which fail the build if in-repository artifacts are somehow inconsistent or incorrect.  Even though we don&#8217;t usually think to add unit tests to verify, say, properties of configuration files stored in the repository, these unit tests provide a tighter feedback loop than this pattern and should be preferred.</p>
<h2>Observed Instances</h2>
<h3>One</h3>
<p>We have a product where frequent, customer-specific releases are made to an independent QA department.  Two files are delivered, an installer exe and an ini file.  The ini file is read by the installer exe and causes the installer to install the correct components and install the proper configuration into the registry.  The install is a lengthy process (twenty minutes) on machines which have a lot of software installed, discouraging developers from running the installer.  Also, verifying correct operation requires setting up a protocol emulator which may not be available.</p>
<p>The ini file layout is very brittle.  It contains many options which must be consistent with other options.  There are also many options which must be specified for every component in the configuration.  Yet other options can cause some other options to be ignored entirely.  The install itself rarely fails, it leaves the machine configured in an unusable state instead.</p>
<p>A significant portion of my time was spent in the QA lab troubleshooting failed installs.  When I first started maintaining this software, it seemed like one third of a typical day might be spent in the QA lab.  Since QA is on an isolated network, I went through many thumb drives, not remembering which machine I had last left it in.</p>
<p>I wrote a wrapper for building the install after reading the ini file.  This also had the benefit of allowing us to remove unused components from an install.  For each failure found in QA, I made it fail loudly and abort before building an install if the problem was detected with the ini file.</p>
<p>I haven&#8217;t been in the QA lab in more than four months.  I have kept the same thumb drive for perhaps a year, though I&#8217;m no longer sure what&#8217;s on it.</p>
<p>This has had an unexpected compounding positive effect:  The most likely causes of an install failing are now either procedural or due to configuration changes made for testing in QA.  Previously, the most likely cause of an install failing was that it had been packaged incorrectly.  As a result of this shift, development is no longer the first on the scene of a failed install.  Instead, the techs responsible for deploying the software to the customer handle most QA installation issues.</p>
<p>It might seem that a more fundamental problem in this occurrence is the brittleness of the configuration format, that it admits self-inconsistency.  This is probably true; however, I could not determine a way to re-engineering the format piecemeal, and customer commitments (as well as time logged in the QA lab!) made such a large project unlikely on a maintenance-mode product.  Also, the current installer has all sorts of difficult-to-understand logic with undocumented intent.  This solution was truly cheap to get running.</p>
]]></content:encoded>
			<wfw:commentRss>http://eraserhead.net/2010/03/automate-release-checks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
