<?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>Eyefodder &#187; Quality Software</title>
	<atom:link href="http://eyefodder.com/category/engineering/quality-software/feed" rel="self" type="application/rss+xml" />
	<link>http://eyefodder.com</link>
	<description></description>
	<lastBuildDate>Sat, 26 Aug 2017 21:12:17 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>Code Coverage — a simple Rails example</title>
		<link>http://eyefodder.com/2014/09/code-coverage-setup-rails.html</link>
		<comments>http://eyefodder.com/2014/09/code-coverage-setup-rails.html#comments</comments>
		<pubDate>Thu, 18 Sep 2014 13:13:40 +0000</pubDate>
		<dc:creator><![CDATA[Paul Barnes-Hoggett]]></dc:creator>
				<category><![CDATA[Agile Software Development]]></category>
		<category><![CDATA[Continuous Integration]]></category>
		<category><![CDATA[Engineering]]></category>
		<category><![CDATA[Quality Software]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Software Craftsmanship]]></category>
		<category><![CDATA[Test Driven Development]]></category>

		<guid isPermaLink="false">http://eyefodder.com/?p=208</guid>
		<description><![CDATA[<p>My tests are my safety net. With them I can refactor with confidence, knowing that I&#8217;m keeping the functionality I intended. With them, I can grow my codebase, knowing that I&#8217;m not introducing regression errors. How do I have confidence that my safety net is good enough? One metric I can use to help with this [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://eyefodder.com/2014/09/code-coverage-setup-rails.html">Code Coverage — a simple Rails example</a> appeared first on <a rel="nofollow" href="http://eyefodder.com">Eyefodder</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>My tests are my safety net. With them I can refactor with confidence, knowing that I&#8217;m keeping the functionality I intended. With them, I can grow my codebase, knowing that I&#8217;m not introducing regression errors. How do I have confidence that my safety net is good enough? One metric I can use to help with this is code coverage. It answers the question “When I run my tests, how much of my application code executed?”. It&#8217;s a somewhat crude metric—telling me how broad the net is not how strong—but it’s a good place to start. Fortunately, setting it up on a rails project is pretty simple.</p>
<div id="attachment_217" style="width: 550px" class="wp-caption alignnone"><a href="http://upload.wikimedia.org/wikipedia/commons/3/35/Group_of_Circus_Performers_WDL10692.png"><img class="size-large wp-image-217" src="http://eyefodder.com/wp-content/uploads/2014/09/Group_of_Circus_Performers_WDL10692-1024x747.png" alt="circus perfomers in a safety net" width="540" height="393" /></a><p class="wp-caption-text">See how happy people are when they have a safety net?</p></div>
<p><span id="more-208"></span></p>
<h2>Getting Started</h2>
<p>I&#8217;ve made a simple example app that shows code coverage in action. Check out the source code from the <code>code_coverage</code> branch of my <a href="https://github.com/eyefodder/spex" target="_blank">spex</a> repository:</p>
<pre class="brush: bash; gutter: false; title: ; notranslate">

git clone -b code_coverage --single-branch https://github.com/eyefodder/spex.git

</pre>
<p>Now go to the <code>ops</code> directory and run <code>vagrant up</code> To get the virtual machine running. Next, let&#8217;s hop into the virtual machine and run the test suite:</p>
<pre class="brush: bash; gutter: false; title: ; notranslate">
vagrant ssh
...some output...
vagrant@spex:~$ cd /app
vagrant@spex:~$ rspec

</pre>
<p>Now, check out the reports folder. You&#8217;ll see that there is a <code>coverage/rcov</code> folder. Open the index file in the browser and you see an easy to digest code coverage report:<br />
<a href="http://eyefodder.com/wp-content/uploads/2014/09/Screen-Shot-2014-09-17-at-10.08.41-AM.png"><img class="alignnone size-large wp-image-219" src="http://eyefodder.com/wp-content/uploads/2014/09/Screen-Shot-2014-09-17-at-10.08.41-AM-1024x617.png" alt="code coverage report" width="540" height="325" /></a><br />
Pretty nifty huh? You can click on the rows in the table to see each class in more detail, and find out exactly which lines aren&#8217;t being executed:<br />
<a href="http://eyefodder.com/wp-content/uploads/2014/09/Screen-Shot-2014-09-17-at-10.15.28-AM.png"><img class="alignnone size-large wp-image-221" src="http://eyefodder.com/wp-content/uploads/2014/09/Screen-Shot-2014-09-17-at-10.15.28-AM-1024x826.png" alt="code coverage metrics for a single file" width="540" height="435" /></a><br />
Let&#8217;s take a look at how this was all set up&#8230;</p>
<h2>Code Coverage Gems</h2>
<p>First up, we need to add a couple of gems to the <code>Gemfile</code>:</p>
<pre class="brush: ruby; first-line: 59; title: ; notranslate">
  # code_coverage
  gem 'simplecov', :require =&gt; false
  gem 'simplecov-rcov', :require =&gt; false
</pre>
<p>Once we&#8217;ve run a <code>bundle install</code>, our next step is to configure our test suite to generate coverage reports.</p>
<h2>Configuring Code Coverage</h2>
<p>This, again is a pretty simple affair. We need to launch SimpleCov before any application code has run, so we have this code at the top of the <code>spec/spec_helper.rb</code></p>
<pre class="brush: ruby; title: ; notranslate">
if ENV['GENERATE_COVERAGE_REPORTS'] == 'true'
  require 'simplecov'
  require 'simplecov-rcov'
  SimpleCov.start 'rails' do
    coverage_dir ENV['CI_COVERAGE_REPORTS']
  end
  SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
end
</pre>
<p>There&#8217;s a few things happening here. We have a couple of environment variables that tell us if we should create reports: <code>GENERATE_COVERAGE_REPORTS</code> and if we do, where we should put them: <code>CI_COVERAGE_REPORTS</code>. If you&#8217;ve followed my earlier post on getting <a title="Getting Growl notifications from your Virtual Machine" href="http://eyefodder.com/2014/09/growl-guard-virtual-machine.html">Guard to send Growl</a> notifications, you will know to find these in <code>ops/dotfiles/guest_bash_profile</code> which is a profile automatically generated when we launch the virtual machine with <code>vagrant up</code>. If not, well, now you do!<br />
The next thing you&#8217;ll notice is the <code>SimpleCov.start 'rails'</code> call on line 4. This configures SimpleCov to have a profile that is good for most Rails applications. For example, the <code>spec</code> and <code>config</code> folders are excluded from coverage stats. You can read more about profiles <a href="https://github.com/colszowka/simplecov#profiles">here</a>.<br />
Finally, we tell SimpleCov that we want to format our results with the <code>SimpleCov::Formatter::RcovFormatter</code>. When we get to running our build as part of a <a href="http://en.wikipedia.org/wiki/Continuous_integration">continuous integration</a> process with <a href="http://jenkins-ci.org/">Jenkins</a>, we can use this format to parse results to be viewed in the dashboard.</p>
<h2>Viewing Code Coverage Reports generated on a Guest VM</h2>
<p>The last thing we have to deal with is the fact that the reports are generated on the guest virtual machine. In our <a title="Using Puppet and Vagrant to make a one-click development environment" href="http://eyefodder.com/2014/08/one-click-development-environment.html">existing setup</a>, we use <code>rsync</code> to push code changes from the host to the virtual machine. But this only works one way, and if we add content within the virtual machine you won&#8217;t see them on the host. We solve this with these lines in the <code>Vagrantfile</code></p>
<pre class="brush: ruby; first-line: 21; title: ; notranslate">
  config.vm.synced_folder '../reports', '/reports'
  config.vm.synced_folder &quot;../&quot;, &quot;/app&quot;, type: &quot;rsync&quot;, rsync__exclude: [&quot;.git/&quot;, &quot;ops/*&quot;, &quot;reports/&quot;, &quot;tmp/&quot;, &quot;log/&quot;, &quot;.#*&quot;]
</pre>
<p>What this does is exclude the <code>reports</code> from the main <code>rsync</code> and instead setup a new (regular) shared folder that will map <code>reports</code> to <code>/reports</code> on the virtual machine (note this is a root level folder, not in the <code>/app</code> folder on the guest. This is why we have used an environment variable to tell SimpleCov where to output reports.</p>
<h2>Beware the emperor&#8217;s new code coverage</h2>
<p><a href="http://commons.wikimedia.org/wiki/File:Page_45_illustration_in_fairy_tales_of_Andersen_(Stratton).png"><img class="alignnone size-large wp-image-222" src="http://eyefodder.com/wp-content/uploads/2014/09/emperors_new_clothes-754x1024.png" alt="emperors_new_clothes" width="540" height="733" /></a></p>
<p>One thing to bear in mind is that code coverage really is a very crude metric. There are different types of coverage metrics, and SimpleCov only provides &#8216;C0&#8242; coverage: lines of code that executed. Other types include <a href="http://www.bignerdranch.com/blog/code-coverage-and-ruby-1-9/" target="_blank">branch and path</a> coverage, but as far as I know, there aren&#8217;t any tools for these in Ruby. Let me show you an example of where this falls down:</p>
<p><a href="http://eyefodder.com/wp-content/uploads/2014/09/Screen-Shot-2014-09-17-at-10.15.28-AM.png"><img class="alignnone size-large wp-image-221" src="http://eyefodder.com/wp-content/uploads/2014/09/Screen-Shot-2014-09-17-at-10.15.28-AM-1024x826.png" alt="code coverage metrics for a single file" width="540" height="435" /></a></p>
<p>If you look at this report, we can see that the <code>some_method_with_conditionals</code> gets called, but only the <code>say_yes</code> path (lines 12 and 13) executes, and we never confirm that &#8216;no&#8217; gets sent if we pass <code>false</code> to the method. So far, so good, until we look at <code>some_method_with_ternary</code>. This is basically the same method refactored to be more compact, and with the same tests run against it. Yet we are told it is totally covered. So is the metric even still useful?</p>
<p>I still think code coverage is a valuable metric, if only to show you where there are holes in your test suite. If you go in with this knowledge and understanding the limitations, then you will be better equipped to maintain the quality of your app over time.</p>
<h2>Code Coverage is a temporal metric</h2>
<p>The last thing I want to mention about code coverage is that it&#8217;s useful to understand how your coverage changes over time. Particularly if you are managing a team of developers, it provides a quick warning if developers are slipping on their test writing. If you have a Continuous Integration machine, you can track these sort of metrics over time, which can really help you get a sense of where things are headed.<br />
In my next post I&#8217;ll show how to set up your very own CI machine with just a few clicks&#8230;</p>
<p>The post <a rel="nofollow" href="http://eyefodder.com/2014/09/code-coverage-setup-rails.html">Code Coverage — a simple Rails example</a> appeared first on <a rel="nofollow" href="http://eyefodder.com">Eyefodder</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://eyefodder.com/2014/09/code-coverage-setup-rails.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Growl notifications from your Virtual Machine</title>
		<link>http://eyefodder.com/2014/09/growl-guard-virtual-machine.html</link>
		<comments>http://eyefodder.com/2014/09/growl-guard-virtual-machine.html#comments</comments>
		<pubDate>Sun, 07 Sep 2014 19:07:17 +0000</pubDate>
		<dc:creator><![CDATA[Paul Barnes-Hoggett]]></dc:creator>
				<category><![CDATA[Agile Software Development]]></category>
		<category><![CDATA[Engineering]]></category>
		<category><![CDATA[Quality Software]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Software Craftsmanship]]></category>
		<category><![CDATA[Test Driven Development]]></category>

		<guid isPermaLink="false">http://eyefodder.com/?p=197</guid>
		<description><![CDATA[<p>As I develop I have Guard running in the background, executing my tests when things change. But I often don&#8217;t have the Terminal window front and centre, so I like to have Growl notifications for my test results. Setting up Growl to push notifications from the Virtual Machine to the host is a little tricky, so here&#8217;s a [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://eyefodder.com/2014/09/growl-guard-virtual-machine.html">Getting Growl notifications from your Virtual Machine</a> appeared first on <a rel="nofollow" href="http://eyefodder.com">Eyefodder</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>As I develop I have <a title="Getting Started with Guard and RSpec" href="http://eyefodder.com/2014/09/guard-and-rspec.html">Guard running in the background</a>, executing my tests when things change. But I often don&#8217;t have the Terminal window front and centre, so I like to have Growl notifications for my test results. Setting up Growl to push notifications from the Virtual Machine to the host is a little tricky, so here&#8217;s a simple example to show how to do it.</p>
<div id="attachment_199" style="width: 544px" class="wp-caption alignnone"><a href="http://en.wikipedia.org/wiki/Old_Ephraim"><img class="size-full wp-image-199" src="http://eyefodder.com/wp-content/uploads/2014/09/Ursus_arctos_Dessin_ours_brun_grand.jpg" alt="Growl isn't as hairy as 'Old Ephraim' but is probably more useful" width="534" height="336" /></a><p class="wp-caption-text">Growl isn&#8217;t as hairy as &#8216;old Ephraim&#8217; but is probably more useful</p></div>
<p><span id="more-197"></span></p>
<h2>Getting Started</h2>
<p>To get started and see Growl notifications, we need to do a little more than normal. Let&#8217;s start by checking out the source code:</p>
<pre class="brush: bash; gutter: false; title: ; notranslate">

git clone -b guard_growl --single-branch https://github.com/eyefodder/spex.git

</pre>
<h3>Prepping Growl</h3>
<p>Download <a href="http://growl.info/" target="_blank">Growl</a> if you don&#8217;t already have it. Once it&#8217;s installed, open up the preferences pane and click on the &#8216;network&#8217; panel. Check the box marked &#8216;Listen for incoming notifications&#8217; and enter a password:<br />
<a href="http://eyefodder.com/wp-content/uploads/2014/09/Screen-Shot-2014-09-06-at-11.06.13-AM.png"><img class="alignnone size-large wp-image-201" src="http://eyefodder.com/wp-content/uploads/2014/09/Screen-Shot-2014-09-06-at-11.06.13-AM-1024x1006.png" alt="Screen Shot 2014-09-06 at 11.06.13 AM" width="540" height="530" /></a></p>
<h3>Prepping Vagrant</h3>
<p>The next thing we need to do is install a plugin for Vagrant that will allow us to execute a script <em>on the host machine</em> when we boot our virtual machine. I&#8217;ll explain what that is below the fold, but for now, make sure that you have Vagrant 1.6.4 or above (hint, type <code>vagrant -v</code> to find out) and update if necessary. Next, install the <a href="https://github.com/emyl/vagrant-triggers" target="_blank">Vagrant Triggers</a> plugin by entering this on the command line:</p>
<pre class="brush: bash; gutter: false; title: ; notranslate">
$ vagrant plugin install vagrant-triggers
</pre>
<h3>Bringing the virtual machine up</h3>
<p>Next, run <code>vagrant up</code> as usual. When it runs, it creates a file <code>ops/dotfiles/guest_bash_profile</code>:</p>
<pre class="brush: bash; title: ; notranslate">
# Edit the following values with your own values

# Growl password set in Growl &gt; Preferences &gt; Network
export GROWL_PASSWORD=enter_growl_password

# The following entries are automatically generated
# Do not edit unless you know what you are doing!
# They are regenerated each time the virtual machine is rebooted
export HOST_IP=10.0.1.28

</pre>
<p>Go ahead and enter your Growl password. Now we&#8217;re good to go. run <code>vagrant rsync-auto</code> to keep things in sync and in another window, then <code>vagrant ssh</code> into the machine.</p>
<h3>Hey presto! Growl notifications</h3>
<p>So let&#8217;s get up and running! When you are ssh&#8217;d into the host machine, fire up Guard with <code>cd /app &amp;&amp; bundle exec guard -p</code>. Make a change to your code and when the tests run you should see a notification:<br />
<a href="http://eyefodder.com/wp-content/uploads/2014/09/Screen-Shot-2014-09-06-at-11.52.50-AM.png"><img class="alignnone size-large wp-image-202" src="http://eyefodder.com/wp-content/uploads/2014/09/Screen-Shot-2014-09-06-at-11.52.50-AM-1024x414.png" alt="Growl Notification" width="540" height="218" /></a><br />
You&#8217;re good to go now, but read on if you&#8217;d like to understand how all this stuff works&#8230;</p>
<h2>How it works</h2>
<p>There are a lot of moving parts to get this thing going. I&#8217;m going to work from the Guardfile back, and then the Vagrantfile forwards. I guess we&#8217;ll meet somewhere in the middle so bear with me.</p>
<h3>Guardfile changes</h3>
<p>If you look in the Guardfile you will see a few new lines of code at the top:</p>
<pre class="brush: ruby; first-line: 15; title: ; notranslate">
host_ip = ENV['HOST_IP']
growl_pass = ENV['GROWL_PASSWORD']
PLACEHOLDER_GROWL_PASS='enter_growl_password'

if host_ip.blank? || growl_pass.blank? || (growl_pass==PLACEHOLDER_GROWL_PASS)
  puts 'host notifcations off: you must set HOST_IP and GROWL_PASSWORD in ops/dotfiles/guest_bash_profile'
  notification :off
else
  notification :gntp, :sticky =&gt; false, :host =&gt; ENV['HOST_IP'], :password =&gt; ENV['GROWL_PASSWORD']
end
</pre>
<p>Line 23 tells Guard to use GNTP for notifications (assuming HOST_IP and GROWL_PASSWORD have been set). It&#8217;s basically a means for sending Growl notifications over a network. You&#8217;ll need to add the GNTP gem, so we&#8217;ve added this to our Gemfile:</p>
<pre class="brush: ruby; first-line: 49; title: ; notranslate">
  # guard_growl
  gem 'ruby_gntp'
</pre>
<p>We can see that this system relies on a couple of environment variables being set. We got a clue that these get set in <code>ops/dotfiles/guest_bash_profile</code>, let&#8217;s see how that file gets created, and how we get that linked into the guest Virtual Machine.</p>
<h3>Creating the guest bash profile</h3>
<p>For this setup to work, we need two environment variables set: GROWL_PASSWORD and HOST_IP. The script that creates the file is <code>ops/setup_guest_bash_profile</code>. This script does a few things, so let&#8217;s step through it:</p>
<h4>Create a profile file if it doesn&#8217;t exist</h4>
<p>The first thing we want to do is create a profile file if one doesn&#8217;t exist already:</p>
<pre class="brush: bash; first-line: 42; title: ; notranslate">
# make a profile file if it doesn't exist
bash_file=dotfiles/guest_bash_profile
touch $bash_file
</pre>
<p>Next, we want to add some comments to the file. As we will run this script <em>every time the machine boots up</em> we only really want to add these comments if they don&#8217;t already exist. The <code>add_comments_once</code> function does this by checking for a match, and only adding the comment if it isn&#8217;t already in the file:</p>
<pre class="brush: bash; first-line: 7; title: ; notranslate">
add_comment_once(){
  comment=$1
  grep -q &quot;$comment&quot; $bash_file
  if [ $? -ne 0 ]
  then
    echo &quot;# $comment&quot; &gt;&gt; $bash_file
  fi
}
</pre>
<h4>Adding a bash entry for users to change</h4>
<p>Next thing we want to do is add environment variables for users to change. But as this code is run multiple times, we actually have three scenarios:</p>
<ul>
<li>An entry doesn&#8217;t yet exist in the file: create it</li>
<li>An entry exists but hasn&#8217;t been changed from the default: tell user to change it</li>
<li>A user has entered their own value: don&#8217;t do a thing!</li>
</ul>
<p>The <code>add_bash_entry</code> function achieves this:</p>
<pre class="brush: bash; first-line: 16; title: ; notranslate">
add_bash_entry(){
  token=$1
  default=$2
  change_message=&quot;You need to enter your $1 in $bash_file&quot;
  entry_comment=$3

  grep -q $token= $bash_file
  if [ $? -eq 0  ]
  then
    grep -q $default $bash_file
    if [ $? -eq 0 ]
    then
      # entry exists, but it's set to default value from this script
      echo $change_message
    fi
  else
    # variable entry doesn't exist
    echo $change_message
    echo $entry_comment
    echo &quot;&quot; &gt;&gt; $bash_file
    echo &quot;# $entry_comment&quot; &gt;&gt; $bash_file
    echo &quot;export $token=$default&quot; &gt;&gt; $bash_file
    echo &quot; &quot; &gt;&gt; $bash_file
  fi
}
</pre>
<p>The function gets three arguments: the token <code>GROWL_PASSWORD</code>, the default value <code>enter_growl_password</code>, and a message to explain to the user what to do. If the token is found (lines 22 &amp; 23) then it looks for the default value (lines 25 &amp; 26) and prints a change message if it&#8217;s there. If the token isn&#8217;t found (lines 32-38) then we write that into the file.</p>
<h4>Adding the HOST_IP as a system generated value</h4>
<p>The next thing we want to do is add the host system&#8217;s IP address to the file so that Growl knows where to send notifications:</p>
<pre class="brush: bash; first-line: 65; title: ; notranslate">
sed -i '' '/HOST_IP/d' $bash_file
# grab current host IP
ipaddr=`ifconfig | grep &quot;inet &quot; | grep -v 127.0.0.1 | cut -d ' ' -f2`
# and write to file
echo &quot;export HOST_IP=$ipaddr&quot; &gt;&gt; $bash_file
</pre>
<p>This script deletes any existing lines with <code>HOST_IP</code> in them (line 65), then uses a little bash trickery to find the current host ip. I found out how to do it from this <a href="http://www.askdavetaylor.com/how_do_i_figure_out_my_ip_address_on_a_mac/" target="_blank">post</a>, although I needed to change the delimiter from <code>\ </code> to <code>' '</code> (that&#8217;s from an escaped space character to a space in quotes. Finally we write this out to our <code>guest_bash_profile</code> file. The next step is getting this script to run when we want it.</p>
<h3>Running the profile setup script when Vagrant starts</h3>
<p>Thanks to the <a href="https://github.com/emyl/vagrant-triggers" target="_blank">Vagrant Triggers</a> plugin, this is a really simple affair. We just add the following to our Vagrantfile:</p>
<pre class="brush: ruby; first-line: 37; title: ; notranslate">
  config.trigger.before [:up, :reload], :stdout =&gt; true do
    run &quot;sh ./setup_guest_bash_profile.sh&quot;
  end
</pre>
<p>This will run our script every time we call <code>vagrant up</code> or <code>vagrant reload</code>, ensuring that our host ip address is always up to date in the file. The <em>last</em> piece of the puzzle is to make sure we use this file to actually set environment variables on the guest machine.</p>
<h3>Linking the guest bash profile to the guest virtual machine</h3>
<p>This is a relatively simple two-part process. First thing we do is share the <code>ops/dotfiles</code> directory on the virtual machine:</p>
<pre class="brush: ruby; first-line: 20; title: ; notranslate">
  config.vm.synced_folder 'dotfiles', '/dotfiles'
</pre>
<p>Secondly, we want that file symlinked in the guest machine to <code>~/.bash_profile</code>. I created a new Puppet class to achieve this. Check out <code>ops/puppet/modules/spex/dotfile_symlink.pp</code>:</p>
<pre class="brush: ruby; first-line: 4; title: ; notranslate">
class spex::dotfile_symlink{
  file { '/home/vagrant/.bash_profile':
    ensure =&gt; link,
    target =&gt; '/dotfiles/guest_bash_profile'
  }
}
</pre>
<p>Super simple here. We tell puppet to <code>ensure</code> that <code>/home/vagrant/.bash_profile</code> is a symlink to <code>/dotfiles/guest_bash_profile</code>. In <code>ops/puppet/manifests/default.pp</code> we simply include the class with the others:</p>
<pre class="brush: ruby; first-line: 6; title: ; notranslate">
include spex::base_packages
include spex::postgres_setup
include spex::ruby_setup
include spex::dotfile_symlink
</pre>
<p>Now we have everything wired up and ready to go!</p>
<h3>Conclusion</h3>
<p>This wraps up my example for getting Growl notifications from Guard into the host machine. Although there are a bunch of steps to jump through, once it&#8217;s working I hope you&#8217;ll find it a pretty robust solution.</p>
<p>The goal in all of this is to shorten feedback loops when you develop. This process should give you some confidence that when your code changes the right tests run. The power of this is greatest when you are confident that your tests cover enough of your application such that you will know when you break things. Our next step is to look into the breadth of your tests and setting up code coverage metrics for your app&#8230;</p>
<p>The post <a rel="nofollow" href="http://eyefodder.com/2014/09/growl-guard-virtual-machine.html">Getting Growl notifications from your Virtual Machine</a> appeared first on <a rel="nofollow" href="http://eyefodder.com">Eyefodder</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://eyefodder.com/2014/09/growl-guard-virtual-machine.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Getting Started with Guard and RSpec</title>
		<link>http://eyefodder.com/2014/09/guard-and-rspec.html</link>
		<comments>http://eyefodder.com/2014/09/guard-and-rspec.html#comments</comments>
		<pubDate>Thu, 04 Sep 2014 22:23:40 +0000</pubDate>
		<dc:creator><![CDATA[Paul Barnes-Hoggett]]></dc:creator>
				<category><![CDATA[Agile Software Development]]></category>
		<category><![CDATA[Engineering]]></category>
		<category><![CDATA[Quality Software]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Software Craftsmanship]]></category>
		<category><![CDATA[Test Driven Development]]></category>

		<guid isPermaLink="false">http://eyefodder.com/?p=177</guid>
		<description><![CDATA[<p>As I build out an application I want to ensure it&#8217;s behaving as I intend it. RSpec is a great framework for testing Ruby code, and is the tool I use most for my testing. But tests are pretty useless if you don&#8217;t run them, and rather than manually run tests when I change things, [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://eyefodder.com/2014/09/guard-and-rspec.html">Getting Started with Guard and RSpec</a> appeared first on <a rel="nofollow" href="http://eyefodder.com">Eyefodder</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>As I build out an application I want to ensure it&#8217;s behaving as I intend it. <a href="http://rspec.info/" target="_blank">RSpec</a> is a great framework for testing Ruby code, and is the tool I use most for my testing. But tests are pretty useless if you don&#8217;t run them, and rather than manually run tests when I change things, I use <a href="http://guardgem.org/" target="_blank">Guard</a> and RSpec together. Here&#8217;s the simplest possible example for setting it up.</p>
<div id="attachment_186" style="width: 550px" class="wp-caption alignnone"><a href="http://en.wikipedia.org/wiki/Yeomen_Warders"><img class="size-large wp-image-186" src="http://eyefodder.com/wp-content/uploads/2014/09/beefeater-757x1024.jpg" alt="&quot;Detroit Publishing Co. - A Yeoman of the Guard (N.B. actually a Yeoman Warder), full restoration&quot; by Adam Cuerden, Detroit Publishing Company - http://www.loc.gov/pictures/item/2002696943/. Licensed under Public domain via Wikimedia Commons - http://commons.wikimedia.org/wiki/File:Detroit_Publishing_Co._-_A_Yeoman_of_the_Guard_(N.B._actually_a_Yeoman_Warder),_full_restoration.jpg#mediaviewer/File:Detroit_Publishing_Co._-_A_Yeoman_of_the_Guard_(N.B._actually_a_Yeoman_Warder),_full_restoration.jpg" width="540" height="730" /></a><p class="wp-caption-text">Guard and RSpec : rather fancy</p></div>
<p><span id="more-177"></span><a href="http://guardgem.org/" target="_blank">Guard</a> is a command line tool that responds to filesystem change events. You can use it to do all sorts of stuff using one of the <a href="https://github.com/guard" target="_blank">many plugins</a> that have been built for it. In our simple example we are going to use it to trigger rspec tests when we change code in our app.</p>
<h2>Getting Started</h2>
<p>For this we are going to grab an example from the Spex repository where I keep all my code examples. Clone the branch from github:</p>
<pre class="brush: bash; gutter: false; title: ; notranslate">

git clone -b rspec_guard --single-branch https://github.com/eyefodder/spex.git

</pre>
<h2>Confirming the tests run</h2>
<p>When you have the code cloned, jump into the <code>ops</code> directory and execute <code>vagrant up</code> to bring up the virtual machine that will run our example. As instructed, run <code>vagrant rsync-auto</code>; this will ensure that if you make changes to the code, they will get synced in the virtual machine (which is where Guard will be running). Now, open a new Terminal window, <code>vagrant ssh</code> into the machine and type the following:</p>
<pre class="brush: bash; gutter: false; title: ; notranslate">
cd /app
rspec
</pre>
<p>By doing this, we should see our tests run and get the following output:</p>
<pre class="brush: bash; gutter: false; title: ; notranslate">
vagrant@spex:~$ cd /app
vagrant@spex:/app$ rspec
Run options: include {:focus=&gt;true}

All examples were filtered out; ignoring {:focus=&gt;true}
....

Finished in 0.29975 seconds (files took 1.65 seconds to load)
4 examples, 0 failures

Top 4 slowest examples (0.2972 seconds, 99.1% of total time):
  Static Pages root page has the expected title
    0.27993 seconds ./spec/integration/static_pages_spec.rb:9
  ApplicationHelper #some_method_to_test returns 'result'
    0.00696 seconds ./spec/helpers.lication_helper_spec.rb:4
  Static Pages root page has a link to my blog
    0.00691 seconds ./spec/integration/static_pages_spec.rb:13
  Static Routing root path routes to the static#home path
    0.0034 seconds ./spec/routing/static_routing_spec.rb:5

Top 3 slowest example groups:
  Static Pages
    0.14342 seconds average (0.28684 seconds / 2 examples) ./spec/integration/static_pages_spec.rb:2
  ApplicationHelper
    0.00696 seconds average (0.00696 seconds / 1 example) ./spec/helpers/application_helper_spec.rb:2
  Static Routing
    0.0034 seconds average (0.0034 seconds / 1 example) ./spec/routing/static_routing_spec.rb:2

Randomized with seed 13496
</pre>
<p>So what happens if we break something? Go ahead and change the code in <code>app/helpers/application_helper.rb</code>:</p>
<pre class="brush: ruby; first-line: 2; title: ; notranslate">
  def some_method_to_test
    'resultd'
  end
</pre>
<p>Now when we run <code>rspec</code> again we see that four tests have run and one failed as expected. But really, given we just changed one file, did we have to run all the tests? And did we have to manually re-run the tests? The answers to these is no; Guard and Rspec together are pretty awesome&#8230;</p>
<h2>Guard and Rspec together</h2>
<p>To get things up and running, type in the following:</p>
<pre class="brush: bash; gutter: false; title: ; notranslate">
bundle exec guard -p
</pre>
<p>You should see something like this:</p>
<pre class="brush: bash; gutter: false; title: ; notranslate">
vagrant@spex:/app$ bundle exec guard -p
21:18:32 - INFO - Guard is using NotifySend to send notifications.
21:18:32 - INFO - Guard is using TerminalTitle to send notifications.
21:18:32 - INFO - Guard::RSpec is running
21:18:32 - INFO - Guard is now watching at '/app'
[1] guard(main)&gt; 
</pre>
<p>If you hit the <code>Enter</code> key, you&#8217;ll see all your tests run again. This is pretty awesome right? Now you can save yourself having to type <code>rspec</code>. But wait, that&#8217;s not all. Go ahead and change your <code>application_helper.rb</code> file back the way it was. Now you should see something like this:</p>
<pre class="brush: bash; gutter: false; title: ; notranslate">
21:22:13 - INFO - Running: spec/helpers/application_helper_spec.rb
Run options: include {:focus=&gt;true}

All examples were filtered out; ignoring {:focus=&gt;true}
.

Finished in 0.0103 seconds (files took 1.99 seconds to load)
1 example, 0 failures

Top 1 slowest examples (0.00878 seconds, 85.2% of total time):
  ApplicationHelper #some_method_to_test returns 'result'
    0.00878 seconds ./spec/helpers.lication_helper_spec.rb:4

Randomized with seed 15725


[1] guard(main)&gt; 
</pre>
<p>Pretty sweet huh? Basically, anytime a file changes Guard figures out what test or tests we need to run. This helps to keep my test suite running lean and fast; aiding rather than slowing down development. Let&#8217;s take a look at what we have added in our example to make things work.</p>
<h2>How this was setup</h2>
<p>First off we added two gems to the <code>Gemfile</code>:</p>
<pre class="brush: ruby; first-line: 42; title: ; notranslate">
group :development do
  # rspec_guard
  gem 'guard-rspec', require: false
end

group :development, :test do
  # rspec_guard
  gem 'rspec-rails', '~&gt; 3.0.0'
end
</pre>
<p>Next, we have written some specs which you will find in the <code>spec</code> folder. I&#8217;m not going to go into detail on the tests I&#8217;ve written, but they should be pretty legible and cover just enough to demonstrate what we need to about Guard. Check out <code>spec/helpers/application_helper.rb</code>, <code>spec/integration/static_pages_spec.rb</code>, and <code>spec/routing/static_routing_spec.rb</code>. The <code>spec/rails_helper.rb</code> and <code>spec/spec_helper.rb</code> files are the ones generated by the <code>rspec-rails</code> gem when we run <code>rails generate rspec:install</code>.</p>
<h3>The Guardfile</h3>
<p>The real magic of getting Guard and RSpec working together comes from the <code>Guardfile</code> which is used to tell Guard what to watch for, and then what to do with it. I&#8217;ve modified the file generated by <code>guard init rspec</code> to demonstrate some common usage patterns based on the way I test. Watch statements follow simple regular expressions to determine when to fire. As you build up your app, you will want to keep this file updated as you may need to introduce new patterns. Let&#8217;s take a look through some examples in the file:</p>
<h4>Run any spec that changes</h4>
<p>Any file that is in the <code>spec</code> folder and ends with &#8216;_spec.rb&#8217; will get run if it changes:</p>
<pre class="brush: ruby; first-line: 15; title: ; notranslate">
  # run a spec file if it changes
  watch(%r{^spec/.+_spec\.rb$})
</pre>
<h4>Re-run the spec if the helper files change</h4>
<p><code>spec_helper.rb</code> and <code>rails_helper.rb</code> are files that RSpec uses to setup your specs. So if they change for any reason, it would affect all the tests.</p>
<pre class="brush: ruby; first-line: 19; title: ; notranslate">
  # re-run if spec helper or rails helper changes
  watch('spec/spec_helper.rb')  { &quot;spec&quot; }
  watch('spec/rails_helper.rb')  { &quot;spec&quot; }
</pre>
<h4>Run the matching spec if something changes in the app folder</h4>
<p>As a good catch all, if a file changes in the <code>app</code> folder we want to run the corresponding spec:</p>
<pre class="brush: ruby; first-line: 25; title: ; notranslate">
  # run a file matching same path with _spec at the end
  # eg /app/models/foo.rb will run /spec/models/foo_spec.rb
  watch(%r{^app/(.+)\.rb$}) { |m| &quot;spec/#{m[1]}_spec.rb&quot; }
</pre>
<h4>Re-run the suite if support files change</h4>
<p>I put RSpec <a href="https://www.relishapp.com/rspec/rspec-core/docs/example-groups/shared-examples" target="_blank">shared examples</a> and <a href="https://www.relishapp.com/rspec/rspec-expectations/v/3-0/docs/custom-matchers/define-matcher" target="_blank">custom matchers</a> into the <code>support</code> folder, so if anything in here changes I&#8217;ll need to re-run the full suite:</p>
<pre class="brush: ruby; first-line: 33; title: ; notranslate">
  watch(%r{^spec/support/(.+)\.rb$})  { &quot;spec&quot; }
</pre>
<h4>Integration tests for views and controllers</h4>
<p>I have found it simpler to test my views and controllers by creating integration tests that mimic user behaviour (although the tests you see aren&#8217;t great examples of that, we&#8217;ll be building out better ones in a future example on using <a href="https://github.com/jnicklas/capybara" target="_blank">Capybara</a>). For this to work, I have a naming structure such that specs related to the <code>foo</code> controller (or views) live in <code>spec/integration/foo_pages_spec.rb</code>. If a controller is pluralized, that is handled well too, so that <code>app/controllers/things_controller.rb</code> will trigger <code>spec/integration/thing_pages_spec.rb</code>:</p>
<pre class="brush: ruby; first-line: 53; title: ; notranslate">
  watch(/^app\/controllers\/(.+)_controller.rb/) do |m|
    [&quot;spec/integration/#{m[1].singularize}_pages_spec.rb&quot;,
     &quot;spec/routing/#{m[1]}_routing_spec.rb&quot;]
  end
</pre>
<p>And if a view file changes, we run the corresponding integration test using this: </p>
<pre class="brush: ruby; first-line: 44; title: ; notranslate">
  # if something within a view folder changes, run that spec
  # eg app/views/static/anyfile runs /spec/integration/static_pages_spec.rb
  watch(%r{^app/views/(.+)/}) do |m|
      &quot;spec/integration/#{m[1].singularize}_pages_spec.rb&quot;
  end
</pre>
<p>If any of the overall layouts change, it could affect any of our integration tests, so we should re-run them all:</p>
<pre class="brush: ruby; first-line: 42; title: ; notranslate">
  watch(%r{^app/views/layouts/(.*)}) { 'spec/integration' }
</pre>
<h4>Abstract classes</h4>
<p>Lastly, you will inevitably end up having abstract classes in your app. If these change you probably want to run all the specs for classes that inherit from it. I only included an example for the <code>application_controller.rb</code> changing but you can extrapolate from here:</p>
<pre class="brush: ruby; first-line: 39; title: ; notranslate">
  watch('app/controllers/application_controller.rb')  { &quot;spec/integration&quot; }
</pre>
<h3>A word on Guard with polling</h3>
<p>The more astute amongst you will notice that Guard is started up with a <code>-p</code> option. This option forces Guard to poll for changes rather than listen for filesystem change notifications. The reason is that with our setup using rsync to synchronize changes in the virtual machine causes Guard to not always respond to changes. Basically an <a href="https://github.com/guard/guard/issues/495" target="_blank">earlier issue</a> with Guard-Rspec was solved by having rspec only run when it sees a file as modified rather than added. However, with rsync it seems that the <a href="https://github.com/guard/listen" target="_blank">listen</a> gem sometimes think the file has been added rather than modified. I&#8217;m trying to <a href="https://groups.google.com/forum/#!topic/guard-dev/-tx6yncq1wA" target="_blank">figure out a resolution</a> for this, but in the meantime, polling it is! </p>
<h3>But wait, there&#8217;s more!</h3>
<p>This super-simple example should help you get up and running with Guard and RSpec. With the setup here you would find that every time the specs run the Rails application has to load up. This makes every test run take at least a few seconds. In earlier versions of Rails I used to use <a href="https://coderwall.com/p/jxrhag" target="_blank">Spork</a> to pre-load the framework, but now Rails comes with <a href="https://github.com/rails/spring" target="_blank">Spring</a> which is much easier to setup. In my next post I&#8217;ll walk you through it; until then happy testing!</p>
<p>The post <a rel="nofollow" href="http://eyefodder.com/2014/09/guard-and-rspec.html">Getting Started with Guard and RSpec</a> appeared first on <a rel="nofollow" href="http://eyefodder.com">Eyefodder</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://eyefodder.com/2014/09/guard-and-rspec.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Performance &#8211; spend it wisely and never raise the debt ceiling</title>
		<link>http://eyefodder.com/2011/08/software-performance-dont-get-downgraded.html</link>
		<comments>http://eyefodder.com/2011/08/software-performance-dont-get-downgraded.html#comments</comments>
		<pubDate>Sat, 06 Aug 2011 23:49:52 +0000</pubDate>
		<dc:creator><![CDATA[Paul Barnes-Hoggett]]></dc:creator>
				<category><![CDATA[Engineering]]></category>
		<category><![CDATA[Quality Software]]></category>
		<category><![CDATA[Software Estimation]]></category>

		<guid isPermaLink="false">http://www.eyefodder.com/?p=140</guid>
		<description><![CDATA[<p>The US had it&#8217;s credit rating downgraded yesterday. For many people, it seems at first a little abstract and vaguely ominous—a chance for China to get it&#8217;s own back after being harangued by the US on its undervaluation of the Yuen. Maybe the outcome will be catastrophic, maybe not so much. Only time will tell. [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://eyefodder.com/2011/08/software-performance-dont-get-downgraded.html">Performance &#8211; spend it wisely and never raise the debt ceiling</a> appeared first on <a rel="nofollow" href="http://eyefodder.com">Eyefodder</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>The US had it&#8217;s <a href="http://www.nytimes.com/2011/08/06/business/us-debt-downgraded-by-sp.html?ref=global">credit rating downgraded</a> yesterday. For many people, it seems at first a little abstract and vaguely ominous—a chance for <a href="http://www.nytimes.com/2011/08/07/business/global/china-a-big-creditor-says-us-has-only-itself-to-blame.html?hp">China to get it&#8217;s own back</a> after being harangued by the US on its <a href="http://uk.reuters.com/article/2010/09/23/uk-usa-china-yuan-idUKTRE68M09H20100923">undervaluation of the Yuen</a>. Maybe the outcome will be catastrophic, maybe not so much. Only time will tell. What Standard and Poor&#8217;s have basically said is that there is more chance than before that America will fail to pay its bills on time. But what does this have to do with quality software and how it gets built? Well here&#8217;s the thing—the way the US government are managing the economy and the debt ceiling are very similar to the way many software projects go slowly south; everyone recognizes that something needs to be done, but none can agree on what the right course of action actually is.</p>
<div id="attachment_141" style="width: 499px" class="wp-caption aligncenter"><img class="size-full wp-image-141 " title="Don't overpromise and foreclose on your project" src="http://eyefodder.com/wp-content/uploads/2011/08/100-will-buy-this-car-great-depression-stock-crash.jpeg" alt="Stock market crash &quot;100 dollars will buy this car, lost all on stock market&quot;" width="489" height="323" /><p class="wp-caption-text">Don&#039;t overpromise and foreclose on your project</p></div>
<p><span id="more-140"></span></p>
<h2>Performance as money</h2>
<p>I first was introduced to the idea of performance as money through watching an <a href="http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-046j-introduction-to-algorithms-sma-5503-fall-2005/">MIT lecture series on algorithms</a>. In the <a href="http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-046j-introduction-to-algorithms-sma-5503-fall-2005/video-lectures/lecture-1-administrivia-introduction-analysis-of-algorithms-insertion-sort-mergesort/">opening lecture</a>, Charles Leiserson talks about performance as currency:</p>
<blockquote><p>A good way I think about performance, and the reason it&#8217;s on the bottom of the heap, is sort of like performance is like money, it&#8217;s like currency. You say what good does a stack of hundred dollar bills do for you? Would you rather have food or water or shelter or whatever? And you&#8217;re willing to pay those hundred dollar bills, if you have hundred dollar bills, for that commodity.</p></blockquote>
<p>when he talks about performance being on the bottom of the heap, what he&#8217;s talking about is how other things are more important than performance; features, security, ease of use and so on.</p>
<h2>Performance constraints as the debt limit</h2>
<p>I&#8217;ve posted before on <a href="http://www.eyefodder.com/2011/06/quality-software-non-functional-requirements.html">non functional requirements every application should have</a>, and first and foremost amongst those constraints is performance. The deal you need to make with yourself and your users is how much of that performance stack of bills are you willing or able to spend to get there? all of the decisions you make, from language choice to functionality to visual design are informed by this decision. Setting your performance constraint is just like setting your household budget (or the government&#8217;s debt ceiling).</p>
<h2>And the credit rating?</h2>
<p>To extend the metaphor a little bit further than is natural, the credit rating is akin to the likelihood that your project will fail overall. We don&#8217;t have a good measure for that in software development, but I do think drawing the parallel is interesting. If you read the <a href="http://www.standardandpoors.com/servlet/BlobServer?blobheadername3=MDT-Type&amp;blobcol=urldata&amp;blobtable=MungoBlobs&amp;blobheadervalue2=inline%3B+filename%3DUS_Downgraded_AA%2B.pdf&amp;blobheadername2=Content-Disposition&amp;blobheadervalue1=application%2Fpdf&amp;blobkey=id&amp;blobheadername1=content-type&amp;blobwhere=1243942957443&amp;blobheadervalue3=UTF-8">S&amp;P downgrade overview</a>, you will see that the decision was in part due to the rising debt burden (technical debt?), but more significantly it is due of the infighting and lack of a clear plan forward:</p>
<blockquote><p>More broadly, the downgrade reflects our view that the effectiveness, stability, and predictability of American policymaking and political institutions have weakened…</p></blockquote>
<p>This sounds so much like entrenched behavior of stakeholders on a poorly managed software projects (and its effect) that I couldn&#8217;t pass on the opportunity to use it. Simply put, if you have a lack of alignment and clear plan about what is acceptable, what is important and how you are going to spend your resources (or generate income) things aren&#8217;t going to be plain sailing.</p>
<h2>Performance—Avoid foreclosure</h2>
<p>O.K. I really am stretching it here, but I wanted to finish up with how I think you best avoid getting mired in software rot or simply just building something that no-one wants to use. And it&#8217;s really similar to being financially prudent:</p>
<ul>
<li>Understand that almost everything you do bears some cost to performance</li>
<li>Decide what is an acceptable level of performance…</li>
<li>…and spend within your means</li>
<li>Don&#8217;t go into debt(let performance drop below acceptable level)</li>
<li>But sometimes it&#8217;s going to happen. If it does, get a plan in place quickly to address it.</li>
</ul>
<p>The post <a rel="nofollow" href="http://eyefodder.com/2011/08/software-performance-dont-get-downgraded.html">Performance &#8211; spend it wisely and never raise the debt ceiling</a> appeared first on <a rel="nofollow" href="http://eyefodder.com">Eyefodder</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://eyefodder.com/2011/08/software-performance-dont-get-downgraded.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Have you been hurt by code reuse? Learn from De Niro</title>
		<link>http://eyefodder.com/2011/07/have-you-been-hurt-by-code-reuse-learn-from-de-niro.html</link>
		<comments>http://eyefodder.com/2011/07/have-you-been-hurt-by-code-reuse-learn-from-de-niro.html#comments</comments>
		<pubDate>Wed, 06 Jul 2011 23:34:32 +0000</pubDate>
		<dc:creator><![CDATA[Paul Barnes-Hoggett]]></dc:creator>
				<category><![CDATA[Quality Software]]></category>
		<category><![CDATA[Software Craftsmanship]]></category>
		<category><![CDATA[Test Driven Development]]></category>

		<guid isPermaLink="false">http://www.eyefodder.com/?p=132</guid>
		<description><![CDATA[<p>Ever used someone else&#8217;s code; a library or sample app online? Ever got to a point where it&#8217;s been so mind-bendingly painful that you rue the day you ever found the stupid &#8216;library&#8217; in the first place? If not then chances are you&#8217;re not a developer, you&#8217;re this guy, or you&#8217;re delusional. Spurred by a [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://eyefodder.com/2011/07/have-you-been-hurt-by-code-reuse-learn-from-de-niro.html">Have you been hurt by code reuse? Learn from De Niro</a> appeared first on <a rel="nofollow" href="http://eyefodder.com">Eyefodder</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Ever used someone else&#8217;s code; a library or sample app online? Ever got to a point where it&#8217;s been so mind-bendingly painful that you rue the day you ever found the stupid &#8216;library&#8217; in the first place? If not then chances are you&#8217;re not a developer, you&#8217;re <a href="http://www.orato.com/self-help/luckiest-man-the-world">this guy</a>, or you&#8217;re delusional. Spurred by a <a href="http://twitter.com/#!/mateobarraza/status/86150174744911872">conversation with Mateo</a>, my friend and former development buddy about this, I started to think a little deeper about what the problem is with code reuse. We expect a well-made production quality piece of work, and before long we realize that we are stuck with something that is sucking time away rather than letting us develop the hard stuff faster. So when should you reuse code? Here are some thoughts on when you should proceed with abandon, and when you might want to be more cautious&#8230;<br />
<div style="width: 384px" class="wp-caption aligncenter"><a href="http://www.mustrad.org.uk/pictures/brown.htm"><img alt="" src="http://www.mustrad.org.uk/graphics/james_b.jpg" title="We think we are getting this" width="374" height="503" /></a><p class="wp-caption-text">We think we are getting this...</p></div><br />
<div style="width: 405px" class="wp-caption aligncenter"><a href="http://www.mustrad.org.uk/pictures/italian1.htm"><img alt="" src="http://www.mustrad.org.uk/graphics/italian1.jpg" title="...but often end up stuck with this" width="395" height="620" /></a><p class="wp-caption-text">...but often end up stuck with this</p></div></p>
<p><span id="more-132"></span></p>
<p>As Mateo mentioned, we are pretty much trained to reuse code wherever we can (and that includes our own—more on that later). The assumption is that just because it&#8217;s on google code or GitHub it&#8217;s good to go. If you&#8217;re not careful you will spend more time working through someone else&#8217;s library than you would coding from scratch. In practice the decision to reuse or not is a very delicate balancing act that you can easily get wrong. Here are some things to consider when you are faced with the choice:</p>
<h2>Good times to consider reuse</h2>
<h3>It&#8217;s generally accepted to be best in class</h3>
<p>No-one is going to regret choosing to use <a href="http://jquery.org/about/">JQuery</a> as a base framework for their javascript app. If you know the library is a de-facto standard for the problem you&#8217;re trying to solve you should be in good shape.</p>
<h3>You don&#8217;t know much about the problem / algorithm</h3>
<p>I&#8217;m not a statistics guy, and when I decided to code up an <a href="http://www.eyefodder.com/how-long-will-your-project-take-software-estimation-app">application</a> that uses some simple estimates to get a more realistic prediction of development time I needed to calculate the shape of a <a href="http://www.wolframalpha.com/input/?i=beta+distribution">beta distribution chart</a>. Rather than do it myself, I found a <a href="http://www.jstat.org/">library</a> that saved me having to learn how to code a bunch of statistical formula.</p>
<h3>There is an a active community around the code</h3>
<p>If there are O&#8217;reilly books on the subject, if there are questions (and answers) about the code on <a href="http://stackoverflow.com/">stack overflow</a>, then you can probably feel a little more comfortable that when you get stuck, your questions will get answered.</p>
<h3>It&#8217;s not the main problem you&#8217;re trying to solve</h3>
<p>Again, in the example of the software estimation app I built, the main problem I was after solving was showing people how you can quickly get a sense of the length of your project, not hardcore statistical analysis on data. I knew I didn&#8217;t need to do too much with the statistical analysis, and if it all went wrong, I could back out and use simpler, back of the napkin estimates</p>
<h2>When to be wary</h2>
<h3>The code isn&#8217;t being maintained</h3>
<p>If the code is marked at version 0.1 and was last updated three years ago, just be aware that the owner has probably moved on to other things and if you find problems, you might end up having to fix someone else&#8217;s issues.</p>
<h3>You know a lot about the problem domain and could put something together quickly</h3>
<p>If I know a problem domain really really well, then I can probably write my own stuff in the time it takes me to learn how someone else has approached the problem. Essentially I can do it quicker than &#8216;most any learning curve.</p>
<h3>The code doesn&#8217;t have supporting tests</h3>
<p>At the risk of sounding like an <a href="http://www.youtube.com/watch?v=l1wKO3rID9g">agile hitler</a>, if code doesn&#8217;t have a decent, usable test harness written against it, I have very little faith in it&#8217;s utility. It will mean that I have to proceed more slowly and cautiously and likely not understand half the intent of the code.</p>
<h3>It&#8217;s your own stuff</h3>
<p>So you wrote some stuff on your last project that applies to what you&#8217;re doing now? Good on you; should save a tonne of time, right? Think again—just because you wrote it doesn&#8217;t mean it&#8217;s any better than someone else&#8217;s work. This one deserves a little more explanation below</p>
<h3>It&#8217;s going to be really difficult to back out of later</h3>
<p>If the library you&#8217;re going to use is going to form the backbone of your application or the way its structured, then you need to be careful about the decision you&#8217;re making. Things like an <a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller#Implementations_of_MVC_as_web-based_frameworks">architectural framework</a> deserve careful though because the cost of changing your mind can get prohibitively high.</p>
<h2>On re-using your own code</h2>
<p>There are a couple of reasons why we need to be wary of our own work. First off, we tend to take a revisionist view on things; we assume that the work we did in the past is completely applicable to the problem we have at hand today. And I don&#8217;t know about you but I&#8217;ve become a better coder over time, so my old code is not as good or clean as the code I write today. Any time you reuse work, you need to weigh your own code with the same rigour as you would someone else&#8217;s. Don&#8217;t get me wrong, I&#8217;m really not advocating re-writing your own code for every project; what I&#8217;m suggesting is that if you are going to reuse your own code, make sure it&#8217;s fit for purpose, well-tested and as good as you can make it.</p>
<h2>So, what can De Niro teach me about reuse?</h2>
<p>The decision about whether to reuse or not is a tough one. You need to invest some time evaluating the library, and at some point make a judgement call on how steep the learning curve is versus just going it alone. The smart thing to do when you decide to reuse code is to make it easy to back out of the decision. As <a href="http://www.youtube.com/watch?v=85eeu2XF4QY&amp;feature=related">De Niro says in Heat</a>:</p>
<blockquote><p>Have no attachments; allow nothing to be in your life that you cannot walk out on in thirty seconds flat if you feel the heat around the corner</p></blockquote>
<p>&nbsp;</p>
<p>What I mean by this is that if you are going to use a library or someone else&#8217;s code, make sure you have it well isolated in your application. Try to only interact with it in one place, and make sure you have solidly tested that integration point. That way, if you later decide to back out of your decision, you can cleanly, surgically remove the library and replace it with your own work (or vice versa). Lowering the cost of changing your mind is the thing that can make the difference between a happy marriage and a bitter, bitter divorce that bankrupts you in the process.</p>
<p>The post <a rel="nofollow" href="http://eyefodder.com/2011/07/have-you-been-hurt-by-code-reuse-learn-from-de-niro.html">Have you been hurt by code reuse? Learn from De Niro</a> appeared first on <a rel="nofollow" href="http://eyefodder.com">Eyefodder</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://eyefodder.com/2011/07/have-you-been-hurt-by-code-reuse-learn-from-de-niro.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Try this, my mini-application for software estimation</title>
		<link>http://eyefodder.com/2011/07/try-this-my-mini-application-for-software-estimation.html</link>
		<comments>http://eyefodder.com/2011/07/try-this-my-mini-application-for-software-estimation.html#comments</comments>
		<pubDate>Tue, 05 Jul 2011 18:50:02 +0000</pubDate>
		<dc:creator><![CDATA[Paul Barnes-Hoggett]]></dc:creator>
				<category><![CDATA[Agile Software Development]]></category>
		<category><![CDATA[Quality Software]]></category>
		<category><![CDATA[Software Estimation]]></category>

		<guid isPermaLink="false">http://www.eyefodder.com/?p=134</guid>
		<description><![CDATA[<p>A couple of weeks ago I wrote about a simple yet powerful process for software estimation. When I was done I started to look at my excel worksheet for doing this process and figured that it could be something I could share with a broader audience. Rather than just post an excel file, I decided [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://eyefodder.com/2011/07/try-this-my-mini-application-for-software-estimation.html">Try this, my mini-application for software estimation</a> appeared first on <a rel="nofollow" href="http://eyefodder.com">Eyefodder</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>A couple of weeks ago I wrote about a <a title="Software Estimation — A good simple way courtesy of the Navy and the cold war" href="http://www.eyefodder.com/2011/06/software-estimation-a-good-simple-way-courtesy-of-the-navy-and-the-cold-war.html">simple yet powerful process for software estimation</a>. When I was done I started to look at my excel worksheet for doing this process and figured that it could be something I could share with a broader audience. Rather than just post an excel file, I decided to create a simple software estimation app and post it here. You can go <a title="How long will your project take?" href="http://www.eyefodder.com/how-long-will-your-project-take-software-estimation-app">check it out now</a>, or read on to get a bit more detail into the thinking behind it.</p>
<div id="attachment_128" style="width: 478px" class="wp-caption aligncenter"><a href="http://www.eyefodder.com/how-long-will-your-project-take-software-estimation-app"><img class="size-full wp-image-128" title="Estmator Application" src="http://eyefodder.com/wp-content/uploads/2011/07/EstmatorApp.png" alt="Screenshot of the software estimation app" width="468" height="549" /></a><p class="wp-caption-text">The estimation app in action</p></div>
<p><span id="more-134"></span></p>
<h2>The application</h2>
<p>The application is really simple. You just break down your project into a few tasks and enter three estimates for each—Optimistic, Nominal and Pessimistic (To get what I mean about these terms, check out this <a title="Software Estimation — A good simple way courtesy of the Navy and the cold war" href="http://www.eyefodder.com/2011/06/software-estimation-a-good-simple-way-courtesy-of-the-navy-and-the-cold-war.html">post</a>). What it then does is calculate the expected duration of the tasks as well as a high and low end of a range that you can have 95% confidence in. On top of that, it consolidates all of your estimates into a rolled up view that tells you how long you can expect your full project to take. See, there can be some science behind software estimation after all (if you want the details behind how the estimates are worked out, they&#8217;re covered in a <a title="Software Estimation — A good simple way courtesy of the Navy and the cold war" href="http://www.eyefodder.com/2011/06/software-estimation-a-good-simple-way-courtesy-of-the-navy-and-the-cold-war.html">previous post</a>).</p>
<h2>The sparklines</h2>
<p>One of the things I wanted to do over and above a spreadsheet was to make something that was clean and simple to read yet packed a lot of information into each row. What originally was six data points has been reduced to two thanks to using <a href="http://www.edwardtufte.com/bboard/q-and-a-fetch-msg?msg_id=0001OR">sparklines</a>. I could have possibly also done away with the low and high end estimates and had them as rollovers (like in the main result chart) but I just found it to be too overloaded and hard to read. I&#8217;ve found that there has been some really nice outcomes from using the sparklines:</p>
<ul>
<li>I can see which tasks have the most uncertainty in them (those with the broadest range)</li>
<li>I can see how different tasks stack up against one another by comparing the sparklines vertically (they&#8217;re all on the same x axis scale). I can do this much quicker than if it were a numeric table</li>
<li>I can present a hierarchy of information. The ranges are most important, then the expected time (which you can see on rollover), followed by the variance and the shape of the estimate which you can infer from the shape of the chart</li>
</ul>
<h2>The results script</h2>
<p>One of my big frustrations is that when people come up with software estimates, they give you values that imply a far greater precision than is reasonable. I&#8217;ve seen software estimates for a project in terms like &#8220;3042.5 hours&#8221; What this does is <em>imply</em> that the estimate is between 3042.45 and 3042.55 hours. Far more likely is that you have added up a number of estimates and at best you might be precise to within ten, twenty or even fifty hours (tough to say without knowing more about the estimate, but you get the drift). With the results script, I&#8217;ve tried to represent this by using natural language to lessen the implied precision. A few examples:</p>
<ul>
<li>Anything less than 1 is represented as &#8220;A few hours&#8221; &#8220;less than a day&#8221;</li>
<li>Up to a week you have &#8220;A couple of days&#8221; or &#8220;A few days&#8221;</li>
<li>Up to a month you have &#8220;About a week, a couple of weeks, three weeks</li>
<li>More than that, time is measured in months</li>
</ul>
<p>While looking into this, I also found this article talking about the <a href="http://northerneconomics.com/blog/?p=49">psychology of the zero</a>. In essence it says that people are more likely to &#8216;accept&#8217; a number with implied precision than one without. If you want to try this out and use the calculated numbers, rolling over the dots on the results plot will give you them. I also left in the calculated numbers for the individual tasks so you can see what&#8217;s going in to the final estimate.</p>
<h2>What&#8217;s next?</h2>
<p>Well, I&#8217;m hoping you&#8217;ll tell me. Right now, all estimates are in days and part days, but I thought I could add an option so you could put estimates in hours for smaller tasks. Maybe some export options or something. If you use this app and get some value from it, let me know if there&#8217;s anything else you&#8217;d like to see it do. So go ahead and <a title="How long will your project take?" href="http://www.eyefodder.com/how-long-will-your-project-take-software-estimation-app">try it out</a> and let me know what you think!</p>
<p>The post <a rel="nofollow" href="http://eyefodder.com/2011/07/try-this-my-mini-application-for-software-estimation.html">Try this, my mini-application for software estimation</a> appeared first on <a rel="nofollow" href="http://eyefodder.com">Eyefodder</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://eyefodder.com/2011/07/try-this-my-mini-application-for-software-estimation.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Software Estimation — A good simple way courtesy of the Navy and the cold war</title>
		<link>http://eyefodder.com/2011/06/software-estimation-a-good-simple-way-courtesy-of-the-navy-and-the-cold-war.html</link>
		<comments>http://eyefodder.com/2011/06/software-estimation-a-good-simple-way-courtesy-of-the-navy-and-the-cold-war.html#comments</comments>
		<pubDate>Sun, 19 Jun 2011 16:25:33 +0000</pubDate>
		<dc:creator><![CDATA[Paul Barnes-Hoggett]]></dc:creator>
				<category><![CDATA[Quality Software]]></category>
		<category><![CDATA[Software Estimation]]></category>

		<guid isPermaLink="false">http://www.eyefodder.com/?p=115</guid>
		<description><![CDATA[<p>In my last post I told you that your next project will take longer than you think. Now I&#8217;ve destroyed hope I&#8217;m going to show you how you can use this knowledge to be better at software estimation. We&#8217;re going to use a simple but very effective technique first developed by the Navy back in [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://eyefodder.com/2011/06/software-estimation-a-good-simple-way-courtesy-of-the-navy-and-the-cold-war.html">Software Estimation — A good simple way courtesy of the Navy and the cold war</a> appeared first on <a rel="nofollow" href="http://eyefodder.com">Eyefodder</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>In my last post I told you that <a title="Your project will take longer than you think and less than a Nukem" href="http://www.eyefodder.com/2011/06/your-project-will-take-longer-than-you-think-and-less-than-a-nukem.html">your next project will take longer than you think</a>. Now I&#8217;ve destroyed hope I&#8217;m going to show you how you can use this knowledge to be better at software estimation. We&#8217;re going to use a simple but very effective technique first developed by the Navy back in the &#8217;50s when they were <a href="http://www.lessons-from-history.com/node/116">building the Polaris nuclear submarine</a>. Faced with tremendous risk and uncertainty, they had to work out how to build a missile that had never been built before, to be carried on a submarine more complex than contemporary technology would allow. And by the way, they had to work out how get a missile to launch underwater and hit a target thousands of miles away when no one had built a decent guidance system before. Oh, and the Russians were breathing down their neck with the <a href="http://en.wikipedia.org/wiki/Sputnik_1">Sputnik</a> project. The Navy managed to develop a system of estimation and risk management that was so effective, they delivered three years early. Think your project is harder to estimate than that? Think again. Get on board and read on to find out how you can use this technique for your own means&#8230;</p>
<div style="width: 490px" class="wp-caption aligncenter"><a href="http://www.oldmodelkits.com/index.php?detail=15359&amp;manu=Renwal" target="_blank"><img class=" " title="How long would it take you to build the world's most formidable weapon?" src="http://www.oldmodelkits.com/jpegs/r/Revell%20H308%20NautMP.JPG" alt="" width="480" height="189" /></a><p class="wp-caption-text">How long would it take you to build &#8220;the free world&#8217;s most formidable weapon&#8221;?</p></div>
<p><span id="more-115"></span></p>
<h2>The real reason why your project will take longer than you think</h2>
<p>What the Navy realized is that when you give a baseline estimate, the number you tend to give is how long you think it will take in ordinary circumstances; the outcome that will happen most of the time. This isn&#8217;t however the <em>average</em> amount of time the task will take. How so? Consider this extract from Bob Martin&#8217;s excellent book <a href="http://www.amazon.com/gp/product/0137081073/ref=as_li_ss_tl?ie=UTF8&amp;tag=eyefodder-20&amp;linkCode=as2&amp;camp=217145&amp;creative=399373&amp;creativeASIN=0137081073">The Clean Coder</a><img style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.com/e/ir?t=&amp;l=as2&amp;o=1&amp;a=0137081073&amp;camp=217145&amp;creative=399373" alt="" width="1" height="1" border="0" /> where he describes a typical software estimation conversation:</p>
<blockquote><p>Mike: “How likely is it that you’ll be done in three days?</p>
<p>Peter: “Pretty likely.”</p>
<p>Mike: “Can you put a number on it?”</p>
<p>Peter: “Fifty or sixty percent.”</p>
<p>Mike: “So there’s a good chance that it’ll take you four days.”</p>
<p>Peter: “Yes, in fact it might even take me five or six, though I doubt it.”</p>
<p>Mike: “How much do you doubt it?”</p>
<p>Peter: “Oh, I don’t know … I’m ninety-five percent certain I’ll be done before six days have passed.”</p>
<p>Mike: “You mean it might be seven days?”</p>
<p>Peter: “Well, only if everything goes wrong. Heck, if everything goes wrong, it could take me ten or even eleven days. But it’s not very likely that so much will go wrong.”</p></blockquote>
<p>As <a href="http://www.objectmentor.com/omTeam/martin_r.html">Uncle Bob</a> goes on to explain, what&#8217;s going on here is that Mike is describing a probability distribution, something like this:</p>
<p><img class="aligncenter size-full wp-image-119" title="Chances of delivering on a certain day" src="http://eyefodder.com/wp-content/uploads/2011/06/DeliveryDistribution.png" alt="" width="577" height="331" /></p>
<p>What is happening is that when you describe how long you think it will take, you are describing the <strong><em>mode</em></strong> &#8211; what will happen most often. However because there is more chance of running over than under, you need to take that into account. What the Navy did was find a really quick simple way of finding the mean by looking at three simple estimates for the duration of a task&#8230;</p>
<h2>Three little estimates</h2>
<p>They figured out that if you can get people to estimate these three possible outcomes, you can calculate the expected duration for a task:</p>
<h3>Nominal (ψ)</h3>
<p>This is the standard issue estimate, what people are used to giving—the amount of time you would expect a task to take under normal circumstances. In the example above it would probably be 3.</p>
<h3>Nukem (ω)</h3>
<p>This is the longest it could take if pretty much everything went wrong. This is the one in a thousand worst case scenario, the Nukem (for more on this read my last <a title="Your project will take longer than you think and less than a Nukem" href="http://www.eyefodder.com/2011/06/your-project-will-take-longer-than-you-think-and-less-than-a-nukem.html">post</a>). Mike&#8217;s Nukem is 11.</p>
<h3>Mu-nicorn (μ)</h3>
<p>I took extreme license with naming this one, but bear with me. This is the your estimate of how long this would take if the stars aligned, unicorns pair programmed with you and generally everything went so well you have to check yourself.</p>
<h2>Super Simple Math</h2>
<p>Now you have these estimates, you can calculate the expected duration of the task using this formula:</p>
<p><em style="font-size: 3em;">T<sub>e</sub> = (μ + 4ψ + ω)/6</em></p>
<p>You can also get the standard deviation of the estimate, which gives a measure of how uncertain the task is:</p>
<p><em style="font-size: 3em;">σ = (ω &#8211; μ )/6</em></p>
<p>Now, you can tell people that you are pretty confident that your task will take between <em style="font-size: 1.3em;">T<sub>e</sub>-2σ</em> and <em style="font-size: 1.3em;">T<sub>e</sub>+2σ</em>. This statement is not strictly correct, and I will explain at the end why this is so, but to keep it simple, I would use this.</p>
<h2>Putting it to practice</h2>
<p>In order to put this into on your project I would recommend breaking your app up into somewhat smaller, more manageable pieces for estimating. In theory, this helps because the <a href="http://en.wikipedia.org/wiki/Law_of_large_numbers">law of large numbers</a> implies that your errors cancel out. In practice, it&#8217;s also just plain easier to understand your app in small pieces. When you have your estimates for a number of tasks, you can simply add the expected times together to get the expected duration for the project. To get the standard deviation, you have to calculate the square root of the sum of the squares:<br />
<em style="font-size: 3em;">σ<sub style="font-size: .8em;"> project</sub> = √ ∑ σ <sup>2</sup></em></p>
<h2>Conclusion</h2>
<p>There is nothing like real development data and experience to understand how long things are going to take. Unfortunately you will often have a situation when you don&#8217;t have that information available and you are still called upon to give a estimate. This technique can help you do that and have solid reasoning to back you up. I hope you find this useful, and if you want to look into estimation more, I highly recommend both Bob Martins book <a href="http://www.amazon.com/gp/product/0137081073/ref=as_li_ss_tl?ie=UTF8&amp;tag=eyefodder-20&amp;linkCode=as2&amp;camp=217145&amp;creative=399373&amp;creativeASIN=0137081073">The Clean Coder</a><img style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.com/e/ir?t=&amp;l=as2&amp;o=1&amp;a=0137081073&amp;camp=217145&amp;creative=399373" alt="" width="1" height="1" border="0" /> mentioned above and Mike Cohn&#8217;s book on <a href="http://www.amazon.com/gp/product/0131479415/ref=as_li_ss_tl?ie=UTF8&amp;tag=eyefodder-20&amp;linkCode=as2&amp;camp=217145&amp;creative=399369&amp;creativeASIN=0131479415">Agile Estimating and Planning</a><img style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.com/e/ir?t=&amp;l=as2&amp;o=1&amp;a=0131479415&amp;camp=217145&amp;creative=399369" alt="" width="1" height="1" border="0" /></p>
<h2>Post-script &#8211; there (probably) be dragons down here</h2>
<p><em>This gets a little involved down here, so if you want to keep it simple, don&#8217;t worry about this stuff. As you are usually at the beginning of a project when you do this and are wildly imprecise anyway it shouldn&#8217;t make much difference.</em></p>
<p>The more astute amongst you will have seen an issue with how we worked out our range by simply adding / subtracting two standard deviations from the estimated duration of the project. That assumes that its equally likely we run over as it is that we run under—that is, it&#8217;s a <a href="http://en.wikipedia.org/wiki/Normal_distribution">normal distribution</a> like this:</p>
<p><img class="aligncenter size-medium wp-image-120" title="normal distribution chart" src="http://eyefodder.com/wp-content/uploads/2011/06/normalDistribution-300x202.png" alt="normal distribution chart" width="300" height="202" /></p>
<p>Trouble is, as we saw in the example, there is a tail off to the right. This is what&#8217;s known as a <a href="http://en.wikipedia.org/wiki/Beta_distribution">beta distribution</a> (or at least an example of one), something more like this:</p>
<p><img class="aligncenter size-medium wp-image-121" title="beta distribution chart" src="http://eyefodder.com/wp-content/uploads/2011/06/betaDistribution-300x202.png" alt="beta distribution chart" width="300" height="202" /></p>
<p>If you look at these overlaid onto one another, you see that the range estimate when using normal distribution actually underestimates the duration a bit. If you want to keep things simple you are probably ok, but it&#8217;s worth knowing:</p>
<p><img class="aligncenter size-full wp-image-123" title="beta and normal distribution together" src="http://eyefodder.com/wp-content/uploads/2011/06/overlaiddistribution1.png" alt="beta and normal distribution together" width="542" height="411" /></p>
<p>The shape of the distribution is called a beta distribution, and it makes the math for working out the range quite a bit more complicated. You need to calculate a couple of variables that describe the shape of the curve: α and β. These are a bit complicated to work out, but for the sake of completeness, I hunted them down for you <a href="http://www.brighton-webs.co.uk/distributions/beta.asp">here</a>. They are:</p>
<p><em style="font-size: 1.1em;">α = ((mean-min)/(max-min)) * ((((mean-min)*(max-mean))/σ<sup>2</sup>)-1)</em></p>
<p>&nbsp;</p>
<p><em style="font-size: 1.1em;">β = (max-mean)/(mean-min)*α</em></p>
<p>Once you have these, you can use the Excel BETAINV function to get your minimum and maximum ranges. For example, if you want to calculate an duration as a range you can have 95% confidence in:</p>
<p><em style="font-size: 1.1em;">low end of range = BETAINV(0.025,α,β,min,max)</em></p>
<p>&nbsp;</p>
<p><em style="font-size: 1.1em;">high end of range = BETAINV(0.975,α,β,min,max)</em></p>
<p>The post <a rel="nofollow" href="http://eyefodder.com/2011/06/software-estimation-a-good-simple-way-courtesy-of-the-navy-and-the-cold-war.html">Software Estimation — A good simple way courtesy of the Navy and the cold war</a> appeared first on <a rel="nofollow" href="http://eyefodder.com">Eyefodder</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://eyefodder.com/2011/06/software-estimation-a-good-simple-way-courtesy-of-the-navy-and-the-cold-war.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Your project will take longer than you think and less than a Nukem</title>
		<link>http://eyefodder.com/2011/06/your-project-will-take-longer-than-you-think-and-less-than-a-nukem.html</link>
		<comments>http://eyefodder.com/2011/06/your-project-will-take-longer-than-you-think-and-less-than-a-nukem.html#comments</comments>
		<pubDate>Thu, 16 Jun 2011 06:38:36 +0000</pubDate>
		<dc:creator><![CDATA[Paul Barnes-Hoggett]]></dc:creator>
				<category><![CDATA[Quality Software]]></category>
		<category><![CDATA[Software Estimation]]></category>

		<guid isPermaLink="false">http://www.eyefodder.com/?p=113</guid>
		<description><![CDATA[<p>I will tell you how long your next project will take to release. You won&#8217;t like it, but I&#8217;ll tell you. A game is launching this week and in the story of its development is the key to successful software estimation. The game is Duke Nukem Forever, and just like the title, it did pretty [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://eyefodder.com/2011/06/your-project-will-take-longer-than-you-think-and-less-than-a-nukem.html">Your project will take longer than you think and less than a Nukem</a> appeared first on <a rel="nofollow" href="http://eyefodder.com">Eyefodder</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>I will tell you how long your next project will take to release. You won&#8217;t like it, but I&#8217;ll tell you. A game is launching this week and in the story of its development is the key to successful software estimation. The game is Duke Nukem Forever, and just like the title, it did pretty much take forever to launch. Five thousand, one hundred and sixty days to be precise. <a href="http://duke.a-13.net/">That&#8217;s just over 14 years</a>. Longer than it took to build the Empire State Building, the Golden Gate Bridge and the World Trade Center combined. It took so long, people have <a href="http://duke.a-13.net/">put up sites</a> covering how long it took. The game is by most accounts at best <a href="http://www.guardian.co.uk/technology/gamesblog/2011/jun/10/duke-nukem-forever-game-review">mediocre</a> and at worst <a href="http://arstechnica.com/gaming/reviews/2011/06/duke-nukem-forever-review-barely-playable-unfunny-and-rampantly-offensive.ars">atrocious</a>—in my highly opinionated view, the duration of a release is inversely proportional to product quality. But that&#8217;s not the story here. What&#8217;s important is why it happened and what it can tell you about software estimation on your own project.</p>
<div style="width: 455px" class="wp-caption aligncenter"><a href="http://www.gearboxsoftware.com/"><img title="Duke Nukem Launches after 'forever'" src="http://ecx.images-amazon.com/images/I/91undAvADTL._SL1500_.jpg" alt="" width="445" height="631" /></a><p class="wp-caption-text">Duke Nukem Forever Launched after 14 years development; what can this big chested antihero teach you about your project?</p></div>
<p><span id="more-113"></span></p>
<h2>Why it overran</h2>
<p>There are a number of reasons why the Duke took so long to get his politically incorrect ass back out in the wild. As an adoring public were salivating at the <a href="http://forums.3drealms.com/vb/showthread.php?t=30367">thought of a new Nukem</a>, the development team and its management were stuck in a pattern of events that pretty much ensured a death march of a project:</p>
<h3>Scope Creep</h3>
<p>Anyone who has ever been on a development project will be familiar with this problem. After the success of Duke Nukem 3D, George Broussard—the game&#8217;s creator—kept seeing <a href="http://www.wired.com/magazine/2009/12/fail_duke_nukem/2/">opportunities for ever more awesome features to put in the experience</a>:</p>
<blockquote><p>Broussard simply couldn&#8217;t tolerate the idea of <cite>Duke Nukem Forever</cite> coming out with anything other than the latest and greatest technology and awe-inspiring gameplay. He didn&#8217;t just want it to be good. It had to surpass every other game that had ever existed, the same way the original <cite>Duke Nukem 3D</cite> had.</p></blockquote>
<p>Snow scenes? You got it. Online Multiplayer? Of course! These sorts of things may seem price-of-admission now, but bear in mind that these features were being added over ten years ago. And &#8211; I&#8217;m not saying that these were bad ideas or unnecessary ideas, just that the goalposts kept moving, which makes it kind of tough to finish.</p>
<h3>Technology Death Spiral</h3>
<p>When Duke Nukem 3D came out, it was built on a <a href="http://www.youtube.com/watch?v=VSVzn0F3pyQ">game engine named &#8220;build&#8221;</a> by a child prodigy called Ken Silverman. In order to keep up with ever increasing needs of the project (see above), Broussard swapped out for a new game engine not once, but twice. This, again, may have been necessary, but it meant that the development team were always playing catch up.</p>
<h3>Too much cash, not enough business</h3>
<p>Here&#8217;s the thing: Duke Nukem 3D was a runaway success. So much so, that unlike before, Broussard could basically fund development themselves. Creative freedom is great, but without the business reminding you that what your building is for people to use and enjoy you run the risk of getting stuck into some sort of artwank vortex.</p>
<h3>Fear of Success—gilding the lily</h3>
<p>I&#8217;m not a console game developer, but when I heard it takes up to a year from &#8220;locking a game down&#8221; to launch I really felt sorry for those guys. The projects I work on have some level of locking down code to close out the last remaining bugs, but if it took a year, I can see how it would be an almost paralysing decision to make.</p>
<h3><span style="font-size: 19px">You&#8217;re no different from Nukem</span></h3>
<p>To some extent or another, your project will have some of these issues. Or the server will blow up. If you don&#8217;t have complete freedom and never know when to finish the business will be on your ass. Or the IT department. Or someone else&#8217;s sucky APIs will kill you slowly as you realise you&#8217;re the first person to use them. Or you will get a fundamental set of assumptions so wrong that you need to reset. Or you hire someone that turns out to be worse than useless (and yeah &#8211; I know you will <a href="http://www.bothsidesofthetable.com/2011/05/26/startup-mantra-hire-fast-fire-fast/">fire them quickly</a>, but it will still suck energy and time from the team).</p>
<p>Once you realize that some or all of these things will happen to your project, you can start to use this information to your advantage&#8230;</p>
<p><span style="font-size: 19px;font-weight: bold">Duke Nukem Forever is at the limit of how long things will take</span></p>
<p><a href="http://ars.userfriendly.org/cartoons/?id=20030430"><img class="aligncenter" title="Usenet jokes mocking DNF's delay 8 years ago" src="http://www.3drealms.com/duke4/images/uf005450.gif" alt="people are bitter waiting for DNF to launch" width="720" height="274" /></a></p>
<p>See here&#8217;s the thing: Duke Nukem is pretty much at the outer limit of how long you can get away with a project overrunning. Any longer and it would have been be laid to rest. If it weren&#8217;t for the cult-like following DNF&#8217;s only achievement would have been 3 <a href="http://www.wired.com/science/discoveries/news/2004/01/61935?currentPage=all">Vaporware of the year</a> awards (and a lifetime award to boot). <a href="http://www.gearboxity.com/content/view/645/33/">Gearbox Software</a>, the company that picked up development after the <a href="http://www.shacknews.com/article/58519/duke-nukem-developer-3d-realms">original developer went bankrupt</a> probably realized that they were better off launching a mediocre game and starting from scratch than suffering yet another rewrite. This gives them the opportunity to reset the &#8216;development time&#8217; clock.</p>
<h2>Enter the Nukem as a unit of development time</h2>
<p>With all this in mind, I propose that we consider using the lesson of Duke Nukem Forever to give us a new unit of software estimation:</p>
<blockquote style="font-size: 1.2em"><p><strong>A Nukem</strong>: <em>The amount of time a project or part thereof will take when pretty much anything that can go wrong does.</em></p></blockquote>
<h2>So &#8211; how long will your next project take?</h2>
<p>I can&#8217;t be precise, but I can be accurate. This is how long your next project will take longer than you expect it to to and less than a Nukem. Or, in mathematical terms:</p>
<blockquote><p><em style="font-size: 3em">ψ &lt; x &lt; ω</em></p>
<p><em>Where:</em></p>
<p><em><em>ψ = the amount of time you expect it to take</em></em></p>
<p><em><em>x = the amount of time it will actually take</em></em></p>
<p><em><em><em>ω = a Nukem</em></em></em></p></blockquote>
<p>What&#8217;s interesting here is that many of the issues that Nukem had weren&#8217;t really down to code or developers, yet developers are the ones who get asked to estimate project duration and get held to it. Oh well, tough shit, that&#8217;s what you get for being a creator. Broussard&#8217;s stock response of &#8220;<a href="http://forums.3drealms.com/vb/showthread.php?p=654680#post654680">screw you publisher, it&#8217;ll be ready when it&#8217;s ready</a>&#8221; actually ended up killing his baby. Of course if you go to someone who is paying the bills with this range, you&#8217;ll probably not get vey far. But there is hope. In my next post I&#8217;ll show you how you can use this information to arrive at a range that is more palatable to them, has some science behind it, and allows the business to make some decisions based on your assumptions.</p>
<p>The post <a rel="nofollow" href="http://eyefodder.com/2011/06/your-project-will-take-longer-than-you-think-and-less-than-a-nukem.html">Your project will take longer than you think and less than a Nukem</a> appeared first on <a rel="nofollow" href="http://eyefodder.com">Eyefodder</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://eyefodder.com/2011/06/your-project-will-take-longer-than-you-think-and-less-than-a-nukem.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Making Quality Software: how to test non-functional requirements</title>
		<link>http://eyefodder.com/2011/06/quality-software-testing-non-functional-requirements.html</link>
		<comments>http://eyefodder.com/2011/06/quality-software-testing-non-functional-requirements.html#comments</comments>
		<pubDate>Fri, 10 Jun 2011 04:32:06 +0000</pubDate>
		<dc:creator><![CDATA[Paul Barnes-Hoggett]]></dc:creator>
				<category><![CDATA[Quality Software]]></category>

		<guid isPermaLink="false">http://www.eyefodder.com/?p=109</guid>
		<description><![CDATA[<p>In my last post, I outlined what I think are the twelve key constraints you need to think about if you are going to build high quality software that people want to use. As I mentioned, thinking through this needn&#8217;t be a mind sapping endeavour, and for some things you may just decide it&#8217;s not [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://eyefodder.com/2011/06/quality-software-testing-non-functional-requirements.html">Making Quality Software: how to test non-functional requirements</a> appeared first on <a rel="nofollow" href="http://eyefodder.com">Eyefodder</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>In my last post, I outlined what I think are the <a title="Making Quality Software: 12 non functional requirements every app should have." href="http://www.eyefodder.com/2011/06/quality-software-non-functional-requirements.html">twelve key constraints</a> you need to think about if you are going to build high quality software that people want to use. As I mentioned, thinking through this needn&#8217;t be a mind sapping endeavour, and for some things you may just decide it&#8217;s not important right now. Here&#8217;s the rub though; once you&#8217;ve decided something is important enough to define as a constraint on your system you&#8217;d better think about how you&#8217;re going to test it. If not, you may as well kiss the requirement goodbye as eventually people will stop paying attention to it. Here&#8217;s how I would go about testing each of those twelve constraints:<br />
<span id="more-109"></span></p>
<h2>The trouble with typical non functional requirements</h2>
<p>&#8220;it&#8217;s not fast enough&#8230;&#8221; That was the response I always had with my client / UX lead when I was developing when I asked them what they thought of the application. The trouble was, the client was used to seeing a vision demo which had canned data and used smoke and mirrors to mimic the application without having to worry about anything like network latency or the size of data. During development, the software you are building will go through various degrees of speed and performance as you strike a balance between functionality, flexibility and speed. In order for you not to get the shaft as a much harried developer, you need to arrive at an understanding with the client about what performance is acceptable and in what conditions.</p>
<h2>Make your requirements SMART</h2>
<p>First off, the creation and agreement of how the application needs to behave has to be a conversation between UX, the business and the technical team; you all fail if they are crappy, and you all need to sign up to them. What you need to do is come away with a clearly defined set of goals for &#8216;quality&#8217; of the application. Like any other requirement, they should be clear, simple and understandable. A great way to check this is to use the SMART principle first written up by Mike Mannion and Barry Keepence in a <a href="http://www.win.tue.nl/~wstomv/edu/2ip30/references/smart-requirements.pdf">1995 paper</a> on this. Basically they suggest that requirements should be:</p>
<p><em><strong>S</strong>pecific </em>- Clear, consistent and simple<br />
<em><strong>M</strong>easurable</em> &#8211; If you can&#8217;t measure it, you won&#8217;t know when you&#8217;ve acheived it<br />
<em><strong>A</strong>ttainable</em> &#8211; The requirement must be something that the team thinks is acheivable given what they know<br />
<em><strong>R</strong>ealizable</em> &#8211; Can it actually be done given the constraints you know about the way the project is being executed (is there enough money / time to acheive this goal for example)<br />
<em><strong>T</strong>raceable</em> &#8211; It is important to understand why a requirement exists so that it can be justified (and to question if it is still needed if the original driver or assumption changes)</p>
<h2>A common structure for defining the requirements</h2>
<p>I did quite a bit of hunting looking for a way that I could describe requirements as diverse as conformance to coding standards and ability to cope with year-on-year growth needs. Fortunately I found this post by <a href="http://www.theagileengineer.com/public/Home/Entries/2008/10/12_Qualities,_User_Stories_and_sad_state_of_Scrum_requirements.html">Ryan Shriver</a> that talks about how he uses a method by <a href="http://gilb.com">Tom Gilb</a></p>
<blockquote><p>[requirements] can 1) be specified numerically and 2) systems can be engineered to meet specific levels of performance. Qualities can be specified using a minimum of six attributes:</p>
<p style="padding-left: 30px"><strong>Name</strong>: A unique name for the quality<br />
<strong>Scale</strong>: “What” you’ll measure (aka the units of measure, such as seconds)<br />
<strong>Meter</strong>: “How” you’ll measure (aka the device you’ll use to obtain measurements)<br />
<strong>Target</strong>: The level of performance you’re aiming to achieve (how good it can be)<br />
<strong>Constraint</strong>: The level of performance you’re trying to avoid (how bad it can be)<br />
<strong>Benchmark</strong>: Your current level of performance.</p>
</blockquote>
<h2>Some sample requirements and reports</h2>
<p>I think it&#8217;s best to take a look at a few examples from my last post on <a title="Making Quality Software: 12 non functional requirements every app should have." href="http://www.eyefodder.com/2011/06/quality-software-non-functional-requirements.html">essential non functional requirements for building quality software</a>. What I&#8217;m showing here is how I would specify test and report the constraint:</p>
<h3>Processing times</h3>
<p>First off a relatively simple one. Measuring processing time is a matter of allowing the system to log out how long it took to do stuff.</p>
<p><strong>Name</strong>: Parsing of a large search result<br />
<strong>Scale</strong>: Elapsed milliseconds from receiving an XML response in the client containing 1000 results<br />
<strong>Meter</strong>: Log messages with a defined signature that output the parsing time in milliseconds<br />
<strong>Target</strong>: &lt;1200ms (i.e. 1200 ms or less is a target time)<br />
<strong>Constraint</strong>: &gt;5000 ms (i.e. more than 5000 ms is an epic fail)<br />
<strong>Benchmark</strong>: Build 155; test environment 3/21/11: 4500ms</p>
<p>Reporting this over time could give a chart something like this:</p>
<p style="text-align: center"><img class="size-full wp-image-110 aligncenter" title="Processing time test report" src="http://eyefodder.com/wp-content/uploads/2011/06/queryTimeTestReport.png" alt="sample processing time test report" width="486" height="373" /></p>
<h3>Architectural standards</h3>
<p>This one seems a bit more tricky at first glance. How can you measure how compliant a codebase is against architectural standards? Fortunately there are some great <a href="http://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis">static analysis tools </a>out there that allow you to inspect your code for potential problems. We have used <a href="http://pmd.sourceforge.net/">PMD</a> and <a href="http://opensource.adobe.com/wiki/display/flexpmd/FlexPMD">FlexPMD</a> in our projects. You can write your own rules or draw from common rulesets. Using this we are able to reduce things like architectural conformance to something quantifiable and thus testable:</p>
<p><strong>Name</strong>: Conformance to standard Flex architectural best practices<br />
<strong>Scale</strong>: # of PMD high warnings from the &#8216;cairngorm&#8217; and &#8216;architecture&#8217; PMD rulesets<br />
<strong>Meter</strong>: Flex PMD warnings reported by the nightly <del><a href="http://www.infoq.com/news/2011/01/jenkins">Hudson</a></del> <a href="http://jenkins-ci.org/content/about-jenkins-ci">Jenkins</a> build divided by the number of classes<br />
<strong>Target</strong>: &lt;1200ms (i.e. 1200 ms or less is a target time)<br />
<strong>Constraint</strong>: &gt;5000 ms (i.e. more than 5000 ms is an epic fail)<br />
<strong>Benchmark</strong>: Build 155; test environment 3/21/11: 4500ms</p>
<p><img class="aligncenter size-full wp-image-111" title="Sample Architectural compliance test report" src="http://eyefodder.com/wp-content/uploads/2011/06/architecturalTestReport.png" alt="Architectural compliance test report" width="486" height="373" /></p>
<p>You can see here how architectural standards started to lapse in sprint 3. The good news was that it was caught and addressed. This sort of conversation is far easier to have with your team when you have data to support the conversation.</p>
<h3>Year on year growth requirements</h3>
<p>Last one to demonstrate some breadth. If you want to test growth requirements, you are basically going to have to think about what your likely point of failure is going to be in your other requirements as your user base grows. It could be storage needs or response times, or more likely it&#8217;s peak throughput. In the example below, we increase the standard load on the system until the throughput test fails. We use that to predict how much runway the current system has before breaking down.</p>
<p><strong>Name</strong>: 60% year-on-year growth<br />
<strong>Scale</strong>: Number of months for system to hit peak throughput failure<br />
<strong>Meter</strong>: Standard Load Scenario increased by 5% per month and measured in each scenario until failure<br />
<strong>Target</strong>: 8 months<br />
<strong>Constraint</strong>: 3 months<br />
<strong>Benchmark</strong>: Current application; 3/21/11; Production environment; 2 months</p>
<p><img class="aligncenter size-full wp-image-112" title="Sample growth requirements test report " src="http://eyefodder.com/wp-content/uploads/2011/06/growthRequirementTestReport.png" alt="Sample growth requirements test report " width="486" height="373" /></p>
<h2>Simplicity and Consistency</h2>
<p>This pretty much wraps it up for non functional requirements (and FWIW, I agree with Mike Cohn that <a href="http://blog.mountaingoatsoftware.com/non-functional-requirements-as-user-stories">we should be calling these things constraints</a>). Non functional requirements can be a gnarly area as they attempt to describe areas of the software most prone to gradual decay and entropy, but I think these are the areas that are important to test if you are serious about building decent quality software. What I like about the approach is that the output reports are nice, clean and simple. They allow you to report on really varied requirements in a consistent manner and allow you to have a data driven conversation if things start to slide.</p>
<p>The post <a rel="nofollow" href="http://eyefodder.com/2011/06/quality-software-testing-non-functional-requirements.html">Making Quality Software: how to test non-functional requirements</a> appeared first on <a rel="nofollow" href="http://eyefodder.com">Eyefodder</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://eyefodder.com/2011/06/quality-software-testing-non-functional-requirements.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making Quality Software: 12 non functional requirements every app should have.</title>
		<link>http://eyefodder.com/2011/06/quality-software-non-functional-requirements.html</link>
		<comments>http://eyefodder.com/2011/06/quality-software-non-functional-requirements.html#comments</comments>
		<pubDate>Tue, 07 Jun 2011 02:24:18 +0000</pubDate>
		<dc:creator><![CDATA[Paul Barnes-Hoggett]]></dc:creator>
				<category><![CDATA[Quality Software]]></category>

		<guid isPermaLink="false">http://www.eyefodder.com/?p=107</guid>
		<description><![CDATA[<p>When people talk about really great quality software, they usually think in terms of it&#8217;s utility, simplicity or aesthetics. But there&#8217;s more to it than that. A really great piece of software will bleed quality through and through like a piece of Brighton Rock (or Bognor Regis). What separates high quality software from mediocrity? It&#8217;s [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://eyefodder.com/2011/06/quality-software-non-functional-requirements.html">Making Quality Software: 12 non functional requirements every app should have.</a> appeared first on <a rel="nofollow" href="http://eyefodder.com">Eyefodder</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>When people talk about really great quality software, they usually think in terms of it&#8217;s utility, simplicity or aesthetics. But there&#8217;s more to it than that. A really great piece of software will bleed quality through and through like a piece of Brighton Rock (or <a href="http://www.flickr.com/photos/charlottehbest/5775157361/" target="_blank">Bognor Regis</a>). What separates high quality software from mediocrity? It&#8217;s being aware of and planning for the right constraints to put on the way you develop software. Frank Lloyd Wright did his best work in tightly constrained spaces and awkward sites, and as software engineers we need to do the same to avoid flabby work. Here&#8217;s my list of twelve constraints I&#8217;d plan for on my next project:<br />
<span id="more-107"></span><br />
<a title="Falling Water by amanderson2, on Flickr" href="http://www.flickr.com/photos/amanderson/454044257/"><img src="http://farm1.static.flickr.com/191/454044257_0b26b21e0d.jpg" alt="Falling Water" width="375" height="500" /></a><br />
<em>Great architecture comes from great constraints</em></p>
<h2>How I arrived at this list</h2>
<p>I started to look at this a little while back when I was putting together our <a href="http://blogs.adobe.com/swebster/2010/03/3_steps_to_inno.php#more">playbook</a> for how we create software for our customers by bringing together <a href="http://agilemanifesto.org/">agile</a> and <a href="http://en.wikipedia.org/wiki/User-centered_design">user centred design</a> together. We articulate our requirements as <a href="http://www.mountaingoatsoftware.com/topics/user-stories">User Stories</a>, but outside of the functional aspects of the system, I realized that there are a common set of non-functional requirements that we saw the need for over and over again. Mike Griffiths has put together a great checklist of n<a href="http://leadinganswers.typepad.com/leading_answers/2009/03/nonfunctional-requirements-minimal-checklist.html">on-functional requirements</a>, but I felt that a number of them could be covered off and scheduled in standard stories. What follows are the ones that to me are about how a development team needs to think and behave over time:</p>
<h2>Performance</h2>
<p>This one shouldn&#8217;t come as a surprise. Quality software has to be fast. Or at least feel fast. As a front-end guy, this is the one I always feel first. &#8220;It&#8217;s not fast enough&#8221; is a battle I never want to get into. I had this reported as a bug against one of my projects, but the client wouldn&#8217;t specify what &#8220;fast enough&#8221; was; talk about moving goalposts. When you think about an app being performant, thing about specifying the following:</p>
<h3>1. Response times</h3>
<p>How long should your app take to load? What about screen refresh times or choreography?</p>
<h3>2. Processing times</h3>
<p>Can I get a <a href="http://en.wikipedia.org/wiki/Spinning_wait_cursor">spinning beachball</a> please? How long is acceptable to perform key functions or export / import data?</p>
<h3>3. Query and Reporting times</h3>
<p>This could be covered off with general reporting times, but if you&#8217;re providing an API you should probably consider acceptable query times too.</p>
<h2>Capacity and Scalability</h2>
<p>How much do you need to cope with now, and how much do you think you&#8217;ll need to cope with in the future. Unless you are truly blessed with an incredibly forgiving audience (or a great illustrator), you won&#8217;t be able to get away with your own fail whale.<br />
<a title="Yiying Lu's Fail Whale for twitter" href="http://www.yiyinglu.com/sc/illustration"><img src="http://www.yiyinglu.com/showcase/30.%20Illustration/01.%20Naive%20Collection/05.gif" alt="Fail Whale" width="499" height="375" /></a><br />
<em>Your audience had better be pretty charmed by you if you can get away with regularly futzing on capacity</em></p>
<h3>4. Throughput</h3>
<p>Think about how many transactions your system needs to handle. A thousand a day? A million? When Amazon solved this for their needs, they decoupled systems and created a <a href="http://aws.amazon.com/sqs/">queue service</a> that became the foundation of AWS.</p>
<h3>5. Storage</h3>
<p>How much data are you going to need to store to do the awesomeness you need it to do?</p>
<h3>6. Growth Requirements</h3>
<p>This is a tough one, because truly you don&#8217;t know how popular your app is going to be until it&#8217;s out there. But you can bet (or hope) that someone has made predictions about how wildly successful your app is going to be. Be wary of over engineering here, but at least make sure you aren&#8217;t constantly <a href="http://techcrunch.com/2010/06/08/twitter-190-million-users/?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A+Techcrunch+%28TechCrunch%29&amp;utm_content=Google+Reader">laying down track in front of a moving train</a>.</p>
<h2>Availability</h2>
<p>Does your system need to be available all the time, and to everyone? Most of the time you can get away with the occasional vacation, but knowing what&#8217;s important helps you make good decisions. Quality software ain&#8217;t quality if its down when your precious users need it<br />
<a title="iPad2 line by mohrolsen, on Flickr" href="http://www.flickr.com/photos/mohrolsen/5558757306/"><img src="http://farm6.static.flickr.com/5144/5558757306_12aca10bb4.jpg" alt="iPad2 line" width="500" height="500" /></a></p>
<p><em>Can you get away with a product that is rarely available?</em></p>
<h3>7. Hours of operation</h3>
<p>When does your app need to be available? If you need to do a database upgrade or a system backup, can you take the system offline while you do it?</p>
<h3>8. Locations of operation</h3>
<p>A few things to think about here: Geographic location, connection requirements and the restrictions of a local network prevail. If you are building a killer app for use behind the corporate firewall, you&#8217;d better make damn sure you aren&#8217;t using any exotic ports.</p>
<h2>Maintainability</h2>
<p>When you&#8217;re running a software project you are at constant war against <a href="http://pragprog.com/the-pragmatic-programmer/extracts/software-entropy">software entropy</a>. This is your chance to save yourself from having to live with shitty code, or leave shitty code for others to pile more shit onto. I&#8217;m passionate about this; can you tell?</p>
<p><a title="76:365 Broken by Bamagirl7, on Flickr" href="http://www.flickr.com/photos/bamagirl7/3362031185/"><img src="http://farm4.static.flickr.com/3608/3362031185_ea2d4d9796.jpg" alt="76:365 Broken" width="500" height="333" /></a><br />
<em>Don&#8217;t live with broken windows</em></p>
<h3>9. Architectural Standards</h3>
<p>What&#8217;s important here is that the code is going to feel like a consistent body of work, not some ad-hoc glom of a bunch of developers&#8217; whims. Define what the standards need to be else you&#8217;ll always be discussing the merits of different styles.</p>
<h3>10. Coding Standards</h3>
<p>Again &#8211; decide on the coding standards for the application and stick to them!</p>
<h2>Recovery</h2>
<p>You are prepared for a disaster, right? Right? And if a disaster happens, how long&#8217;s it going to take to get back up and running?<br />
<a title="Storage centre SF by eyefodder, on Flickr" href="http://www.flickr.com/photos/eyefodder/5806901462/"><img src="http://farm4.static.flickr.com/3079/5806901462_68c00a7cb6.jpg" alt="Storage centre SF" width="500" height="333" /></a></p>
<p><em>Backing up your stuff somewhere is smart, but how long will it take to get it out of storage?</em></p>
<h3>11. Restore time</h3>
<p>I know you don&#8217;t want to think about the worst happening, but if it does, ask yourself how long should it take to get back up and running?</p>
<h3>12. Backup time</h3>
<p>Speaking of which, how long does it take to back your data?</p>
<h2>It doesn&#8217;t need to be all doom and gloom</h2>
<p>I know when I first put together this list, I felt a bit deflated at all the extra specification I was laying onto my magic development world. In truth though it&#8217;s not all that bad. In fact I&#8217;ve done the hard legwork for you in editing down the list. If you just think through these things early on in development, you can be pretty sure you are going to save yourself either under- or over-engineering your app, and be much more likely to produce decent quality software that you can be proud of.</p>
<p>The post <a rel="nofollow" href="http://eyefodder.com/2011/06/quality-software-non-functional-requirements.html">Making Quality Software: 12 non functional requirements every app should have.</a> appeared first on <a rel="nofollow" href="http://eyefodder.com">Eyefodder</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://eyefodder.com/2011/06/quality-software-non-functional-requirements.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
