<?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>The Agile Micro ISV Blog &#187; Agile</title>
	<atom:link href="http://www.agilemicroisv.com/agile/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.agilemicroisv.com</link>
	<description>Small fish. Big pond.</description>
	<lastBuildDate>Thu, 22 Apr 2010 09:40:20 +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>Candles, by the Micro ISV</title>
		<link>http://www.agilemicroisv.com/2008/10/candles-by-the/</link>
		<comments>http://www.agilemicroisv.com/2008/10/candles-by-the/#comments</comments>
		<pubDate>Sat, 11 Oct 2008 16:10:42 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Micro ISV]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.agilemicroisv.com/2008/10/candles-by-the.html </guid>
		<description><![CDATA[Image via Wikipedia Required materials: Plain Paraffin Wax (about 1/2
pound) Double Boiler Wooden spoon Bowls for cold water Candle
thermometer Kitchen Stove Wick And the instructions: Cut the wax into
small pieces. Bring the water gently to the boil....
]]></description>
			<content:encoded><![CDATA[<p><span class="zemanta-img zemanta-action-click" style="margin: 1em; float: right; display: block;"><a href="http://commons.wikipedia.org/wiki/Image:Candle_stump_on_holder.jpg" rel="wp-prettyPhoto[g18]"><img src="archives_files/202px-Candle_stump_on_holder.jpg" alt="An almost burnt-down lit candle on a candle ho..." title="An almost burnt-down lit candle on a candle ho..." style="border: medium none ; display: block;" width="202" height="152"></a><span class="zemanta-img-attribution">Image via <a href="http://commons.wikipedia.org/wiki/Image:Candle_stump_on_holder.jpg" rel="wp-prettyPhoto[g18]">Wikipedia</a></span></span></p>
<p>Required materials:</p>
<ul>
<li>Plain Paraffin Wax (about 1/2 pound)</li>
<li>Double Boiler</li>
<li>Wooden spoon</li>
<li>Bowls for cold water</li>
<li>Candle thermometer</li>
<li>Kitchen Stove</li>
<li>Wick</li>
</ul>
<p>And the instructions:</p>
<ol>
<li>Cut the wax into small pieces.</li>
<li>Bring the water gently to the boil. Place wax in the double boiler.</li>
<li>Stir until the wax is melted. Once melted, try to keep the wax at 71C / 160F.</li>
<li>Cut the wick to the desired length, then dip into the wax. Allow the wax to cool between dippings for a minute or two. </li>
<li>Continue the dipping and cooling process. After a few dippings, you can speed up the process by dipping in cold water.</li>
<li>Repeat the process until the candle reaches the desired thickness.</li>
<li>When finished and cooled, cut a flat base on the candle.</li>
</ol>
<p>Et voila.</p>
<p>So what&#8217;s so interesting about candle dipping from the perspective of <a href="http://en.wikipedia.org/wiki/Software_development" title="Software development" rel="wikipedia" class="zem_slink">software development</a>?<br />
Well, after 1 dip, what do you have? Well, you have a piece of string<br />
covered in wax, neither use nor ornament. But after just a few dips,<br />
you will have the beginnings of a candle, albeit at this stage, a very<br />
slim one. So very quickly, we have something that could function as a<br />
working candle.</p>
<p>Then, over time, we add layers, additional wax, additional<br />
functionality. In time, this candle willl become an impressive church<br />
candle, with a good 4 or 5 inches in diameter. Just as your app, with<br />
very humble beginnings, will, with proper technique, become a very<br />
impressive app.</p>
<p>The use of candle dipping as a metaphor for software development is not new in the world of <a href="http://en.wikipedia.org/wiki/Agile_software_development" title="Agile software development" rel="wikipedia" class="zem_slink">Agile Software Development</a>.<br />
The essence is that we work in very small iterations, and we keep a<br />
working application available at all times, just as our candle could<br />
function as a candle at all times throughout its creation.<br />
Functionality, business value, mojo, whatever you want to call it, is<br />
added in vertical strips, just like in candle dipping. </p>
<p>If mojo is added in the order of business value, this process will,<br />
at all times, mean that your application will yield the highest <a href="http://en.wikipedia.org/wiki/Rate_of_return" title="Rate of return" rel="wikipedia" class="zem_slink">return on investment</a> possible at any given time.</p>
<fieldset class="zemanta-related">
<legend class="zemanta-related-title">Related articles by Zemanta</legend>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://www.theregister.co.uk/2008/10/10/aligndev_workshop_roundup3/">Agile Development&#8217;s Secret Sauce</a></li>
<li class="zemanta-article-ul-li"><a href="http://www.computerworld.com/action/article.do?command=viewArticleBasic&amp;articleId=317249&amp;source=rss_topic63">Agile Reality</a></li>
<li class="zemanta-article-ul-li"><a href="http://www.vator.tv/news/show/2008-02-25-guest-contributor-david-howard-agile-development-isnt-product-management">Guest contributor David Howard: Agile development isn&#8217;t product management</a></li>
<li class="zemanta-article-ul-li"><a href="http://www.feld.com/blog/archives/2008/04/agile_can_work.html">Agile Can Work For Your Whole Company</a></li>
<li class="zemanta-article-ul-li"><a href="http://ericbrown.com/agility-and-business.htm">Agility &amp; Business</a></li>
</ul>
</fieldset>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><img src="archives_files/pixy_006.gif" class="zemanta-pixie-img" style="border: medium none ; float: right;"></div>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.agilemicroisv.com%2F2008%2F10%2Fcandles-by-the%2F&amp;linkname=Candles%2C%20by%20the%20Micro%20ISV"><img src="http://www.agilemicroisv.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.agilemicroisv.com/2008/10/candles-by-the/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code As A Liability</title>
		<link>http://www.agilemicroisv.com/2008/03/code-as-a-liabi/</link>
		<comments>http://www.agilemicroisv.com/2008/03/code-as-a-liabi/#comments</comments>
		<pubDate>Tue, 11 Mar 2008 21:00:00 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.agilemicroisv.com/2008/03/code-as-a-liabi.html </guid>
		<description><![CDATA[Jim Shore asked recently about what metric might be used to measure
technical debt. Now, sigh and groans over the word 'metric' aside, his
first suggestion prompted some thought; namely, SLoC. This was
interesting, mostly because SLoC was once used...
]]></description>
			<content:encoded><![CDATA[<p><img src="archives_files/img_debt.gif" title="Img_debt" alt="Img_debt" style="margin: 0px 0px 5px 5px; float: right;" border="0"><a href="http://jamesshore.com/"><br />
Jim Shore</a> asked recently about what metric might be used to measure <a href="http://www.martinfowler.com/bliki/TechnicalDebt.html">technical debt</a>.<br />
Now, sigh and groans over the word &#8216;metric&#8217; aside, his first suggestion<br />
prompted some thought; namely, SLoC. This was interesting, mostly<br />
because SLoC was once used as a measure of productivity, but here it<br />
was something different. I didn&#8217;t like this idea, simply because it<br />
meant that no matter how hard you worked, how mercilessly you<br />
refactored, you would always be increasing technical debt. In other<br />
words, no matter what, you lose. I don&#8217;t find this appealing. We went<br />
around the houses a bit talking about using SLoC per feature, or SLoC<br />
per story point, but something very interesting came out of the<br />
discussion.
</p>
<p>As software developers, and particularly as a micro ISV, we would<br />
think of our code base as our biggest asset, but how often do we think<br />
of it as potentially our biggest liability? Why a liability? Because it<br />
costs money. It costs money for others to spend time understanding it<br />
(if you aren&#8217;t a 1 man band), it costs money to change it, it costs<br />
money to test it, to bugfix it, to refactor it, to add to it, to<br />
integrate it. These are the times that you will notice the interest<br />
payments on your technical debt.
</p>
<p>As a micro ISV, technical debt payments can be crippling. Imagine<br />
not being able to make use of you&#8217;re new employee because your code is<br />
too hard to understand, because it does not clearly express intent.<br />
Imagine not being able to add a new feature because you&#8217;re too worried<br />
about the impact on the stability of your codebase.
</p>
<p>The solution is clear. Don&#8217;t let technical debt accumulate to a<br />
level such that the interest paments become a barrier to progress. Your<br />
code is your greatest asset, don&#8217;t let it become your greatest<br />
liability.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.agilemicroisv.com%2F2008%2F03%2Fcode-as-a-liabi%2F&amp;linkname=Code%20As%20A%20Liability"><img src="http://www.agilemicroisv.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.agilemicroisv.com/2008/03/code-as-a-liabi/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Executable Specifications &#8211; Part 2</title>
		<link>http://www.agilemicroisv.com/2008/03/executable-spec/</link>
		<comments>http://www.agilemicroisv.com/2008/03/executable-spec/#comments</comments>
		<pubDate>Fri, 07 Mar 2008 23:40:13 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.agilemicroisv.com/2008/03/executable-spec.html </guid>
		<description><![CDATA[OK, it's time to get our hands dirty with a little coding. Following a
strong tradition of contrived examples, I'm going to develop a simple
stack class to demonstrate some of the techniques of using executable
specifications to drive the...
]]></description>
			<content:encoded><![CDATA[<p>OK, it&#8217;s time to get our hands dirty with a little coding. Following<br />
a strong tradition of contrived examples, I&#8217;m going to develop a simple<br />
stack class to demonstrate some of the techniques of using executable<br />
specifications to drive the functionality and design of the code base.<br />
For this example I&#8217;m going to use NSpec as the specification framework.<br />
We all know what a stack class is, right? It&#8217;s sort of a last in, first<br />
out (LIFO) collection.
</p>
<p>For the purposes of today, I&#8217;m going to say that the interface our stack class will support is as follows:<span style="font-family: Segoe UI; font-size: 9pt;">&nbsp;</span></p>
<p><span style="font-family: Segoe UI; font-size: 9pt;"><span style="color: rgb(16, 0, 160);">public</span><br />
<span style="color: rgb(16, 0, 160);">class</span><br />
<a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System:2.0.0.0:b77a5c561934e089/System.Collections.Generic.Stack%3c%3e"><span style="color: black;"><strong>Stack</strong></span></a>&lt;<strong>T</strong>&gt;<br />
</span></p>
<p><span style="font-family: Segoe UI; font-size: 9pt;">{<br />
</span></p>
<p><span style="font-family: Segoe UI; font-size: 9pt;"><br />
<span style="color: rgb(16, 0, 160);">public</span><br />
<a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System:2.0.0.0:b77a5c561934e089/System.Collections.Generic.Stack%3c%3e/.ctor%28%29"><span style="color: black;"><strong>Stack</strong></span></a>();<br />
</span></p>
<p><span style="font-family: Segoe UI; font-size: 9pt;"><br />
<span style="color: rgb(16, 0, 160);">public</span><br />
<a title="System.Void" href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Void"><span style="color: rgb(0, 96, 24);">void</span></a><br />
<a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System:2.0.0.0:b77a5c561934e089/System.Collections.Generic.Stack%3c%3e/Clear%28%29"><span style="color: black;"><strong>Clear</strong></span></a>();<br />
</span></p>
<p><span style="font-family: Segoe UI; font-size: 9pt;"><br />
<span style="color: rgb(16, 0, 160);">public</span><br />
<a title="System.Boolean" href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Boolean"><span style="color: rgb(0, 96, 24);">bool</span></a><br />
<a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System:2.0.0.0:b77a5c561934e089/System.Collections.Generic.Stack%3c%3e/Contains%28%3c%210%3e%29:Boolean"><span style="color: black;"><strong>Contains</strong></span></a>(T item);<br />
</span></p>
<p><span style="font-family: Segoe UI; font-size: 9pt;"><br />
<span style="color: rgb(16, 0, 160);">public</span> T <a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System:2.0.0.0:b77a5c561934e089/System.Collections.Generic.Stack%3c%3e/Peek%28%29:%3c%210%3e"><span style="color: black;"><strong>Peek</strong></span></a>();<br />
</span></p>
<p><span style="font-family: Segoe UI; font-size: 9pt;"><br />
<span style="color: rgb(16, 0, 160);">public</span> T <a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System:2.0.0.0:b77a5c561934e089/System.Collections.Generic.Stack%3c%3e/Pop%28%29:%3c%210%3e"><span style="color: black;"><strong>Pop</strong></span></a>();<br />
</span></p>
<p><span style="font-family: Segoe UI; font-size: 9pt;"><br />
<span style="color: rgb(16, 0, 160);">public</span><br />
<a title="System.Void" href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Void"><span style="color: rgb(0, 96, 24);">void</span></a><br />
<a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System:2.0.0.0:b77a5c561934e089/System.Collections.Generic.Stack%3c%3e/Push%28%3c%210%3e%29"><span style="color: black;"><strong>Push</strong></span></a>(T item);<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Segoe UI; font-size: 9pt;"><br />
<span style="color: gray;">// Properties</span><br />
</span></p>
<p><span style="font-family: Segoe UI; font-size: 9pt;"><br />
<span style="color: rgb(16, 0, 160);">public</span><br />
<a title="System.Int32" href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Int32"><span style="color: rgb(0, 96, 24);">int</span></a><br />
<a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System:2.0.0.0:b77a5c561934e089/System.Collections.Generic.Stack%3c%3e/property:Count:Int32"><span style="color: black;"><strong>Count</strong></span></a> { <span style="color: rgb(16, 0, 160);">get</span>; }<br />
</span></p>
<p><span style="font-family: Segoe UI; font-size: 9pt;">}<br />
</span></p>
<p>&nbsp;</p>
<p>Now, clearly we&#8217;re not going to win any awards for the class, but it should serve its purpose.
</p>
<p>So what are the first things we could say about it? Well, when the<br />
stack is empty, its Count should be zero, and trying to call Pop or<br />
Peek should cause an exception. So how might we write that in an<br />
executable specification? Well, let&#8217;s take the first one as an example:
</p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">using</span> NSpec.Framework;<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">namespace</span> Stack.Specs<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">{<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">[<span style="color: rgb(43, 145, 175);">Context</span>]<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">public</span><br />
<span style="color: blue;">class</span><br />
<span style="color: rgb(43, 145, 175);">WhenTheStackIsEmpty<br />
</span></span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; {<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: rgb(43, 145, 175);">Stack</span>&lt;<span style="color: blue;">int</span>&gt; _stack = <span style="color: blue;">new</span><br />
<span style="color: rgb(43, 145, 175);">Stack</span>&lt;<span style="color: blue;">int</span>&gt;();<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; [<span style="color: rgb(43, 145, 175);">Specification</span>]<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">public</span><br />
<span style="color: blue;">void</span> CountShouldBeZero()<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; {<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: rgb(43, 145, 175);">Specify</span>.That(_stack.Count).ShouldEqual(0);<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; }<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; }<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">}<br />
</span></p>
<p>That&#8217;s the simplest way of expressing that piece of behaviour. And<br />
I&#8217;ll need to implement just enough to make that code compile, and the<br />
spec fail. Here&#8217;s what I&#8217;m starting with:
</p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">namespace</span> Stack<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">{<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><br />
<span style="color: blue;">public</span><br />
<span style="color: blue;">class</span><br />
<span style="color: rgb(43, 145, 175);">Stack</span>&lt;T&gt;<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">{<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">public</span><br />
<span style="color: blue;">int</span> Count<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; {<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">get<br />
</span></span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">{<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">return</span> -1;<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; }<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; }<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">}<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">}<br />
</span></p>
<p>And firing up the spec runner, I get:
</p>
<p><img src="archives_files/030708_1638_ExecutableS1.png">
</p>
<p>But making the test pass is trivial, by changing the Count property to:
</p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">public</span><br />
<span style="color: blue;">int</span> Count <br /></span></p>
<p>{<span style="font-family: Courier New; font-size: 10pt;"><br /></span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="color: blue; font-family: Courier New; font-size: 10pt;">get<br /></span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">{<br /></span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">return</span> 0;<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">}<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">}</span>
</p>
<p><img src="archives_files/030708_1638_ExecutableS2.png">
</p>
<p>Don&#8217;t cry foul, we&#8217;re not done yet. What else did we say about an<br />
empty stack? We said calling pop or peek should cause an exception.<br />
Taking a bit of a short cut, specifying these two bits of behaviour:
</p>
<p><span style="font-family: Courier New; font-size: 10pt;">[<span style="color: rgb(43, 145, 175);">Specification</span>]<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">public</span><br />
<span style="color: blue;">void</span> PeekShouldThrowException()<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">{<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: rgb(43, 145, 175);">MethodThatThrows</span> mtt = <span style="color: blue;">delegate</span>()<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; {<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; _stack.Peek();<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; };<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: rgb(43, 145, 175);">Specify</span>.ThrownBy(mtt).ShouldBeOfType(<span style="color: blue;">typeof</span>(<span style="color: rgb(43, 145, 175);">InvalidOperationException</span>));<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">}<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New; font-size: 10pt;">[<span style="color: rgb(43, 145, 175);">Specification</span>]<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">public</span><br />
<span style="color: blue;">void</span> PopShouldThrowException()<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">{<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: rgb(43, 145, 175);">MethodThatThrows</span> mtt = <span style="color: blue;">delegate</span>()<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; {<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; _stack.Pop();<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; };<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: rgb(43, 145, 175);">Specify</span>.ThrownBy(mtt).ShouldBeOfType(<span style="color: blue;">typeof</span>(<span style="color: rgb(43, 145, 175);">InvalidOperationException</span>));<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">}<br />
</span></p>
<p>&nbsp;</p>
<p>These requirements can easily be met with:
</p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">public</span> T Peek()<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">{<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">throw</span><br />
<span style="color: blue;">new</span><br />
<span style="color: rgb(43, 145, 175);">InvalidOperationException</span>();<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">}<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">public</span> T Pop()<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">{<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">throw</span><br />
<span style="color: blue;">new</span><br />
<span style="color: rgb(43, 145, 175);">InvalidOperationException</span>();<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">}<br />
</span></p>
<p>&nbsp;</p>
<p>Now we have 3 passing specs. What else could we say? Well, when the<br />
stack has stuff in it, we&#8217;d like the count to be correct, we&#8217;d like to<br />
know whether it contains a particular item, we&#8217;d like to be able to<br />
clear it, and we&#8217;d like things to Pop and Peek in the right order. So<br />
let&#8217;s get started by adding a new Context, and a new spec method:
</p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">using</span> NSpec.Framework;<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">namespace</span> Stack.Specs<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">{<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; [<span style="color: rgb(43, 145, 175);">Context</span>]<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">public</span><br />
<span style="color: blue;">class</span><br />
<span style="color: rgb(43, 145, 175);">WhenTheStackContainsItems<br />
</span></span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; {<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: rgb(43, 145, 175);">Stack</span>&lt;<span style="color: blue;">int</span>&gt; _stack;<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; [<span style="color: rgb(43, 145, 175);">SetUp</span>]<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">public</span><br />
<span style="color: blue;">void</span> SetUp()<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; {<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;_stack = <span style="color: blue;">new</span><br />
<span style="color: rgb(43, 145, 175);">Stack</span>&lt;<span style="color: blue;">int</span>&gt;();<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;_stack.Push(0);<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;_stack.Push(1);<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;_stack.Push(2);<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; }<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; [<span style="color: rgb(43, 145, 175);">Specification</span>]<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">public</span><br />
<span style="color: blue;">void</span> CountShouldBeCorrect()<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; {<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: rgb(43, 145, 175);">Specify</span>.That(_stack.Count).ShouldEqual(3);<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; }<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; }<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">}<br />
</span></p>
<p>Now we&#8217;ve got some work to do. This doesn&#8217;t compile because we don&#8217;t have a Push method yet, so let&#8217;s add one:
</p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">using</span> System;<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">namespace</span> Stack<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">{<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">public</span><br />
<span style="color: blue;">class</span><br />
<span style="color: rgb(43, 145, 175);">Stack</span>&lt;T&gt;<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; {<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">int</span> _current = -1;<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; T[] _items = <span style="color: blue;">new</span> T[10];<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New; font-size: 10pt;"><br />
<span style="color: blue;">// Snip</span><br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">public</span><br />
<span style="color: blue;">void</span> Push(T item)<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; {<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;_current++;<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;_items[_current] = item;<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; }<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; }<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">}<br />
</span></p>
<p>&nbsp;</p>
<p>But shock! We have a failure.
</p>
<p><img src="archives_files/030708_1638_ExecutableS3.png">
</p>
<p>What went wrong? Oh that&#8217;s right, we cheated in our initial<br />
implementation of Count, so now it&#8217;s time to do it right. In the spirit<br />
of YAGNI (You Aint Gonna Need It) it&#8217;s almost always best to fake a<br />
method until you are forced to do it right.
</p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">public</span><br />
<span style="color: blue;">int</span> Count<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">{<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">get<br />
</span></span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; {<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">return</span> _current +1;<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; }<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">}<br />
</span></p>
<p>&nbsp;</p>
<p>4 green dots and 1 happy camper. So let&#8217;s move on to checking whether it contains a certain item:
</p>
<p><span style="font-family: Courier New; font-size: 10pt;">[<span style="color: rgb(43, 145, 175);">Specification</span>]<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">public</span><br />
<span style="color: blue;">void</span> ShouldNotContain999()<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">{<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: rgb(43, 145, 175);">Specify</span>.That(_stack.Contains(999)).ShouldBeFalse();<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">}<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New; font-size: 10pt;">[<span style="color: rgb(43, 145, 175);">Specification</span>]<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">public</span><br />
<span style="color: blue;">void</span> ShouldContainZeroOneAndTwo()<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">{<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: rgb(43, 145, 175);">Specify</span>.That(_stack.Contains(0)).ShouldBeTrue();<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: rgb(43, 145, 175);">Specify</span>.That(_stack.Contains(1)).ShouldBeTrue();<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: rgb(43, 145, 175);">Specify</span>.That(_stack.Contains(2)).ShouldBeTrue();<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">}<br />
</span></p>
<p>&nbsp;</p>
<p>And some implementation:
</p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">public</span><br />
<span style="color: blue;">bool</span> Contains(T item)<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">{<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">foreach</span> (T t <span style="color: blue;">in</span> _items)<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; {<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">if</span> (t.Equals(item))<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; {<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">return</span><br />
<span style="color: blue;">true</span>;<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; }<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; }<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">return</span><br />
<span style="color: blue;">false</span>;<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">}<br />
</span></p>
<p>&nbsp;</p>
<p>And we&#8217;re good, 8 green dots. What next? Let&#8217;d add support for clearing:
</p>
<p><span style="font-family: Courier New; font-size: 10pt;">[<span style="color: rgb(43, 145, 175);">Specification</span>]<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">public</span><br />
<span style="color: blue;">void</span> ClearShouldEmptyTheStack()<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">{<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; _stack.Clear();<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: rgb(43, 145, 175);">Specify</span>.That(_stack.Count).ShouldEqual(0);<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">}<br />
</span></p>
<p>&nbsp;</p>
<p>Red dot.
</p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">public</span><br />
<span style="color: blue;">void</span> Clear()<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">{<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; _current = -1;<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">}<br />
</span></p>
<p>&nbsp;</p>
<p>Green dot. Now on to the fun bits, peeking and popping:
</p>
<p><span style="font-family: Courier New; font-size: 10pt;">[<span style="color: rgb(43, 145, 175);">Specification</span>]<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">public</span><br />
<span style="color: blue;">void</span> ShouldPopThemInTheRightOrder()<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">{<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: rgb(43, 145, 175);">Specify</span>.That(_stack.Pop()).ShouldEqual(2);<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: rgb(43, 145, 175);">Specify</span>.That(_stack.Pop()).ShouldEqual(1);<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: rgb(43, 145, 175);">Specify</span>.That(_stack.Pop()).ShouldEqual(0);<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">}<br />
</span></p>
<p>&nbsp;</p>
<p>Again, our earlier short cuts are biting us, red dot. Let&#8217;s iron out the wrinkles:
</p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">public</span> T Pop()<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">{<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">if</span> (_current &gt; -1)<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; {<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; T popped = _items[_current];<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; _current&#8211;;<br />
</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">return</span> popped;<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; }<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">else<br />
</span></span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; {<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">throw</span><br />
<span style="color: blue;">new</span><br />
<span style="color: rgb(43, 145, 175);">InvalidOperationException</span>();<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; }<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">}<br />
</span></p>
<p>&nbsp;</p>
<p>And for the peeking:
</p>
<p><span style="font-family: Courier New; font-size: 10pt;">[<span style="color: rgb(43, 145, 175);">Specification</span>]<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">public</span><br />
<span style="color: blue;">void</span> PeekShouldReturnTopItem()<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">{<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: rgb(43, 145, 175);">Specify</span>.That(_stack.Peek()).ShouldEqual(2);<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; _stack.Pop();<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: rgb(43, 145, 175);">Specify</span>.That(_stack.Peek()).ShouldEqual(1);<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; _stack.Pop();<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: rgb(43, 145, 175);">Specify</span>.That(_stack.Peek()).ShouldEqual(0);<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">}<br />
</span></p>
<p>&nbsp;</p>
<p>This gives us the same problem as before, so, ironing again:
</p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">public</span> T Peek()<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">{<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">if</span> (_current &gt; -1)<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; {<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">return</span> _items[_current];<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; }<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">else<br />
</span></span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; {<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;">&nbsp;</span><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">throw</span><br />
<span style="color: blue;">new</span><br />
<span style="color: rgb(43, 145, 175);">InvalidOperationException</span>();<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">&nbsp; &nbsp; }<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;">}<br />
</span></p>
<p>&nbsp;</p>
<p><img src="archives_files/030708_1638_ExecutableS4.png">
</p>
<p>There, 15 shiny green dots. We have a rudimentary stack class with<br />
some pretty sever limitations, but in terms of the specifications,<br />
every time we build this code, every time we add to it, or refactor,<br />
every time we fix a bug, these specifications will be here, ready to be<br />
run. Don&#8217;t underestimate the confidence these kind of tests can bring<br />
to your micro ISV. Time is precious, and believe me, writing these<br />
specs once, will pay you back very quickly, as it drastically reduced<br />
repetitive, error prone manual checking later.</p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fwww.agilemicroisv.com%2f2008%2f03%2fexecutable-spec.html"><img alt="kick it on DotNetKicks.com" src="archives_files/KickItImageGenerator.png" border="0"></a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.agilemicroisv.com%2F2008%2F03%2Fexecutable-spec%2F&amp;linkname=Executable%20Specifications%20%26%238211%3B%20Part%202"><img src="http://www.agilemicroisv.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.agilemicroisv.com/2008/03/executable-spec/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Executable Specifications &#8211; Part 1</title>
		<link>http://www.agilemicroisv.com/2008/01/executable-spec-2/</link>
		<comments>http://www.agilemicroisv.com/2008/01/executable-spec-2/#comments</comments>
		<pubDate>Thu, 17 Jan 2008 05:49:33 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Micro ISV]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.agilemicroisv.com/2008/01/executable-spec-2.html </guid>
		<description><![CDATA["If you don't understand it, you can't program it. If you didn't
measure it, you didn't do it." To a Micro ISV, every activity counts.
24 hours in a day - Support, bugs, marketing, accounting, sleeping, it
all has to...
]]></description>
			<content:encoded><![CDATA[<p><img src="archives_files/notunderstand.jpg" title="Notunderstand" alt="Notunderstand" style="margin: 0px 0px 5px 5px; float: right;" border="0"></p>
<p><span style="font-size: 1.2em;">&#8220;If you don&#8217;t understand it, you can&#8217;t program it.</span></p>
<p><span style="font-size: 1.2em;">If you didn&#8217;t measure it, you didn&#8217;t do it.&#8221;</span></p>
<p>To a Micro ISV, every activity counts. 24 hours in a day -&nbsp;<br />
Support, bugs, marketing, accounting, sleeping, it all has to fit in.<br />
Since I stumbled into the Micro ISV world, blinking at the Sun, I&#8217;ve<br />
seen many strategies and tips for helping focus, purpose and<br />
productivity. But of all the activities undertaken by the micro ISV, it<br />
seems to be the act of writing software that receives the least<br />
attention. At least that&#8217;s how it seems to me.</p>
<p>I&#8217;ve seen many bright folk expounding the merits of fag packet<br />
design, sketches, notebooks and so on, but I don&#8217;t think I&#8217;ve seen<br />
anyone expound the merits of an executable specification.</p>
<p><span style="font-size: 1.2em;">What is an Executable Specification?</span></p>
<p>An<br />
executable specification is a group of software modules that specify<br />
the design and behaviour of your system. And because it is executable,<br />
you will know almost instantly your behaviour or design is broken.</p>
<p>There are many tools available for the production of executable<br />
specifications, although they&#8217;re seldom called that. Out of the Agile<br />
movement came Test Driven Development (TDD), with it&#8217;s unit tests and<br />
xUnit frameworks. The *only* problem with TDD when it is done well, is<br />
the nomenclature. Test Driven Development has nothing to do with<br />
testing. It is not a testing activity. It is a specification activity.<br />
And if done properly, the writing of these specifications will really<br />
boost your focus and productivity.</p>
<p>Conventional software development wisdom could be phrased as Design,<br />
Code, Test. Using a specification process like TDD or BDD (Behaviour<br />
Driven Development), the wisdom would more like Specify, Code, Design.<br />
I think it was Kent Beck (the originator of TDD) who paraphrased it as<br />
Red-Green-Refactor.</p>
<ol>
<li>Write a small, granular specification for the behaviour you are<br />
implementing. Run the specification to make sure it fails. It is<br />
*supposed* to fail, because you haven&#8217;t written the code to make it<br />
pass. <strong>Red light</strong>.</li>
<li>Write the code to implement the behaviour. Don&#8217;t worry about the<br />
design too much, just get the behaviour right. Now re-run your<br />
specification, ensure that it now passes. <strong>Green light</strong>.</li>
<li>You know understand enough about your behaviour to implement the<br />
best design. Here, we remove all duplication. We implement the simplest<br />
design to support the *current* level of functionality. <strong>Refactor</strong>.</li>
</ol>
<p>Your activities become extremely focused on the here and now. You&#8217;re<br />
not worried about the impact on your design that some future<br />
functionality might have. The red-green-refactor mantra will help keep<br />
your coding activities lean and mean.</p>
<p>There are numerous other benefits for the Micro ISV:</p>
<ul>
<li>Bugs don&#8217;t come back. To fix a bug, you write a specification<br />
that fails because of the bug. You then fix the bug in the familiar<br />
red-green-refactor mantra. If it ever comes back for some reason, your<br />
specification should show a red light.</li>
<li>Increase your confidence in your product.</li>
<li>Produces well designed code.</li>
<li>The no-duplication rule keeps maintenance costs to a minimum.</li>
<li>The specification suite serves as extremely good documentation<br />
should you take on more staff. Paper documents can lie. Code can&#8217;t.</li>
</ul>
<p>One of the important benefits is this &#8211; because you are keeping your<br />
design the simplest it can be for the *current* level of functionality,<br />
your RoI is always the highest it can be in terms of the value of the<br />
product. In other words, if you spend a week implementing architecture,<br />
or framework code to support future functionality, you have spent a<br />
week without adding value to your product, thus decreasing your RoI.</p>
<p>In part 2 we&#8217;ll look at an example specification for a simple class.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.agilemicroisv.com%2F2008%2F01%2Fexecutable-spec-2%2F&amp;linkname=Executable%20Specifications%20%26%238211%3B%20Part%201"><img src="http://www.agilemicroisv.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.agilemicroisv.com/2008/01/executable-spec-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Good Behaviour</title>
		<link>http://www.agilemicroisv.com/2007/10/good-behaviour/</link>
		<comments>http://www.agilemicroisv.com/2007/10/good-behaviour/#comments</comments>
		<pubDate>Mon, 08 Oct 2007 21:00:00 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dotnet]]></category>

		<guid isPermaLink="false">http://www.agilemicroisv.com/2007/10/good-behaviour.html </guid>
		<description><![CDATA[It's been an interesting couple of weeks for the NSpec project. For
readers who don't know what it is, it's a behaviour specification
framework for .Net, specifically targeted at practitioners of Behaviour
Driven Development. A while ago, myself and some...
]]></description>
			<content:encoded><![CDATA[<p><img src="archives_files/behave5.jpg" title="Behave5" alt="Behave5" style="margin: 0px 5px 5px 0px; float: left; width: 172px; height: 228px;" border="0"><br />
It&#8217;s been an interesting couple of weeks for the <a href="http://nspec.tigris.org/">NSpec</a><br />
project. For readers who don&#8217;t know what it is, it&#8217;s a behaviour<br />
specification framework for .Net, specifically targeted at&nbsp;<br />
practitioners of <a href="http://behabiourdriven.org/">Behaviour Driven Development</a>. A while ago,&nbsp; myself and some other active members of the BDD .Net community agreed to merge <a href="http://nspec.tigris.org/">NSpec</a> with <a href="http://nbehave.org/">NBehave,</a> a cousin in the BDD .Net arena.</p>
<p><a href="http://blog.agilejoe.com/">Joe Ocampo</a> has spearheaded<br />
the integration, and I&#8217;m happy to confirm that the integration is<br />
complete, and NSpec itself will soon cease to be. Long live NBehave.</p>
<p>It&#8217;s new home is <a href="http://www.codeplex.com/NBehave/">here.</a></p>
<p>Microsoft have also offered to sponsor the project, which is mighty nice of them.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.agilemicroisv.com%2F2007%2F10%2Fgood-behaviour%2F&amp;linkname=Good%20Behaviour"><img src="http://www.agilemicroisv.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.agilemicroisv.com/2007/10/good-behaviour/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Three Colours Agile</title>
		<link>http://www.agilemicroisv.com/2007/07/three-colours-a/</link>
		<comments>http://www.agilemicroisv.com/2007/07/three-colours-a/#comments</comments>
		<pubDate>Sat, 21 Jul 2007 04:53:01 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.agilemicroisv.com/2007/07/three-colours-a.html </guid>
		<description><![CDATA[I like the notion of "early RoI" and "metronomic delivery" forming part
of a black box definition of Agile. The black box definition seems to
be an embodiment of the customer's bill of rights. Therefore, to a
customer, a development...
]]></description>
			<content:encoded><![CDATA[<div style="direction: ltr;"><img title="23272176" alt="23272176" src="archives_files/23272176.jpg" style="margin: 0px 25px 5px 0px; float: left;" border="0">I<br />
like the notion of &#8220;early RoI&#8221; and &#8220;metronomic delivery&#8221; forming part<br />
of a black box definition of Agile. The black box definition seems to<br />
be an embodiment of the customer&#8217;s bill of rights. Therefore, to a<br />
customer, a development method could be considered Agile if&#8230;</div>
<ul>
<li>
<div style="direction: ltr;">It allows the customer to plan on a large scale with costs and options.</div>
</li>
<li>
<div style="direction: ltr;">It allows the customer to set development priorities weekly.</div>
</li>
<li>
<div style="direction: ltr;">It allows the customer to see progress<br />
in the form of a working system at the end of the first week, and to<br />
see a little more functionality every week thereafter.</div>
</li>
<li>
<div style="direction: ltr;">It allows the customer to get updates on the schedule, good or bad, as soon as the information is available.</div>
</li>
<li>
<div style="direction: ltr;">It allows the customer to change his/her mind without paying exorbitant costs.</div>
</li>
</ul>
<p style="direction: ltr;">So in theory, to a customer, nothing else should matter, as long as the process seems agile to them.</p>
<p style="direction: ltr;">To a Manager, we have the grey box. So a development method is Agile if&#8230;</p>
<ul>
<li>
<div style="direction: ltr;">It affords the manager an overall estimate of costs and results, recognising that reality will be different.</div>
</li>
<li>
<div style="direction: ltr;">It allows the manager to move people between projects without paying exorbitant costs.</div>
</li>
<li>
<div style="direction: ltr;">It allows the manager to get monthly updates of progress, and to help the customer set overall priorities.</div>
</li>
<li>
<div style="direction: ltr;">The manager has the right to cancel the project and be left with a working system reflecting the investment to date.</div>
</li>
</ul>
<p style="direction: ltr;">To a developer, we have the white box view of Agile. So to them, a development method is agile if&#8230;</p>
<ul>
<li>
<div style="direction: ltr;">It allows the programmer to estimate work and have those estimates respected by the rest of the team.</div>
</li>
<li>
<div style="direction: ltr;">It allows the programmer to honestly report progress.</div>
</li>
<li>
<div style="direction: ltr;">It allows the programmer to produce high-quality work at all times.</div>
</li>
<li>
<div style="direction: ltr;">It allows the programmer to know what is most important to work on next.</div>
</li>
<li>
<div style="direction: ltr;">It allows the programmer to ask business-oriented questions whenever they arise.</div>
</li>
</ul>
<p style="direction: ltr;">Each of the definitions is inadequate in<br />
itself. Perhaps we need to acknowledge that Agile looks different from<br />
different angles.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.agilemicroisv.com%2F2007%2F07%2Fthree-colours-a%2F&amp;linkname=Three%20Colours%20Agile"><img src="http://www.agilemicroisv.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.agilemicroisv.com/2007/07/three-colours-a/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SaaS and the Agile Release Plan</title>
		<link>http://www.agilemicroisv.com/2007/07/saas-and-the-ag/</link>
		<comments>http://www.agilemicroisv.com/2007/07/saas-and-the-ag/#comments</comments>
		<pubDate>Wed, 18 Jul 2007 04:38:42 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Marketing]]></category>
		<category><![CDATA[Micro ISV]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.agilemicroisv.com/2007/07/saas-and-the-ag.html </guid>
		<description><![CDATA[I've written previously about the benefits of metronomic release
schedules; benefits for customer and vendor alike. It seems there is a
growing acceptance in the industry of a subscription model, as opposed
to a purchase model for software products and...
]]></description>
			<content:encoded><![CDATA[<p><img title="Metronome" alt="Metronome" src="archives_files/metronome.jpg" style="margin: 0px 5px 5px 0px; float: left; width: 173px; height: 170px;" border="0" width="173" height="170"><br />
I&#8217;ve written previously about the benefits of metronomic release<br />
schedules; benefits for customer and vendor alike. It seems there is a<br />
growing acceptance in the industry of a subscription model, as opposed<br />
to a purchase model for software products and services; <strong>Software as a Service</strong>. </p>
<p>For everyone to benefit, </p>
<ul>
<li><strong>You</strong>, the vendor have to plan your releases and release with <strong>metronomic regularity</strong>; compare the delays with Vista to the 6 monthly releases of Ubuntu.</li>
<li>Push small increments out to your customers. Perhaps every month,<br />
or every 3 months. This will depend on how big your application is, and<br />
how much you can automate the upgrade (at least for desktop apps)</li>
<li>Get out of the 1.0 &#8211; 2.0 mindset. Let your product grow <strong>organically</strong>, and let your customers see it doing so.</li>
</ul>
<p>Frequent small releases are a great way to make your product seem really alive &#8211; it has a <strong>heartbeat</strong>. It also gets you a regular dose of the key ingredient &#8211; feedback. Regular <strong>feedback</strong><br />
allows us to provide regular, iterative enhancements, not big bang<br />
feature drops. When we drive from A to B, we don&#8217;t point the car and<br />
accelerate, we make small iterative corrections to the direction and<br />
speed of the car based on the feedback we get from our senses; software<br />
is very similar in this regard.</p>
<p>SaaS has been around for a while, but it&#8217;s only recently that I&#8217;ve<br />
seen SaaS really getting talked about in Desktop application circles.<br />
Hopefully, we&#8217;ll see the adoption of this approach across Shareware and<br />
larger enterprise apps.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.agilemicroisv.com%2F2007%2F07%2Fsaas-and-the-ag%2F&amp;linkname=SaaS%20and%20the%20Agile%20Release%20Plan"><img src="http://www.agilemicroisv.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.agilemicroisv.com/2007/07/saas-and-the-ag/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
