<?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>aimee daniells &#187; pair programming</title>
	<atom:link href="http://edendevelopment.co.uk/blogs/aimee/tag/pair-programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://edendevelopment.co.uk/blogs/aimee</link>
	<description>apprentice to Enrique Comba Riepenhausen</description>
	<lastBuildDate>Wed, 25 Aug 2010 16:20:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>What&#8217;s a pomodoro?</title>
		<link>http://edendevelopment.co.uk/blogs/aimee/2010/08/20/whats-a-pomodoro/</link>
		<comments>http://edendevelopment.co.uk/blogs/aimee/2010/08/20/whats-a-pomodoro/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 15:44:44 +0000</pubDate>
		<dc:creator>aimee</dc:creator>
				<category><![CDATA[i use tags, not categories]]></category>
		<category><![CDATA[pair programming]]></category>
		<category><![CDATA[pomodoro]]></category>
		<category><![CDATA[time management]]></category>

		<guid isPermaLink="false">http://edendevelopment.co.uk/blogs/aimee/?p=111</guid>
		<description><![CDATA[At eden, we often use the Pomodoro Technique&#8482; to manage our time effectively. What exactly is a pomodoro? You could find out on the Dizionario di Italiano but i&#8217;ll give you a clue: it&#8217;s a tomato.

A tomato?! How does a tomato help us manage time and increase our productivity? Well when we talk about pomodoros, [...]]]></description>
			<content:encoded><![CDATA[<p>At eden, we often use the Pomodoro Technique&trade; to manage our time effectively. What exactly is a pomodoro? You could <a href="http://dizionari.corriere.it/dizionario_italiano/P/pomodoro.shtml">find out on the <em>Dizionario di Italiano</em></a> but i&#8217;ll give you a clue: it&#8217;s a tomato.</p>
<p><a href="http://twitpic.com/2ghpnr" title="Share photos on twitter with Twitpic"><img src="http://twitpic.com/show/thumb/2ghpnr.jpg" width="150" height="150" alt="Share photos on twitter with Twitpic"></a></p>
<p>A tomato?! How does a tomato help us manage time and increase our productivity? Well when we talk about pomodoros, we&#8217;re actually talking about a 25-minute block of time followed by a 5-minute break to reflect and assess how we&#8217;re doing and what we will do in the next 25 minutes. After four of these we take a longer break. If we&#8217;re really serious about the technique, we aim to do 12 pomodoros in a day.</p>
<p>This is <a href="http://www.pomodorotechnique.com/">the Pomodoro Technique</a> created by Francesco Cirillo in 1992. It is called Pomodoro because Francesco used one of those kitchen timers shaped like a tomato.</p>
<p>These are the five simple steps of the Pomodoro Technique: </p>
<ol>
<li>Choose a task to be accomplished</li>
<li>Set the Pomodoro to 25 minutes (the Pomodoro is the timer)</li>
<li>Work on the task until the Pomodoro rings, then put a check on your sheet of paper</li>
<li>Take a short break (5 minutes is OK)</li>
<li>Every 4 Pomodoros take a longer break</li>
</ol>
<p>We don&#8217;t actually use a kitchen timer (though i think it would be cool to have some!) but we use software tools instead. We use <a href="http://www.apple.com/downloads/macosx/development_tools/pomodoro.html">Apple&#8217;s Pomodoro timer</a> which has Growl integration and keeps track of tasks and interruptions. When pairing remotely we use <a href="http://tomatoi.st/">http://tomatoi.st/</a> which enables both people to see the time as it counts down.</p>
<p>At eden, pomodoro time is highly respected in terms of not interrupting unless it is really urgent. It&#8217;s very easy to say, <em>&#8220;We&#8217;re on a pomodoro&#8221;</em> and people know that you&#8217;ll talk to them in your next break.</p>
<p>We find that the Pomodoro Technique increases our focus, keeps us on track with what we&#8217;re doing, and keeps us in control of our time, rather than time controlling us. For ideas and resources, visit <a href="http://pomodorotechnique.com/">PomodoroTechnique.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://edendevelopment.co.uk/blogs/aimee/2010/08/20/whats-a-pomodoro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Cucumber to test concurrency issues</title>
		<link>http://edendevelopment.co.uk/blogs/aimee/2010/08/12/using-cucumber-to-test-concurrency-issues/</link>
		<comments>http://edendevelopment.co.uk/blogs/aimee/2010/08/12/using-cucumber-to-test-concurrency-issues/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 14:34:20 +0000</pubDate>
		<dc:creator>aimee</dc:creator>
				<category><![CDATA[i use tags, not categories]]></category>
		<category><![CDATA[concurrency]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[pair programming]]></category>
		<category><![CDATA[tdd]]></category>

		<guid isPermaLink="false">http://edendevelopment.co.uk/blogs/aimee/?p=101</guid>
		<description><![CDATA[Recently i encountered a concurrency problem of the type where there is a queue of things to do, and users press a button to be automatically assigned the next item in the queue. The bug report was that two users could get assigned the same item.
My pair programmer and i tried to reproduce the problem [...]]]></description>
			<content:encoded><![CDATA[<p>Recently i encountered a concurrency problem of the type where there is a queue of things to do, and users press a button to be automatically assigned the next item in the queue. The bug report was that two users could get assigned the same item.</p>
<p>My pair programmer and i tried to reproduce the problem using two computers, but we couldn&#8217;t. We were only running one Rails instance, but we know that in the production environment there are multiple load-balanced servers pointing to one database, so we had an inkling that we&#8217;d be able to produce it using multi-threading.</p>
<p>To give it a test, we wrote a Rake task which we ran in two terminal windows to mimic the simultaneous access. The Rake task looked something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">join</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">dirname</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">__FILE__</span><span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#996600;">'..'</span>, <span style="color:#996600;">'..'</span>, <span style="color:#996600;">'config'</span>, <span style="color:#996600;">'environment.rb'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
namespace <span style="color:#ff3333; font-weight:bold;">:test</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  task <span style="color:#ff3333; font-weight:bold;">:take_next_for</span>, <span style="color:#ff3333; font-weight:bold;">:login</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>t, args<span style="color:#006600; font-weight:bold;">|</span>
    user = User.<span style="color:#9900CC;">find_by_login</span><span style="color:#006600; font-weight:bold;">&#40;</span>args<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:login</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    user.<span style="color:#9900CC;">take_next_item</span>
    <span style="color:#CC0066; font-weight:bold;">puts</span> user.<span style="color:#9900CC;">item</span>.<span style="color:#9900CC;">inspect</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>This is easily called by running:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rake <span style="color: #7a0874; font-weight: bold;">test</span>:take_next_for<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">'ann'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<p>We ran it for two users simultaneously and inspected the output. Sure enough they were being assigned the same item.</p>
<p>Since there is only one database, we knew that we could fix it with a carefully placed transaction and lock on the database. But we wanted to add a Cucumber feature so that we could be sure it was working, and to give us confidence that the bug would not come back again in the future.</p>

<div class="wp_syntax"><div class="code"><pre class="cucumber" style="font-family:monospace;">  Scenario: Two users take next item simultaneously
    Given a user with login &quot;ann&quot;
    And a user with login &quot;bob&quot;
    And an available item called &quot;Item 1&quot;
    And an available item called &quot;Item 2&quot;
    When two users attempt to take the next item at the same time
    Then they should each have taken different items</pre></div></div>

<p>Notice we can&#8217;t actually say who gets which item &#8211; it&#8217;s a race condition. We can only check that both of them have an item and that they are not the same item. We could alternatively check that both of the items have successfully been taken.</p>
<p>Testing this concurrency issue in Cucumber turned out to be somewhat tricky. We tried using simple Ruby threads in Cucumber, but it wasn&#8217;t properly simultaneously. I guess the single Cucumber environment still only does one thing at a time. So it was back to the Rake task.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">When</span> <span style="color:#006600; font-weight:bold;">/</span>^two users attempt to take the <span style="color:#9966CC; font-weight:bold;">next</span> item at the same time$<span style="color:#006600; font-weight:bold;">/</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  t1 = <span style="color:#CC00FF; font-weight:bold;">Thread</span>.<span style="color:#9900CC;">new</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#996600;">`RAILS_ENV=cucumber rake test:take_next_for['ann']`</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
  t2 = <span style="color:#CC00FF; font-weight:bold;">Thread</span>.<span style="color:#9900CC;">new</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#996600;">`RAILS_ENV=cucumber rake test:take_next_for['bob']`</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
  t1.<span style="color:#9900CC;">join</span>
  t2.<span style="color:#9900CC;">join</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>We &#8216;join&#8217; the two threads to make sure they&#8217;ve both finished before carrying on.</p>
<p>It&#8217;s slow because it loads up a whole new Rails environment for each of the Rake tasks, but that is exactly what we want to do, to mimic the concurrency of the production system.</p>
<p>The next problem we encountered was that Cucumber scenarios are run inside a transaction which means that a Rake task running outside of it cannot see the users and items we just created. So we had to tag the scenario as <code>@no-txn</code> so that they would be available externally and <code>@clean-up-afterwards</code> so that we could remove them from the database.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">After <span style="color:#996600;">&quot;@clean-up-afterwards&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  User.<span style="color:#9900CC;">destroy_all</span>
  Item.<span style="color:#9900CC;">destroy_all</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>With this in place the Cucumber scenario failed as we hoped it would! Then it was simply a matter of creating a transaction from the moment we find the next item (with a database lock) until we have successfully assigned the item. This is a simplified version of what we ended up with:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> User <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
  has_one <span style="color:#ff3333; font-weight:bold;">:item</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> take_next_item
    transaction <span style="color:#9966CC; font-weight:bold;">do</span>
      item = Item.<span style="color:#9900CC;">available</span>.<span style="color:#9900CC;">by_priority</span>.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:first</span>, <span style="color:#ff3333; font-weight:bold;">:lock</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">item</span> = item
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>The Cucumber scenario passed and the problem was solved. In the live system, if two users now try to take an item at the same time, one of them has to wait a moment until the database has finished assigning to the first user so that it can assign a different item to the second user.</p>
<p>How would you have tested a concurrency issue like this? Are there better ways of imitating a multi-server production environment than the solution we came up with?</p>
]]></content:encoded>
			<wfw:commentRss>http://edendevelopment.co.uk/blogs/aimee/2010/08/12/using-cucumber-to-test-concurrency-issues/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>760th day at Eden</title>
		<link>http://edendevelopment.co.uk/blogs/aimee/2010/07/09/760th-day-at-eden/</link>
		<comments>http://edendevelopment.co.uk/blogs/aimee/2010/07/09/760th-day-at-eden/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 18:25:48 +0000</pubDate>
		<dc:creator>aimee</dc:creator>
				<category><![CDATA[i use tags, not categories]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[learn to type week]]></category>
		<category><![CDATA[pair programming]]></category>
		<category><![CDATA[practice]]></category>

		<guid isPermaLink="false">http://edendevelopment.co.uk/blogs/aimee/?p=81</guid>
		<description><![CDATA[We have a new intern at Eden. Tom Crayford studies Software Engineering at Sheffield University and is doing a 2&#189; month internship with us, with the possibility of becoming an apprentice at the end of it.
In the style of Tom&#8217;s two recent blog posts, First day at Eden and Second day at Eden i thought [...]]]></description>
			<content:encoded><![CDATA[<p>We have a new intern at Eden. <a href="http://www.tcrayford.net/">Tom Crayford</a> studies Software Engineering at Sheffield University and is doing a 2&frac12; month internship with us, with the possibility of becoming an apprentice at the end of it.</p>
<p>In the style of Tom&#8217;s two recent blog posts, <a href="http://www.tcrayford.net/2010/07/08/First-Day.html">First day at Eden</a> and <a href="http://www.tcrayford.net/2010/07/09/Second-Day.html">Second day at Eden</a> i thought i might also write about my day, since it was a particularly satisfying one. It just so happens to be two years and a month (760 days) since i joined Eden!</p>
<p>Straight after this morning&#8217;s stand-up meeting, I had a quick debrief of a meeting we had with a potential new client yesterday evening. Then i helped Todd to write an email. We draft our emails on Google Wave these days, which is often fun. Four of us were editing the email at once, which means we quickly get to something we&#8217;re all happy with before sending it.</p>
<p>I went out for a walk with Frances to pay in some cheques and buy some Friday Treats for everyone!</p>
<p>At lunch time some of us had several rounds of <a href="http://play.typeracer.com/">TypeRacer</a> in preparation for <a href="http://programmingtour.blogspot.com/2010/07/learn-to-type-week.html">Learn To Type Correctly Week</a> next week! I think it&#8217;s incredible how so many people have got enthusiastic about learning to type well after Corey Haines announced it. If you don&#8217;t believe me, check the twitter hashtag, <a href="http://search.twitter.com/search?q=%23learn2typewk">#learn2typewk</a>!</p>
<p>Something quite unusual happened after lunch. We had a message from Richard Knoll at <a href="http://www.merciacyclingclub.org/">Mercia Cycling Club</a> in trouble and needing help because the site was not responding. Richard had found us on Google after searching for Ruby on Rails. I agreed to look at it with Tom for an hour and see if we could figure out what was wrong. We determined that rubygems and Radiant had been upgraded on the server and we needed to tweak a few configuration files. With help from Chris and Spencer, the site was back within the hour! Chris then helped me to raise an invoice for an hour&#8217;s work.</p>
<p>It&#8217;s interesting that we can do anything from a fast restore of an unresponsive website, to projects that take several months from start to finish, requiring two or three pairs of developers working at a time.</p>
<p>Tom and i continued to pair together for the rest of the afternoon. We were able to add value to a project to help a charity in Cambodia. I always learn something whenever i pair with someone. Tom is no exception and i very much enjoyed pairing together today. We all have things we can teach each other.</p>
<p>Tonight i think i might learn a bit from the <a href="http://github.com/edgecase/ruby_koans">Ruby Kōans</a>, possibly study a bit of <a href="http://mitpress.mit.edu/sicp/">SICP</a>, and definitely see who gets evicted from Big Brother!</p>
]]></content:encoded>
			<wfw:commentRss>http://edendevelopment.co.uk/blogs/aimee/2010/07/09/760th-day-at-eden/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remote trio programming</title>
		<link>http://edendevelopment.co.uk/blogs/aimee/2010/01/06/remote-trio-programming/</link>
		<comments>http://edendevelopment.co.uk/blogs/aimee/2010/01/06/remote-trio-programming/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 22:52:36 +0000</pubDate>
		<dc:creator>aimee</dc:creator>
				<category><![CDATA[i use tags, not categories]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[pair programming]]></category>
		<category><![CDATA[remote working]]></category>
		<category><![CDATA[trio programming]]></category>

		<guid isPermaLink="false">http://edendevelopment.co.uk/blogs/aimee/?p=37</guid>
		<description><![CDATA[If pair programming is good, trio programming must be great, right?
Well, normally no, probably not, but today i had a trio programming experience that worked really well. Two of us were new to the codebase and together we learnt a lot from the person who knows the code well.
Of course, we all did not crowd [...]]]></description>
			<content:encoded><![CDATA[<p>If pair programming is good, trio programming must be great, right?</p>
<p>Well, normally no, probably not, but today i had a trio programming experience that worked really well. Two of us were new to the codebase and together we learnt a lot from the person who knows the code well.</p>
<p>Of course, we all did not crowd around a single computer. That would not be comfortable at all. Due to the snowfall, most of <a href="http://twitter.com/edendevelopment/team">the edenites</a> were working from home today, so it gave us a great opportunity to find an effective way to pair remotely.</p>
<p>Initially we tried iChat screen sharing, but the screen updates are too slow to be satisfying. <a href="http://tooky.github.com/">Steve</a> had the idea of using <a href="http://www.gnu.org/software/screen/">GNU Screen</a> so that we could all access the same terminal window via SSH.</p>
<p>Using a VPN to the office network, we were able to tunnel to Steve&#8217;s laptop and access the screen. In fact we found it useful to have two screens running: one for editing code in Vim and another screen for running Cucumber features. The exciting thing is, we don&#8217;t all have to look at the same screen at the same time: each person is free to switch screens on their own machine without affecting the others.</p>
<p>A Skype conference call completed the experience so that we could talk through our thought processes and learn the details of the codebase.</p>
<p>It was altogether a very profitable day. The snow, instead of being a hindrance today, helped us to find a very effective way of allowing three people to collaborate on a codebase.</p>
]]></content:encoded>
			<wfw:commentRss>http://edendevelopment.co.uk/blogs/aimee/2010/01/06/remote-trio-programming/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
