<?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>Company Blog &#187; bdd</title>
	<atom:link href="http://edendevelopment.co.uk/blogs/company/category/bdd/feed/" rel="self" type="application/rss+xml" />
	<link>http://edendevelopment.co.uk/blogs/company</link>
	<description>Eden Development Company Blog</description>
	<lastBuildDate>Sun, 21 Feb 2010 08:22:31 +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>Four things (of many) we learnt from Liz Keogh</title>
		<link>http://edendevelopment.co.uk/blogs/company/2009/07/28/four-things-of-many-we-learnt-from-liz-keogh/</link>
		<comments>http://edendevelopment.co.uk/blogs/company/2009/07/28/four-things-of-many-we-learnt-from-liz-keogh/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 21:41:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[agile]]></category>
		<category><![CDATA[bdd]]></category>

		<guid isPermaLink="false">http://edendevelopment.co.uk/blogs/company/?p=490</guid>
		<description><![CDATA[We&#8217;ve had the great pleasure of having Liz Keogh doing some agile coaching with us for the last two days.
I invited Liz after meeting her at the BDD workshop I ran last week. We were very lucky that she was free and available at short notice. I felt we had a pretty good agile system [...]]]></description>
			<content:encoded><![CDATA[<p><img align='right' alt="Liz Keogh" src="http://lunivore.com/images/liz_small.jpg" title="Liz Keogh" width="163" height="154" />We&#8217;ve had the great pleasure of having <a href="http://lunivore.com">Liz Keogh</a> doing some agile coaching with us for the last two days.</p>
<p>I invited Liz after meeting her at the <a href="http://edendevelopment.co.uk/blogs/company/2009/07/25/rails-underground-bdd-workshop-on-23rd-july">BDD workshop</a> I ran last week. We were very lucky that she was free and available at short notice. I felt we had a pretty good agile system set up here, but we&#8217;d not scaled it to a larger team (6+) before and we were coming up against issues (such as the best ways of estimating) which we felt Liz could help us with. </p>
<p>It&#8217;s been enormously beneficial to have Liz with us. Much of our practice were validated: pair programming, co-location, BDD, outside-in, continuous integration. These are core tenets of our process which have been proven in many companies. Instead of changing our basic practice, Liz has helped us to the next level through much conversation and discussion.</p>
<p>Here&#8217;s a few snippets of what we&#8217;ve learned and how we&#8217;re tweaking our process to give our clients the maximum number of features with the shortest possible lead time.</p>
<h3>Use Feature Injection to force the value question</h3>
<p>One small change with big ramifications is the concept of <a href="http://lizkeogh.com/2008/09/10/feature-injection-and-handling-technical-stories/">Feature Injection</a>. </p>
<p>In brief, this means changing the way you write stories so that instead of having:</p>
<pre lang='cucumber'>
As a <role>
I want <feature>
so that <benefit>
</pre>
<p>You have:</p>
<pre lang='cucumber'>
In order to <deliver some business benefit>
<these people>
will need
<these features>.
</pre>
<p>Rather than just a way of specifying technical stories, we realised that by putting stakeholder value first, we are forcing the question of what&#8217;s actually necessary about this feature that causes us to do it in the first place. This ties our stories very much to stakeholder value, which ensures that everyone knows exactly what value is being provided when they&#8217;re working on a story.</p>
<p>Read more about Feature Injection <a href="http://lizkeogh.com/2008/09/10/feature-injection-and-handling-technical-stories/">here</a>.</p>
<h3>Keep completed stories visible</h3>
<p>Once our stories are clearly about stakeholder value, it&#8217;s important for everyone to see exactly which features currently exist, preferably broken down by stakeholder. We&#8217;re working on ways of getting the features list that we&#8217;ve already completed more visible to our clients. Once everyone can see what&#8217;s been delivered so far, it&#8217;s much clearer what should be worked on next.</p>
<p>One way of doing this might be a small <a href="http://rack.rubyforge.org/">Rack</a> app which handles /admin/features and returns all the features grouped by tag&#8230; does anyone know of a Rails plugin that might do something similar?</p>
<h3>Ensure you can always release</h3>
<p>If we&#8217;re truly doing BDD, then we are delivering tiny slices of functionality that can be released immediately. Often we batch these into releases, often accompanied by a rather laborious and crunch-like polish process.</p>
<p>However, there&#8217;s no reason that we shouldn&#8217;t be ensuring that the site is release ready at any point. If this is the case, the stakeholders have the option to say &#8220;Done &#8211; ship it!&#8221; whenever they like, and we&#8217;re able to do this straight away, rather than after a three week polish + skin period, and the dreaded IE6 compatibility check.</p>
<p>Lesson learned: Get a site release-able as fast as possible, and keep it there.</p>
<h3>Put performance tests in the build</h3>
<p>As developers we are always concerned about timing our performance improvements. How do we balance over-optimising a site with doing performance testing too late and risking a meltdown? How do we ensure that performance is kept at an acceptable level?</p>
<p>If the goal is to always keep a project release ready, then we need to ensure that our new system hasn&#8217;t introduced any serious performance issues, which bring it below a minimum performance level. If you are guaranteeing to your client that your site can handle a certain level of traffic, then anything that breaks that effectively breaks the build. Therefore, what better way to do this than make your performance tests part of your build?</p>
<h3>And there&#8217;s more&#8230;</h3>
<p>I plan to blog further about some of the other things we learned: including the major insight about the benefits of a Lean approach, which is worthy of its own post.</p>
<p>Do you have strong opinions about the above? Do you disagree? Let us know!</p>
]]></content:encoded>
			<wfw:commentRss>http://edendevelopment.co.uk/blogs/company/2009/07/28/four-things-of-many-we-learnt-from-liz-keogh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails Underground BDD Workshop on 23rd July</title>
		<link>http://edendevelopment.co.uk/blogs/company/2009/07/25/rails-underground-bdd-workshop-on-23rd-july/</link>
		<comments>http://edendevelopment.co.uk/blogs/company/2009/07/25/rails-underground-bdd-workshop-on-23rd-july/#comments</comments>
		<pubDate>Sat, 25 Jul 2009 11:37:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[agile]]></category>
		<category><![CDATA[bdd]]></category>
		<category><![CDATA[conferences]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[rspec]]></category>

		<guid isPermaLink="false">http://edendevelopment.co.uk/blogs/company/?p=483</guid>
		<description><![CDATA[A couple of days ago I ran a BDD workshop the day before Rails Underground. Skills Matter videoed the event and will provide the podcast + slides here, but if you&#8217;re impatient download the slides here.
I really enjoyed doing my first talk about Ruby/Rails &#8211; teaching it was great fun. Even though I&#8217;m sure we [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of days ago I ran a BDD workshop the day before <a href="http://rails-underground.com">Rails Underground</a>. Skills Matter videoed the event and will provide the podcast + slides <a href="http://skillsmatter.com/event/design-architecture/bdd-workshop">here</a>, but if you&#8217;re impatient download the slides <a href='http://edendevelopment.co.uk/blogs/company/wp-content/blogs.dir/8/files/2009/07/bdd-workshop.pdf'>here</a>.</p>
<p>I really enjoyed doing my first talk about Ruby/Rails &#8211; teaching it was great fun. Even though I&#8217;m sure we can improve further, we get a lot of value from BDD, Cucumber and RSpec and it was good to pass that on and give something back to this excellent community.</p>
<p>The workshop was free &#8211; if you got something out of it please make a donation to the Red Cross through the Rails Underground <a href="http://www.justgiving.com/railsunder/">donation page</a>.</p>
<p><strong>Update:</strong> the video is now available <a href="http://bit.ly/FVMgU">here</a>. If you were there, there&#8217;s a <a href="http://bit.ly/FVMgU">rating and feedback page</a> for it.</p>
]]></content:encoded>
			<wfw:commentRss>http://edendevelopment.co.uk/blogs/company/2009/07/25/rails-underground-bdd-workshop-on-23rd-july/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Pivotal Tracker: Fantastic app, shame it&#8217;s free</title>
		<link>http://edendevelopment.co.uk/blogs/company/2009/03/16/pivotal-tracker-fantastic-app-shame-its-free/</link>
		<comments>http://edendevelopment.co.uk/blogs/company/2009/03/16/pivotal-tracker-fantastic-app-shame-its-free/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 15:03:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[bdd]]></category>
		<category><![CDATA[business]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://edendevelopment.co.uk/blogs/company/?p=356</guid>
		<description><![CDATA[
I&#8217;ve been digging around for a decent agile PM tool for a while, and stumbled across Pivotal Tracker on Twitter a couple of days ago.
Within about thirty minutes of trying it out, I was totally hooked. We&#8217;ve rolled our own basic project management tool internally, but we&#8217;ve yet to get the time to put proper [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://pivotaltracker.com"><div id="attachment_372" class="wp-caption aligncenter" style="width: 510px"><img src="http://edendevelopment.co.uk/blogs/company/wp-content/blogs.dir/8/files/2009/03/pivotal-tracker1.png" alt="All this... for nothing?" title="Pivotal Tracker" width="500" height="213" class="size-full wp-image-372" /><p class="wp-caption-text">All this... for nothing?</p></div></a></p>
<p>I&#8217;ve been digging around for a decent agile PM tool for a while, and stumbled across <a href='http://www.pivotaltracker.com'>Pivotal Tracker</a> on <a href='http://twitter.com/pivotaltracker'>Twitter</a> a couple of days ago.</p>
<p>Within about thirty minutes of trying it out, I was totally hooked. We&#8217;ve rolled our own basic project management tool internally, but we&#8217;ve yet to get the time to put proper iterative development support into the app. Pivotal Tracker <em>just works</em>. With a clean UI and some great reporting tools, it&#8217;s all I need to run an agile project.</p>
<p>The one big downside is this: it&#8217;s completely free.</p>
<p>Wait, you say: surely that&#8217;s a good thing? Well, yes and no.</p>
<h3>Why great software should cost money</h3>
<p>When I pay for an app on the net, I expect a few things:</p>
<ul>
<li>It&#8217;s going to be up pretty much all the time.</li>
<li>It&#8217;s not going to vanish tomorrow.</li>
<li>It&#8217;s not going to suddenly cost a fortune.</li>
</ul>
<p>With Pivotal Tracker, I&#8217;ve no idea when they&#8217;re going to take the software down for maintenance. I&#8217;ve seen reports of it going down without notices for 15 minutes here and there, which is fine if it&#8217;s a non-critical service. It is however most definitely not fine when my client is trying to comment on features. I also have no guarantee that it&#8217;s not going to suddenly disappear into the night, taking all my stories and possibly the project itself with it.</p>
<p>The other issue is that if I&#8217;m paying $20/month for it, I&#8217;ve a reasonable expectation that it&#8217;s not going to cost say $200/month next month. It&#8217;s well within Pivotal&#8217;s rights to withdraw the free service and charge what they like for the paying version, without any notice.</p>
<p>Are we going to use it anyway? Yes we are: it&#8217;s too good to ignore. However, we&#8217;ve put in place the following cron job to mitigate the risk:</p>
<pre lang='shell'>
*/20 * * * * curl -H "X-TrackerToken: <our token>" -H
 "Content-type: application/xml" -X GET
 https://www.pivotaltracker.com/services/v2/projects/39382/stories
 > stories-backup.xml
</pre>
<p>This little piece of magic copies all our stories in XML form to our backup server every 20 minutes, so we&#8217;re not screwed if the site vanishes without notice. It would only take us about an hour to import this XML into our old system should we need to. That takes care of the main risk for me.</p>
<p>The conclusions: Some software shouldn&#8217;t be free. If you&#8217;re using Pivotal Tracker or any other free service in anger, make sure you&#8217;ve got a backup plan.</p>
]]></content:encoded>
			<wfw:commentRss>http://edendevelopment.co.uk/blogs/company/2009/03/16/pivotal-tracker-fantastic-app-shame-its-free/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Announcing Rails Business (UK)</title>
		<link>http://edendevelopment.co.uk/blogs/company/2009/02/23/announcing-rails-business-uk/</link>
		<comments>http://edendevelopment.co.uk/blogs/company/2009/02/23/announcing-rails-business-uk/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 14:47:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[bdd]]></category>
		<category><![CDATA[business]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://edendevelopment.co.uk/blogs/company/?p=341</guid>
		<description><![CDATA[One thing I&#8217;ve always thought missing from the Ruby on Rails scene in the UK is a decent get together of Rails business people &#8211; those who run their own businesses like myself. There&#8217;s plenty of technical groups, or groups that meet in the evening, but I couldn&#8217;t find anything in the daytime.
The best way [...]]]></description>
			<content:encoded><![CDATA[<p>One thing I&#8217;ve always thought missing from the Ruby on Rails scene in the UK is a decent get together of Rails business people &#8211; those who run their own businesses like myself. There&#8217;s plenty of technical groups, or groups that meet in the evening, but I couldn&#8217;t find anything in the daytime.</p>
<p>The best way to get what you want is to do it yourself, right? Therefore I&#8217;ve created a <a href="http://www.meetup.com/Rails-Business-UK/">meetup group</a> for it. The main aim is to discuss such things as: best practices in running a rails consultancy (of any size), best-practice ruby on rails development/project management, this Rails Maturity Model idea that&#8217;s been doing the rounds in the last few weeks, plus anything else that&#8217;s relevant.</p>
<p>Anyone who&#8217;s interested in the same sorts of issues discussed in this group is welcome to attend. For more details of our first meeting on 4th March, see <a href="http://www.meetup.com/Rails-Business-UK/calendar/9775083/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://edendevelopment.co.uk/blogs/company/2009/02/23/announcing-rails-business-uk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Starting at Eden</title>
		<link>http://edendevelopment.co.uk/blogs/company/2008/12/08/starting-at-eden/</link>
		<comments>http://edendevelopment.co.uk/blogs/company/2008/12/08/starting-at-eden/#comments</comments>
		<pubDate>Mon, 08 Dec 2008 12:51:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[bdd]]></category>
		<category><![CDATA[business]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.edendevelopment.co.uk/blog/?p=64</guid>
		<description><![CDATA[Not many people can honestly say that they are actually doing their dream job. Many people have dreams and aspirations, and somewhere along the line they end up in a completely different destination. Life just has that way of sidetracking you, without you even noticing. That being said, on September 21st 2008, I walked into [...]]]></description>
			<content:encoded><![CDATA[<p>Not many people can honestly say that they are actually doing their dream job. Many people have dreams and aspirations, and somewhere along the line they end up in a completely different destination. Life just has that way of sidetracking you, without you even noticing. That being said, on September 21st 2008, I walked into my dream job. Everything would be plain sailing from here on, the hard work had already be done getting here in the first place, right? Wrong.</p>
<p>From the first hour I realised that that these guys (and girl!) were good&#8230; really good. Not just that, they were talking in a completely different language to that which I was accustomed. Agile Development? Behaviour Driven Design? RSpec? Outside-in? Fixing broken windows&#8230; isn&#8217;t this a computer company? To say I was confused and a little scared at this point, would be an understatement. I still had a very big mountain to climb, in fact, my journey had only just started.</p>
<p>However over the last few months that I have been here, I have really started to grasp a lot of these concepts. Not perfect, or master them (that takes time and practice) but the value of them and how applicable they are to modern software design has blown me away. The concept of Agile Development and BDD isn&#8217;t completely strange and abstract, in fact, it&#8217;s quite simple:</p>
<ol>
<li>Write a story to explain the feature you are adding. (This can be done by the developer or customer)</li>
<li>Run the story (it involves Cucumbers, i&#8217;ll explain some other time)</li>
<li>The story fails (no code yet)</li>
<li>Write a spec for the code that you will finally implement (This is the second layer of testing)</li>
<li>Write code</li>
</ol>
<p>The first 4 steps can be repeated a few times before any real code is actually written. When you do come to write code though, you know it works. How? The specs tell you so. It&#8217;s magic. Compare this to how I was taught software development in University:</p>
<ol>
<li>Write a design document (This explains the entire system and its individual components)</li>
<li>Create UML diagrams and User Specifications for every Class in the system and how they interact</li>
<li>Write code</li>
</ol>
<p>Fewer steps, it must be quicker. What I didn&#8217;t mention was that the first two steps can take months alone. Often by the time that you actually come to write some code, a feature of the applications design has now changed, this means that has to be re-written and the diagrams all updated. Further delays. This monolithic approach is largely inefficient and frustrating!</p>
<p>So Agile Development works out better for the customer and better for us programmers (we actually get to do what we love doing!). Coupling that with strict testing at every step ensures fewer bugs and greater flexibility. You can approach each new feature/problem with confidence knowing that if any change you make breaks another part of the system, it will be caught by the tests failing. This is why the staff at Eden actually love doing what they do. They get to write awesome software, and have fun doing so. Compare this with the Games industry which is full of programmers who are overworked and burnt out. They were in what they thought was their dream job, but really wasn&#8217;t. I still have a mountain to climb to reach my new goals, but I&#8217;m having a lot of fun doing so!</p>
<p>Eden is a great company, with extremely talented staff. We have lots of really interesting projects spanning many different industries. I think this mountain will be quite fun to climb :)</p>
]]></content:encoded>
			<wfw:commentRss>http://edendevelopment.co.uk/blogs/company/2008/12/08/starting-at-eden/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Under the hood: RSpec as your early warning system</title>
		<link>http://edendevelopment.co.uk/blogs/company/2008/12/05/rspec-as-your-early-warning-system/</link>
		<comments>http://edendevelopment.co.uk/blogs/company/2008/12/05/rspec-as-your-early-warning-system/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 14:06:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[bdd]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[refactoring]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[under the hood]]></category>

		<guid isPermaLink="false">http://www.edendevelopment.co.uk/blog/?p=56</guid>
		<description><![CDATA[One of the most useful aspects of <a href="http://rspec.info">RSpec</a> and <a href="http://behaviour-driven.org/">BDD</a> is how it can highlight areas of your code that are obvious targets for improvement.]]></description>
			<content:encoded><![CDATA[<p><em>This article is part of our &#8216;under the hood&#8217; series, where we examine coding concepts and techniques related to how we build our products and services for our clients. If you&#8217;re of a technical bent, then do check out other articles as they appear in our &#8216;under the hood&#8217; category.</em></p>
<p>One of the most useful aspects of <a href="http://rspec.info">RSpec</a> and <a href="http://behaviour-driven.org/">BDD</a> is how it can highlight areas of your code that are obvious targets for improvement.</p>
<p>When we write our specs before our code we are effectively writing the API, the contract that our code must fulfill. It&#8217;s often the case that if this contract is hard to write, or just looks clumsy, then there may be a better way to express it.  This makes RSpec our first way of detecting <a href="http://en.wikipedia.org/wiki/Code_smell">code smells</a>.</p>
<p>Perhaps the easiest type of code smell to detect with RSpec is <a href="http://en.wikipedia.org/wiki/Law_of_Demeter">Law of Demeter</a> violations. Imagine a simple Ruby on Rails task management application. Tasks can be owned by Users. There may be many places where we would want to show who owns what Task. The simplest way to do this in Rails would be to use a belongs_to association to expose the attributes of the User to the Task. This makes it trivial to get the name of the user who is assigned to a task:</p>
<pre lang="ruby">class Task < ActiveRecord::Base
  belongs_to :owner, :class_name => "User"
end

# to get the owner name:
task.owner.name
</pre>
<p>While this is easy to write, it would make our specs more complex. Anywhere we wished to mock the name of the owner we would have to write something like the following:</p>
<pre lang="ruby">task.stub!(:owner).and_return(mock_model(User, :name => "Bob Smith"))</pre>
<p>There&#8217;s a lot of noise in this line. We&#8217;re creating a mock object just to produce the name of the user. Typing and maintaining test code like the above just seems unnecessary &#8212; we&#8217;re mocking more than we need. Perhaps worse, it doesn&#8217;t express our intentions clearly. We&#8217;re asking the task to return its owner, then asking that owner to give us its name. Instead of this approach, we can define the contract as we go and we can actually express our intention:</p>
<pre lang="ruby">task.stub!(:owner_name).and_return("Bob Smith")</pre>
<p>This makes our tests look tidier, but it actually has a more beneficial side effect. Even though we now have to write more code (speccing then adding the <code>owner_name</code> method to the Task class), it&#8217;s now the Task&#8217;s job to find the name of its owner. This makes our code more maintainable. For instance, imagine that not every task has an owner. With our original code, anywhere we explicitly used the owner association we would have to change the code to:</p>
<pre lang="ruby">(task.owner.nil? ? "No Owner" : task.owner.name)</pre>
<p>If this was used many times throughout our code base, we&#8217;ve suddenly got a large number of places to find and test this code. By defining the owner_name method early we avoided this problem because there&#8217;s only one place that now has to deal with the messy business of finding the name of the owner. Our other specs and stories aren&#8217;t broken because they can still happily call the <code>owner_name</code> method without worrying about how this is actually handled.</p>
<p>By using RSpec to help us separate out what information we want from how we get this information, we&#8217;ve made our codebase just a little bit cleaner and more maintainable.</p>
]]></content:encoded>
			<wfw:commentRss>http://edendevelopment.co.uk/blogs/company/2008/12/05/rspec-as-your-early-warning-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Personal victories</title>
		<link>http://edendevelopment.co.uk/blogs/company/2008/11/21/personal-victories/</link>
		<comments>http://edendevelopment.co.uk/blogs/company/2008/11/21/personal-victories/#comments</comments>
		<pubDate>Fri, 21 Nov 2008 20:48:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[bdd]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[refactoring]]></category>

		<guid isPermaLink="false">http://www.edendevelopment.co.uk/blog/?p=48</guid>
		<description><![CDATA[I love it when you can refactor a bulky, ugly function down into one line. It always makes me very happy indeed ...]]></description>
			<content:encoded><![CDATA[<p>I love it when you can refactor a bulky, ugly function down into one line. It always makes me very happy indeed. Here is my solution for outputting a person&#8217;s name in a nice format, taking title, initials, first name, surname, suffix. Initials take precedence over first name.</p>
<p>This is how i did it originally:<br/><br/></p>
<pre lang='ruby'>
  def contact_display_name
    returning String.new do |output|
      output << title + ' ' unless title.blank?
      if initials
        output << initials + ' ' unless initials.blank?
      else
        output << first_name + ' ' unless first_name.blank?
      end
      output << surname + ' ' unless surname.blank?
      output << suffix unless suffix.blank?
      output.strip!
    end
  end
</pre>
<p>Rather too long-winded for my liking. I managed to refactor it down to this:<br/><br/></p>
<pre lang='ruby'>
def contact_display_name
    [title, (initials? ? initials : first_name),
      surname, suffix].delete_if(&#038;:blank?).join(' ')
  end
</pre>
<p>Of course, it is another advantage of behaviour-driven development, that i had already specced out what i wanted to happen, and i could use the specs to ensure that my two versions of the function were equivalent. See below for the specs that verify the behaviour.</p>
<p><span id="more-48"></span></p>
<pre lang='ruby'>
 describe "contact_display_name" do
    it "should output the first_name and surname" do
      contact = Contact.new(:first_name => 'Gabriel', :surname =< 'Gray')
      contact.contact_display_name.should == 'Gabriel Gray'
    end

    it "should use the title if there is one" do
      contact = Contact.new(:title => 'Mr', :first_name => 'Gabriel',
        :surname => 'Gray')
      contact.contact_display_name.should == 'Mr Gabriel Gray'
    end

    it "should use the initials rather than the first_name if it has them" do
      contact = Contact.new(:title => 'Mr', :initials => 'G',
        :first_name => 'Gabriel', :surname => 'Gray')
      contact.contact_display_name.should == 'Mr G Gray'
    end

    it "should add on the suffix if there is one" do
      contact = Contact.new(:first_name => 'Gabriel', :surname => 'Gray',
        :suffix => 'BSc Hons')
      contact.contact_display_name.should == 'Gabriel Gray BSc Hons'
    end

    it "should not mind if there is no first name or initials" do
      contact = Contact.new(:title => 'Mr', :surname => 'Gray')
      contact.contact_display_name.should == 'Mr Gray'
    end

    it "should ignore any nil values" do
      contact = Contact.new(:title => '', :first_name => nil,
        :surname => 'Gray')
      contact.contact_display_name.should == 'Gray'
    end
  end
</pre>
]]></content:encoded>
			<wfw:commentRss>http://edendevelopment.co.uk/blogs/company/2008/11/21/personal-victories/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Cucumber is a joy</title>
		<link>http://edendevelopment.co.uk/blogs/company/2008/11/14/cucumber-is-a-joy/</link>
		<comments>http://edendevelopment.co.uk/blogs/company/2008/11/14/cucumber-is-a-joy/#comments</comments>
		<pubDate>Fri, 14 Nov 2008 16:23:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[bdd]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[rspec]]></category>

		<guid isPermaLink="false">http://www.edendevelopment.co.uk/blog/?p=44</guid>
		<description><![CDATA[Cucumber, the replacement for the rspec story runner, is an absolute joy to use. It only takes maybe a few minutes to move an old set of stories over to Cucumber features, plus you get full language support, something one of our coders might have taken slightly too far :-)
We&#8217;ve now switched all our active [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://github.com/aslakhellesoy/cucumber/tree/master" target="_blank">Cucumber</a>, the replacement for the rspec story runner, is an absolute joy to use. It only takes maybe a few minutes to move an old set of stories over to Cucumber features, plus you get full language support, something one of our coders might have taken <a href="http://aimee.mychores.co.uk/2008/11/10/post/362/" target="_blank">slightly too far</a> :-)</p>
<p>We&#8217;ve now switched all our active projects over. I highly recommend you do the same if you haven&#8217;t already &#8211; it&#8217;s a real step closer for us to the ideal situation where customers can collaborate on the text their own stories. <a href="http://aslakhellesoy.com/" target="_blank">Aslak</a> and the rest of the team have a lot to be proud of.</p>
]]></content:encoded>
			<wfw:commentRss>http://edendevelopment.co.uk/blogs/company/2008/11/14/cucumber-is-a-joy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The proof is in the testing</title>
		<link>http://edendevelopment.co.uk/blogs/company/2008/11/12/the-proof-is-in-the-testing/</link>
		<comments>http://edendevelopment.co.uk/blogs/company/2008/11/12/the-proof-is-in-the-testing/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 16:12:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[bdd]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.edendevelopment.co.uk/blog/?p=30</guid>
		<description><![CDATA[I am a recent convert to behaviour-driven-development (BDD) and this idea of writing stories and specs before writing code. Before I joined Eden Development, testing was always something that sounded like such a good idea &#8230; but I just didn&#8217;t have the time! Now I can&#8217;t imagine writing any code without tests. The idea seems [...]]]></description>
			<content:encoded><![CDATA[<p>I am a recent convert to behaviour-driven-development (BDD) and this idea of writing stories and specs before writing code. Before I joined Eden Development, testing was always something that sounded like such a good idea &#8230; but I just didn&#8217;t have the time! Now I can&#8217;t imagine writing any code without tests. The idea seems positively frightening!</p>
<p>Here are some reasons why i have been won over by the test-first philosophy:</p>
<p><strong>1. One thing at a time</strong><br />
Of course we all like to write very small concise functions, don&#8217;t we? But even in a small function, there are usually a few different paths that could be taken through it. It is so beneficial for me to think of scenarios one by one, write up the expected outcome, and then write the function a little bit at a time until it passes all the tests.</p>
<p><strong>2. Confidence</strong><br />
Let&#8217;s be honest &#8211; who wants to go back and manually test all the things that you&#8217;ve tested a hundred times before and you&#8217;re pretty sure they&#8217;re still going to work? I used to be a tester &#8211; that was my job &#8211; and I couldn&#8217;t stand the monotony. But you can never have complete confidence in your whole system unless you have tested all of it. If you have broken something, it&#8217;s much better to know sooner rather than later. When you have a complete set of tests to run after every test you can be completely confident in your application.</p>
<p><strong>3. Prove the obvious</strong><br />
Sometimes I&#8217;m writing a piece of functionality and I think, <em>&#8220;Oh that&#8217;s so obvious &#8211; I don&#8217;t need to write a test for that!&#8221;</em> But then I think to myself, if it&#8217;s so obvious then I had better make sure that it stays that way. In any case, it may not be obvious to the next person who works on this bit of code. It may not even be obvious to <em>me</em> in a few months time. So I write a test to prove the obvious. If somebody changes it and breaks the test, then they will be forced to think twice about the change they are making.</p>
<p><strong>4. A greater understanding</strong><br />
Step-by-step stories are a wonderful way of understanding a system. Often when I&#8217;m coming to a piece of code I&#8217;ve not worked on before the first thing I do is work through the story. It may be enough just to read it through to see what happens when, and why. Sometimes I literally follow every step of the story, performing it manually to see for myself what it does. Once I understand what is supposed to happen, I&#8217;ll have a far better chance of following the source code. So be kind and write nice stories for the next person who comes along and wants to understand your code.</p>
<p>We write our behaviour-driven-development stories and specs using <a href="http://rspec.info/">RSpec</a>, and we are currently converting to <a href="http://github.com/aslakhellesoy/cucumber/wikis">Cucumber</a> to run our test suites.</p>
]]></content:encoded>
			<wfw:commentRss>http://edendevelopment.co.uk/blogs/company/2008/11/12/the-proof-is-in-the-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
