<?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>Conceptric &#187; Software Engineering</title>
	<atom:link href="http://www.conceptric.co.uk/category/software-engineering/feed" rel="self" type="application/rss+xml" />
	<link>http://www.conceptric.co.uk</link>
	<description>Ideas and Applications</description>
	<lastBuildDate>Fri, 12 Aug 2011 13:00:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Computing costs for the Small Developer: VPS or Cloud</title>
		<link>http://www.conceptric.co.uk/computing-costs-for-the-small-developer-vps-or-cloud.htm</link>
		<comments>http://www.conceptric.co.uk/computing-costs-for-the-small-developer-vps-or-cloud.htm#comments</comments>
		<pubDate>Fri, 12 Aug 2011 13:00:24 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[vps]]></category>

		<guid isPermaLink="false">http://www.conceptric.co.uk/?p=465</guid>
		<description><![CDATA[As promised in my earlier post about the advantages of Cloud hosting for lone developers, I&#8217;ve tried to put together some numbers. I&#8217;ve chosen to compare my favourite VPS based hosting providers with a couple of the most popular Cloud services: Rackspace and Amazon. Choosing the services to compare I&#8217;ve tried to select VPS and [...]]]></description>
			<content:encoded><![CDATA[<p>As promised in <a href="http://www.conceptric.co.uk/benefits-of-the-cloud-for-the-small-developer.htm" title="My introductory post on this topic">my earlier post about the advantages of Cloud hosting for lone developers</a>, I&rsquo;ve tried to put together some numbers. I&rsquo;ve chosen to compare my favourite <abbr title="Virtual Private Server">VPS</abbr> based hosting providers with a couple of the most popular Cloud services:  Rackspace and Amazon.</p>

<h3>Choosing the services to compare</h3>

<p>I&rsquo;ve tried to select <abbr title="Virtual Private Server">VPS</abbr> and Cloud instances specifications that are broadly equivalent in terms of RAM, disk space, and bandwidth offered for this study. What&rsquo;s not so obvious is the computational power offered, and I&rsquo;d like to state that I&rsquo;ve benchmarked nothing at all, so don&rsquo;t take this as a scientific recommendation, just my take on a big topic.</p>

<p>The <abbr title="Virtual Private Server">VPS</abbr> baseline is comprised of some tried and tested, and trusted, services.</p>

<ul>
<li>A bottom of the range 512MB <a href="https://www.memset.com/dedicated-servers/virtual.php" title="Memset VPS hosting">Memset miniserver <abbr title="Virtual Private Server">VPS</abbr></a>, which is a low cost baseline I&rsquo;ve used for years.</li>
<li>A comparable 512MB <a href="http://www.slicehost.com/" title="Slicehost: VPS hosting from Rackspace">Slicehost <abbr title="Virtual Private Server">VPS</abbr></a>.</li>
<li>A <a href="http://www.brightbox.co.uk/rails-hosting-pricing" title="Brightbox VPS hosting">Brightbox Nano <abbr title="Virtual Private Server">VPS</abbr></a>, which is comparable to the <a href="http://beta.brightbox.com/beta" title="Brightbox Cloud Beta">Brightbox Cloud instances</a> I&rsquo;m trialling.</li>
</ul>

<p>Things weren&rsquo;t so simple in the Cloud.</p>

<p>Most <abbr title="Virtual Private Server">VPS</abbr> services come with a fixed amount of monthly bandwidth included in the price, but their Cloud equivalents exclude bandwidth. Cloud bandwidth is charged by unit of resource you use, per GB for example, and often at a different rate for incoming and outgoing traffic. These costs are largely independent of the type of instance, so happily for my analysis they don&rsquo;t reduce my options.</p>

<p>Rackspace make the point that the <abbr title="Amazon Web Services">AWS</abbr> offerings are much higher specification than needed by most web applications, and I found that it&rsquo;s a valid claim that ruled out all but the Micro instance.</p>

<p>So, in the end I chose these options for the Cloud team.</p>

<ul>
<li><a href="http://aws.amazon.com/ec2/" title="Amazon Elastic Compute Cloud"><abbr title="Amazon Web Services">AWS</abbr></a> Micro On Demand instance</li>
<li><a href="http://aws.amazon.com/ec2/" title="Amazon Elastic Compute Cloud"><abbr title="Amazon Web Services">AWS</abbr></a> Micro Reserved instance, which is the same but incurs a booking fee upfront in exchange for lower hourly rates.</li>
<li>A 512MB <a href="http://www.rackspace.co.uk/cloud-hosting/cloud-products/cloud-servers/" title="Rackspace Cloud Servers">Rackspace instance</a> that&rsquo;s hopefully comparable to the Slicehost <abbr title="Virtual Private Server">VPS</abbr> above.</li>
</ul>

<p>Unfortunately Amazon have complicated the economics of the <em>Micro</em> instance by removing all storage. This is provided by attached <abbr title="Elastic Block Storage">EBS</abbr> &#8211; bless Amazon and their abbreviations &#8211; which is priced according to it&rsquo;s own model based on volume size and the number of requests: another cost to consider alongside bandwidth.</p>

<h3>My analysis</h3>

<p>To simplify things, I&rsquo;ve used the baseline Memset <abbr title="Virtual Private Server">VPS</abbr> service as the benchmark against which to assess the other options, but something to note is that some of these services were prices in USD and others in GBP. Attempting to make this as consistent I drew up a list of assumptions for this analysis.</p>

<ol>
<li>Production has 8760 hours of annual use.</li>
<li>Staging has 1152 hours of annual use.</li>
<li>Exchange rate of 1.6 (USD/GBP).</li>
<li>I/O request rate of 1.3 requests per second.</li>
<li>Production traffic is split 90% outgoing and 10% incoming.</li>
<li>Staging bandwidth is split evenly between outgoing and incoming traffic.</li>
</ol>

<p>I then tried running my model at under three traffic conditions that I consider to represent low, medium and high volume. These were 10GB, 50GB and 100GB per month respectively; trust me, I don&rsquo;t need to worry about anything higher at the moment.</p>

<p><img style="display:block; margin-left:auto; margin-right:auto;" src="http://www.conceptric.co.uk/wp-content/uploads/cloudvpsrelativecostvstraffic.jpg" alt="Relative costs of VPS and Cloud computing" title="Relative costs of VPS and Cloud computing" border="0" width="480" height="494" /></p>

<p>OK this makes Brightbox seem very expensive, and it is,  but I should point out that their Nano <abbr title="Virtual Private Server">VPS</abbr> is backed by a separate MySQL cluster and includes a New Relic standard account. None of the other providers do any of this, but since they&rsquo;re one of my current hosts I&rsquo;ve added them anyway. After all, I did this analysis primarily for my own benefit.</p>

<p>Oh, and the step change you can see in the cost for Memset under high traffic was due to a one-off fee for increased bandwidth, the base allowance is 50GB/month. The other <abbr title="Virtual Private Server">VPS</abbr> services had sufficient allowance for all my test cases.</p>

<h4>So how does the Cloud stack up in production?</h4>

<p>It seems that these bottom end instances are relatively competitively priced against these <abbr title="Virtual Private Server">VPS</abbr> services, with only Memset offering me a better deal. The costs also scale directly producing a nice smooth progression in expenses as traffic increases.</p>

<p>As mentioned before, an <abbr title="Amazon Web Services">AWS</abbr> reserved instance requires an upfront commitment that&rsquo;s a large proportion of the total annual cost. That&rsquo;s fine if you&rsquo;re sure you&rsquo;re going to use it throughout the year, as a production server probably, but it&rsquo;s not very Cloud-like. Still, under these conditions it does appear to offer overall savings relative to all the competition except Memset at intermediate loads.</p>

<h4>If you can afford a production Cloud, testing is even better</h4>

<p>The real advantages come if you&rsquo;re in a position to use an identical platform for production and testing. If the cloud is competitive with a <abbr title="Virtual Private Server">VPS</abbr> at your routine levels of traffic, then it&rsquo;s going to offer even better value as a pre-production testing environment.</p>

<p>I decided that the best way to investigate staging in the Cloud was to reduced the number of hours I&rsquo;d need the instance for each month, scale the bandwidth proportionally, and rerun the original model. I chose an arbitrary 96 hours (4 days) each month for testing purposes, it could be more, but could quite easily be less depending on the type of project.</p>

<p><img style="display:block; margin-left:auto; margin-right:auto;" src="http://www.conceptric.co.uk/wp-content/uploads/cloudvpsrelativecostofstaging.jpg" alt="Relative savings for Cloud contracts for Staging" title="Relative savings for Cloud contracts for Staging" border="0" width="480" height="442" /></p>

<p>This chart shows the effect of reduced usage for each of the Cloud instances in the analysis above, and the advantages of the hourly Cloud contract are obvious as the cost scales directly.</p>

<p>If I&rsquo;m using a <abbr title="Virtual Private Server">VPS</abbr> then I&rsquo;m forced to use another <abbr title="Virtual Private Server">VPS</abbr> on a monthly contract if I want an identical staging platform, and this is much more expensive than using any of the Cloud alternatives presented here.</p>

<h3>Conclusions</h3>

<p>Will I be moving to the Cloud? I&rsquo;m certainly tempted, especially with my own projects. It&rsquo;s interesting how there seem to be cost sweet spots at both really low loads and higher ones.</p>

<p>Being able to use identical staging environments is something I&rsquo;d love. I&rsquo;ve tried local virtual machines, but they&rsquo;re never really identical, and I dislike having a <abbr title="Virtual Private Server">VPS</abbr> that hardly does any work. Unfortunately to realise this dream I&rsquo;ve got to move all my production to Cloud instances, and concerns about reliability &#8211; especially given the highly public problems at <abbr title="Amazon Web Services">AWS</abbr> &#8211; make me reluctant.</p>

<p>The key is to be able to quickly spin up new instances, and rapidly destroy them once the testing is done, so that I can keep costs down. Most services allow you to save custom images from which you can create servers, so may be I need to play with this in the Brightbox beta some more.</p>

<p>Long term, I think there&rsquo;s no question that this&rsquo;ll be the basis of my development workflow.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/computing-costs-for-the-small-developer-vps-or-cloud.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Benefits of the Cloud for the Small Developer</title>
		<link>http://www.conceptric.co.uk/benefits-of-the-cloud-for-the-small-developer.htm</link>
		<comments>http://www.conceptric.co.uk/benefits-of-the-cloud-for-the-small-developer.htm#comments</comments>
		<pubDate>Mon, 20 Jun 2011 14:53:43 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://www.conceptric.co.uk/?p=454</guid>
		<description><![CDATA[Problems with a production server &#8211; that took much longer than I&#8217;d have liked to fix &#8211; led my thoughts to the opportunities provided by Cloud computing for solitary developers like me. I&#8217;m a single developer working for myself on small client projects and a few personal ones too. To date I&#8217;ve extensively used virtual [...]]]></description>
			<content:encoded><![CDATA[<p>Problems with a production server &#8211; that took much longer than I&rsquo;d have liked to fix &#8211; led my thoughts to the opportunities provided by Cloud computing for solitary developers like me. <span id="more-454"></span></p>

<p>I&rsquo;m a single developer working for myself on small client projects and a few personal ones too. To date I&rsquo;ve extensively used virtual machines from a number of providers and been quite happy with most.</p>

<p>I rarely need to configure a new <abbr title="Virtual Private Server">VPS</abbr>, and regular maintenance isn&rsquo;t a major headache since they&rsquo;re few in number. So beyond the light use of Amazon S3 for backup storage, the Cloud seemed to hold little of interest.</p>

<p>But then the afore-mentioned problem cropped up, and it&rsquo;s origin was a mystery. I&rsquo;ve setup Linux systems for years now, but the cryptic application errors and the server logs were distinctly unhelpful. I ended up created a new web app just to debug the root cause, and it all took time.</p>

<p>I was lucky, I could afford it since this <abbr title="Virtual Private Server">VPS</abbr> wasn&rsquo;t hosting client projects. Had it been I&rsquo;d have felt obliged to rent a new <abbr title="Virtual Private Server">VPS</abbr> to maintain continuity, and the experience would&#8217;ve cost me, so this is where I revisited the idea of the Cloud.</p>

<h3>Developmental benefits</h3>

<p>Staging on an identical platform without the cost of a permanent staging server was the first benefit that struck me. It&#8217;d make ironing out deployment and dependency issues much more cost effective for the small developer.</p>

<h3>Operational benefits</h3>

<p>In the context of my recent problems, there&#8217;s the option to rapidly spin-up and configure a new server instance from a saved image. I could have skipped fixing that broken server configuration and just replaced it with a fresh one.</p>

<p>Switching a public IP address to another server is quick and easy so if one of your servers does fall over you can switch to an alternative without messing with the slow to refresh <abbr title="Domain Name System">DNS</abbr>.</p>

<h3>Cost benefits</h3>

<p>When it comes to cost, apart from the hourly versus monthly pricing, the main difference lies in the way bandwidth is charged.</p>

<p>This complicates things a bit, in fact with <abbr title="Amazon Web Services">AWS</abbr> instances it&rsquo;s even more complex, but overall it seems that for light traffic applications the cost of Cloud servers is very competitive with their <abbr title="Virtual Private Server">VPS</abbr> cousins.</p>

<p>Still it&rsquo;s in my nature to fire up a spreadsheet when things get messy, and that&rsquo;s a topic for another post.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/benefits-of-the-cloud-for-the-small-developer.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Developing problems with Bundler, RVM and Passenger</title>
		<link>http://www.conceptric.co.uk/developing-problems-with-bundler-rvm-and-passenger.htm</link>
		<comments>http://www.conceptric.co.uk/developing-problems-with-bundler-rvm-and-passenger.htm#comments</comments>
		<pubDate>Mon, 20 Sep 2010 13:41:24 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://www.conceptric.co.uk/?p=426</guid>
		<description><![CDATA[I&#8217;ve grown to appreciate using Bundler to manage dependencies for all my Rails and Sinatra applications. I also combine it with RVM to generate a dedicated gemset for each application bundle and an associated .rvmrc file. Create the Gemset, an application Gemfile defining the dependencies and issue bundle install, simple. Normal behaviour I expect the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve grown to appreciate using <a href="http://gembundler.com/" title="Home of Bundler">Bundler</a> to manage dependencies for all my Rails and Sinatra applications. I also combine it with <a href="http://rvm.beginrescueend.com/" title="Home of RVM">RVM</a> to generate a dedicated gemset for each application bundle and an associated <code>.rvmrc</code> file. Create the Gemset, an application <code>Gemfile</code> defining the dependencies and issue <code>bundle install</code>, simple.
<span id="more-426"></span></p>

<h3 id="normalbehaviour">Normal behaviour</h3>

<p>I expect the bundle to be installed inside an RVM Gemset directory that looks a little like this.</p>

<p><img src="http://www.conceptric.co.uk/wp-content/uploads/RVM_Gemset.jpeg" alt="Standard RVM Gemset file structure" border="0" width="500" height="207" /></p>

<p>All the gems are installed in the <code>gem</code> directory and are available to the application.</p>

<h3 id="problemswithpassenger.">Problems with Passenger.</h3>

<p>Recently I&rsquo;ve been finding that <a href="http://www.modrails.com/" title="Home of Passenger / ModRails">Passenger</a> doesn&rsquo;t see these gems in the default location. The <a href="http://rvm.beginrescueend.com/integration/passenger/" title="RVM integration FAQs for Passenger">RVM documentation</a> suggests a fix if the usual <code>bundle install</code> doesn&rsquo;t produce the expected results; use the <code>bundle install $BUNDLE_PATH</code> option.</p>

<p>Doing this causes Bundler to add a <code>.bundle/config</code> file containing file paths and prevents the sharing of gems. In additions, and possibly in an attempt to avoid sharing, Bundler places the new bundle inside a sub-directory, <code>ruby</code>, as it would if I wasn&rsquo;t using RVM. This leaves the Gemset structure with a duplicate.</p>

<p><img src="http://www.conceptric.co.uk/wp-content/uploads/RVM_Gemset_With_Bundler.jpeg" alt="Problematic RVM Gemset file structure after Bundler" border="0" width="500" height="267" /></p>

<h3 id="problemswithbundler.">Problems with Bundler.</h3>

<p>This all seems fine until you want to update an existing gem or add a new one.</p>

<p>I made this discovery when I emptied my Gemset to find that <code>bundle check</code> seemed to think that all the dependencies were still satisfied, strange. It turned out it was still looking at the <code>ruby/1.8/</code> directory as directed by the <code>.bundle/config</code> file.</p>

<p>Unfortunately, Rake and other application tasks couldn&rsquo;t see these gems, and Bundler couldn&rsquo;t install them again, dependencies satisfied remember. Worse still it didn&rsquo;t seem able to manage the copy either and crashed whenever changes were needed. Under RVM, Bundler seems to break in the presence of the <code>.bundle</code> directory.</p>

<p>As you might expect from what I wrote above, viewed through Passenger it was like nothing had happened.</p>

<p>So I deleted the useless <code>ruby</code> directory. That broke everything.</p>

<h3 id="investigation.">Investigation.</h3>

<p>I wondered why the <code>.bundle</code> directory was necessary, a legacy thing I think; I deleted it to find out, that&rsquo;s what version control&rsquo;s for isn&rsquo;t it.</p>

<p>I ran <code>bundle install</code>, but still no joy, the error was still there, and then I tried clearing the cached gems. Great, Rake was back in action, and <code>gem list</code> showed me what I expected, one problem down. Bundler can now modify the gems in the original bundle, the ones the application can see. But Passenger was still dead, it just complained about the lack of gems.</p>

<p>I could fix it in the same way as before, using the <code>$BUNDLE_PATH</code> option, but that would leave me with a second bundle copy again, and a whole lot of problems trying to update them. Besides, two copies of the same thing is just a bad idea anyway.</p>

<p>Then it occurred as a result of the <a href="http://github.com/carlhuda/bundler/blob/master/UPGRADING.md" title="GitHub documentation on Upgrading Bundler">Bundler upgrade information</a>, that Passenger was using Bundler to get the gems, and Bundler didn&rsquo;t seem to know where to look. The <code>$BUNDLE_PATH</code> environment variable should provide that information, but Bundler wasn&rsquo;t getting the message from RVM and Passenger.</p>

<h3 id="mysolution">My solution</h3>

<p>Don&rsquo;t use the <code>$BUNDLE_PATH</code> option or you&rsquo;ll end up with a second bundle copy and render the original unmanageable. Make sure you delete the <code>.bundle</code> directory in your application root, or future attempts to use Bundler will fail.</p>

<p>Manage your gems using Bundler with the plain vanilla commands, like <code>bundle install</code>, and everything should work in development. Bearing in mind that you&rsquo;ve got good development server options, like <a href="http://guides.rubyonrails.org/command_line.html#rails-server" title="Documentation on Rails Server"><code>rails s</code></a> and <a href="http://rubygems.org/gems/shotgun" title="Shotgun: a reloading rack development server">Shotgun</a>, available you might want to give Passenger a miss. But if you don&rsquo;t, and you&rsquo;re using Apache, I&rsquo;ve found that adding</p>

<p><code class="terminal">SetEnv BUNDLE_PATH path_to/.rvm/gems/ree@thegemset</code></p>

<p>in the vhost configuration should get it working, though you might need to restart the Web Server, <code>touch tmp/restart.txt</code> won&rsquo;t do.</p>

<p>Why RVM isn&rsquo;t passing the <code>$BUNDLE_PATH</code> to Passenger, and how Passenger could find the Gemset copy in the first place, I don&rsquo;t know, but I&rsquo;ve got my development environment back on track. Wish I could say the same for my attempt to deploy Rails 3 to REE with Bundler.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/developing-problems-with-bundler-rvm-and-passenger.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bundler for Sinatra dependencies</title>
		<link>http://www.conceptric.co.uk/bundler-for-sinatra-dependencies.htm</link>
		<comments>http://www.conceptric.co.uk/bundler-for-sinatra-dependencies.htm#comments</comments>
		<pubDate>Tue, 27 Jul 2010 16:40:34 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[sinatra]]></category>

		<guid isPermaLink="false">http://www.conceptric.co.uk/?p=396</guid>
		<description><![CDATA[Package dependencies are always a nightmare and with multiple applications on my server, each with their own set of Ruby gems, controlling the version they&#8217;re using has become important. I&#8217;ve been using Sinatra for more and more projects, but there came a point this week when I realised that I was in danger of accidentally [...]]]></description>
			<content:encoded><![CDATA[<p>Package dependencies are always a nightmare and with multiple applications on my server, each with their own set of Ruby gems, controlling the version they&#8217;re using has become important.</p>

<p>I&#8217;ve been using <a href="http://www.sinatrarb.com/">Sinatra</a> for more and more projects, but there came a point this week when I realised that I was in danger of accidentally upgrading gem versions without testing first.
<span id="more-396"></span></p>

<h3>Dependencies in crisis</h3>

<p>You see, my applications all use the system gems, and <code>require "gem_name"</code> to load the most recent local version.</p>

<p>As the number of applications on the server grew, I found that this had the effect of automatically upgrading all my applications whenever I upgraded a gem, whether intentional or otherwise.</p>

<p>Now I like to take advantage of bug fixes and new features of the latest releases whenever possible, but I don&#8217;t necessarily want to upgrade every application in a single mammoth coding session, or have to hold back the deployment of a new application until the others have been upgraded and fully tested.</p>

<h3>Gem and version dependency control</h3>

<p>It dawned on me that I needed some control over both the actual gems and the versions each application used.</p>

<h4>Simplicity</h4>

<p>The simplest approach is to control what it available in the application load path before loading it in the usual way, and these are the commands for the job.</p>

<p><code class="terminal">gem "gem_name", "gem_version"
require "gem_name"
</code></p>

<p>I tried this with some success, and quite a few of my applications are still using this method for now. But I decided to try using Bundler as a long term solution.</p>

<h4>Bundler</h4>

<p>If you want to know about <a href="http://gembundler.com/">Bundler</a> I suggest you try the <a href="http://github.com/carlhuda/bundler/">github repository</a> or some of the <a href="http://yehudakatz.com/?s=bundler&#038;x=0&#038;y=0">posts on Yehuda Katz blog</a>.</p>

<p>I found it pretty easy to integrate with Sinatra by following <a href="http://gembundler.com/sinatra.html">these instructions</a>, and my <code>Gemfile</code> looked like this.</p>

<p><code class="terminal">source "http://rubygems.org"
gem 'sinatra', '1.0'
gem 'haml', '3.0.13'
group :test do
  gem 'rspec', '1.3.0', :require => 'spec'
  gem 'rspec-rails', '1.3.2'
  gem 'cucumber', '0.8.3'
  gem 'cucumber-rails', '0.3.2'
  gem 'webrat', '0.7.1'
end
</code></p>

<p>Testing with WEBrick went like clockwork, working smoothly with both RSpec and Cucumber, but when I tried to get things running on Passenger this is what I saw.</p>

<p><img style="display:block; margin-left:auto; margin-right:auto;" src="http://www.conceptric.co.uk/wp-content/uploads/BundlerLoadError.jpeg" alt="BundlerLoadError.JPEG" border="0" width="500" height="234" /></p>

<p>This had me stumped for quite a while. I reinstalled Bundler; checked out the installation of Passenger, my $GEM_PATH, and the Ruby environment; nothing worked.</p>

<p>The solution turned out to be much simpler than all that: add the Bundler gem to the Gemfile dependencies.</p>

<p><code class="terminal">gem 'bundler', '0.9.26'
gem 'sinatra', '1.0'
gem 'haml', '3.0.13'
</code></p>

<p>I wish it had occurred to me earlier, but the simple ones never do. Anyhow, my Passenger deployments work perfectly, and I&#8217;ll be migrating all my Sinatra apps over to Bundler.</p>

<h3>Capistrano integration</h3>

<p>And if you, like me, want to use Bundler to manage dependencies during Capistrano deployment, you might like to try these <a href="http://gist.github.com/250979">useful recipes</a>.</p>

<script src="http://gist.github.com/250979.js?file=bundler_cap.rb"></script>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/bundler-for-sinatra-dependencies.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Evolving style after six months on Rails</title>
		<link>http://www.conceptric.co.uk/evolving-style-after-six-months-on-rails.htm</link>
		<comments>http://www.conceptric.co.uk/evolving-style-after-six-months-on-rails.htm#comments</comments>
		<pubDate>Thu, 04 Feb 2010 17:31:08 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[BDD]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.conceptric.co.uk/?p=331</guid>
		<description><![CDATA[It's coming up to 6 months since I announced my transition from PHP to Ruby and I'm really getting the hang of my new web development toolkit by working on a personal project.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ruby-lang.org/en/">Ruby</a> which is an interpreted programming language, often called a scripting language, that I&#8217;ve been using alongside BASH for automating tasks on my Mac. Call me slow&#8230; no don&#8217;t, I&#8217;m quite sensitive, but I only recently coupled this with the Rails web <a href="http://en.wikipedia.org/wiki/Software_framework">software framework</a> and started working on a Ruby on Rails web application.</p>

<p>There&#8217;s no better way to learn a new language than to actually use it in real life. My Nature Notes started as a project for my partner in PHP, CodeIgniter actually, but progress was slow due to an enjoyment deficit.</p>

<p>Testing is the main reason that I grew unhappy with PHP, most of the tools were there, but the integration was patchy: the basics are all there in Ruby and it&#8217;s associated development frameworks and integrating new packages via ruby gems or plugins is simple.</p>

<p>I started using the built-in Rails testing tools, but for no particular reason I&#8217;ve moved on to <a href="http://rspec.info/">RSpec</a> for unit and functional Rails model and standalone Ruby code testing coupled with <a href="http://cukes.info/">Cucumber</a> based integration testing. I&#8217;ve found that I need both.</p>

<p>Cucumber tests try to exercise the whole software stack &#8211; views, controllers, models and even the database. The use of natural language makes it easier to translate user stories into the appropriate tests, though it still needs some discipline to ensure that the edge cases are covered: I don&#8217;t think clients could write these as acceptance tests.</p>

<p>Involving the whole stack makes tests a little brittle, how specific is too specific? I&#8217;ve managed to break tests by removing fullstops (periods) from the rendered HTML!</p>

<p>I think that this is where unit and functional testing with RSpec at the model level is indispensable. I test model associations, validations and custom business logic in that order, I draw the limit at all the ActiveRecord <abbr title="Create Read Update Delete">CRUD</abbr> functionality.</p>

<p>I&#8217;ve found that the development environment hasn&#8217;t really changed in the move, the same basic toolkit does PHP and Ruby.</p>

<p>I regularly use several code version control systems including Subversion, Git and Mercurial. Recently though I&#8217;ve increasingly turned to Git and GitHub. Like most good tools the more you use it the more attached you become, so I&#8217;ll have to force myself to use the equally fine Mercurial again soon. I love these distributed tools.</p>

<p>TextMate is my editor of choice for Rails development. I&#8217;ve tried to use Netbeans <abbr title="Integrated Development Environment">IDE</abbr>, I use this for Java, but it seems like overkill. TextMate is quicker, simpler and provides the tools I need via the a range of bundles.</p>

<p>I have to admit that the code syntax highlighting is the most useful feature because I like using the command line too much, but I&#8217;m increasingly using code completion and I&#8217;m going to try the <a href="http://code.google.com/p/zen-coding/">Zen coding</a> bundles for HTML and CSS, I don&#8217;t like the default tools much.</p>

<p>That&#8217;s a round up of my current practice, more about the resulting software once I&#8217;ve decided to move on to a public beta.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/evolving-style-after-six-months-on-rails.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How does behaviour drive development?</title>
		<link>http://www.conceptric.co.uk/how-does-behaviour-drive-development.htm</link>
		<comments>http://www.conceptric.co.uk/how-does-behaviour-drive-development.htm#comments</comments>
		<pubDate>Thu, 12 Nov 2009 13:25:23 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[BDD]]></category>
		<category><![CDATA[processes]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.conceptric.co.uk/?p=310</guid>
		<description><![CDATA[Behaviour Driven Development (BDD) is an adaptation of earlier Test Driven practices (TDD) that's growing on me, but it's raised an interesting problem: the order in which to describe desired behaviour so that it actually drives development.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve only recently started dabbling in <abbr title="Behaviour Driven Development">BDD</abbr> using <a href="http://railscasts.com/episodes/155-beginning-with-cucumber">Cucumber and RSpec in Rails</a> applications. It feels quite different to the <abbr title="Test Driven Development">TDD</abbr> practices I&#8217;ve adopted before in Java, PHP or Ruby.</p>

<p>It feels like I&#8217;m starting from the top of the software stack and working down from broad specifications, creating code as I go, rather than up from fine grained models based on specific unit tests. Is this a reductionist approach?</p>

<p>When writing my features and scenarios I&#8217;ve noticed a tendency to follow the <abbr title="Create Read Update Delete">CRUD</abbr> acronym common in data access layers: Create Read Update and Delete. The order of these processes is significant and my reasoning goes something like this&#8230;&#8230;</p>

<p>I can&#8217;t really expect to read the contents of an entity before I&#8217;ve generated the code to create it. Now I&#8217;ve created it, I&#8217;m not going to try to edit this same entity unless I can actually read it. I can read what I&#8217;ve got, but I might want to edit those contents, and delete comes last&#8230;&#8230; because it just does, I guess the order of &#8220;UD&#8221; is negotiable, but this way it&#8217;s easier to pronounce.</p>

<p>You get the general picture, but this is just the approach I&#8217;ve adopted through trial and lots of error. It&#8217;s far from perfect, so how do you use behaviour to lead the code?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/how-does-behaviour-drive-development.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web hosting in the UK: green and cost effective</title>
		<link>http://www.conceptric.co.uk/web-hosting-in-the-uk-green-and-cost-effective.htm</link>
		<comments>http://www.conceptric.co.uk/web-hosting-in-the-uk-green-and-cost-effective.htm#comments</comments>
		<pubDate>Wed, 09 Sep 2009 11:16:46 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Personal Perspectives]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[brightbox]]></category>
		<category><![CDATA[climate change]]></category>
		<category><![CDATA[memset]]></category>
		<category><![CDATA[web hosting]]></category>

		<guid isPermaLink="false">http://www.conceptric.co.uk/?p=306</guid>
		<description><![CDATA[A couple of months ago I came to the decision that my fragmented approach to web hosting needed a little reorganisation. I like to use UK hosts and I'm passionate about minimise my carbon footprint. On this basis Brightbox and Memset are both good choices, but with new projects on the horizon, the lure of cheaper US hosting is hard to resist. Can UK providers do even better?]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve used several hosting providers, but I settled on <a href="http://www.brightbox.co.uk/">Brightbox</a> for Rails hosting, and <a href="http://www.memset.com/index.php?GCID=S15214x001-memset&#038;keyword=memset">Memset</a> for everything else. Neither provided cheap Virtual Private Servers (VPS), but their environmental stance, and quality of service and support, helped me rationalise the cost.</p>

<p>Whilst the Brightbox Rails hosting stack is very focused, my general purpose hosting has been based on CentOS, a free flavour of Red Hat Enterprise Linux, and the <abbr title="WebHost Manager">WHM</abbr>/cPanel server management interface; a scatter gun approach I don&#8217;t like: it was time to change.</p>

<h3>Keep the servers clean.</h3>

<p>I find that removing complex <abbr title="Graphical User Interface">GUI</abbr>s and reverting to command line management results in cleaner servers, with more control over software baggage and file structure.</p>

<p>On top of this I found that most clients have little interest in accessing the server, preferring that I take care of everything. I&#8217;ve no intention of entering the reselling business, so exit cPanel, the extra cost, and the hassle.</p>

<h3>Standardise to maintain quality.</h3>

<p>I&#8217;ve standardised my Ruby maintenance scripts and wanted a set of VMWare Fusion based staging virtual machines for deployment testing.  To reduce the workload, and the chances of mistakes, using a single operating system seemed logical.</p>

<p>Since I started using Ruby on Rails, I&#8217;ve converged on <a href="http://www.ubuntu.com/products/WhatIsUbuntu/serveredition">Ubuntu 8.04 LTS</a> as my server operating system of choice: I find that it is a neater implementation of Linux, especially when it comes to Apache configuration.</p>

<h3>Competitive pricing.</h3>

<p>At around the same time as these thoughts were flowing through my head, Memset changed the way they implement their VPS leading to better specifications and significant reduction in price.</p>

<p>Initially I was sceptical, it looked <a href="http://www.memset.com/dedicated-servers/virtual.php">too good to be true</a>, but I have completed migrating my existing websites and Subversion repo to a VM1000 and it has run well over the last couple of months. I haven&#8217;t run any performance tests, but subjectively these websites seem a little more responsive, and all at a quarter of the price!</p>

<h3>A good result.</h3>

<p>This is great news since I&#8217;ve been wanting to supplement my <abbr title="Linux Apache MySQL PHP">LAMP</abbr> based work with more significant applications using Ruby and/or Java stacks, and running all that on a single low resource server is not a good idea.</p>

<p>To sum up I&#8217;m still happy with Memset&#8230;&#8230; probably happier, since the price reductions have made it possible to experiment freely without having to use a US based host with an unclear commitment to environmental impact.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/web-hosting-in-the-uk-green-and-cost-effective.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Switching to Rails</title>
		<link>http://www.conceptric.co.uk/switching-to-rails.htm</link>
		<comments>http://www.conceptric.co.uk/switching-to-rails.htm#comments</comments>
		<pubDate>Sun, 30 Aug 2009 18:30:00 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Personal Perspectives]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.conceptric.co.uk/?p=302</guid>
		<description><![CDATA[I know that a good developer should choose the best tool for the job in hand, but their own productivity and inspiration must inform the decision in selecting the best tool.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a personal project based on CodeIgniter and it&#8217;s been uphill work. I finally lost patience with both the framework and language and followed the advice given on <a href="http://www.conceptric.co.uk/codeigniter-test-coverage.htm">my last post about code testing</a>.</p>

<p>I&#8217;ve used Ruby for scripting, and deploying PHP applications with custom Capistrano recipes for years now, but I&#8217;ve never tried any of the available web frameworks.</p>

<p>This week I switched to Ruby on Rails, and I&#8217;ve accomplished more in a couple of days than in a couple of months with CodeIgniter.</p>

<p>I&#8217;m not trying to claim that there&#8217;s anything fundamentally wrong with PHP, so don&#8217;t beat me up over it, but I find working with Ruby and Java much more intuitive, enjoyable and productive: it&#8217;s a personal choice, I feel more inspired.</p>

<p>I&#8217;m particularly loving the default support for <a href="http://guides.rubyonrails.org/testing.html">unit, functional and integration testing</a>; I now feel in control of my code and I&#8217;ve yet to explore the full range of testing frameworks and approaches available for Rails.</p>

<p>I know that <a href="http://cakephp.org/">CakePHP</a> mirrors Rails functionality very closely, but I&#8217;m afraid it&#8217;s the PHP language that I find too ugly to love &#8211; personal choice again, don&#8217;t shoot &#8211; consequently this is one developer who may have written his last line of PHP code&#8230;&#8230; maybe.</p>

<p>I&#8217;m now hoping to have the first release of the nature and wildlife recording application I&#8217;ve been promising Clare for&#8230;&#8230; much too long, up and running in the next couple of weeks.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/switching-to-rails.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Working with Git and Subversion</title>
		<link>http://www.conceptric.co.uk/working-with-git-and-subversion.htm</link>
		<comments>http://www.conceptric.co.uk/working-with-git-and-subversion.htm#comments</comments>
		<pubDate>Wed, 10 Jun 2009 11:58:35 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[processes]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[version control]]></category>

		<guid isPermaLink="false">http://www.conceptric.co.uk/?p=191</guid>
		<description><![CDATA[I've got a local copy of the Subversion repository under Git, so I thought I should talk about my workflow.]]></description>
			<content:encoded><![CDATA[<p>Last time I <a href="http://www.conceptric.co.uk/importing-a-remote-subversion-repository-with-git.htm">created a local Git repository</a>, in which I could have several <code>svn/</code> prefixed branches and one <code>master</code> which is linked to the remote <code>trunk</code>.</p>

<h3>The Git work environment.</h3>

<p>Working with Git is quite different to using Subversion. The actual contents of the project directory change to reflect the currently active branch: the directory contains a whole repository, not a checked out copy. Don&#8217;t get alarmed when files start disappearing only to reappear again when you switch branch.</p>

<p>I also noticed that I interacted with the version control less frequently when editing, delete, and create files. The interaction is saved until you&#8217;re ready to commit, making the process feel more seamless. I occasionally used to get into trouble by deleting files via the <abbr title="Operating System">OS</abbr>, rather that using the Subversion command.</p>

<p>For the majority of the time, I&#8217;ll use the <a href="http://www.kernel.org/pub/software/scm/git/docs/">Git commands</a>, as I&#8217;m working in a Git repository. The <code>git svn</code> functionality is only needed as a Git interface with Subversion.</p>

<h3>Getting ready to work.</h3>

<p>I like the <code>master</code> branch to always reflects the current <code>trunk</code> until I choose to update it, so all my commits are made from other working branches.</p>

<p>I start by checking out a branch based on <code>master</code> to use as a base from which to work. I&#8217;ve imaginatively called it <code>basework</code> in this example, and as a branch of <code>master</code> it is linked to the same remote branch: <code>trunk</code>.</p>

<p><code class="terminal oddlines">git branch -a</code></p>

<p>should display all your branches in the repository.</p>

<p><samp class="stdout">jkw@mac> git branch -a
* basework
  master
  svn/trunk
jkw@mac>
</samp></p>

<p>I work in increments based on stories, that&#8217;s another post, so I actually create a story branch from <code>basework</code>, that can be merge back into this parent upon completing the story. This helps cope with changes in the remote codebase.</p>

<h3>Creating my working branches.</h3>

<p>It&#8217;s a good idea to check that <code>basework</code> is up to date with the remote Subversion <code>trunk</code> before branching:</p>

<p><code class="terminal oddlines">git svn rebase</code></p>

<p>This will either update the local repository with the remote changes, or tell you that the current branch is already up to date.</p>

<p>I&#8217;m now in a position to create my story branch:</p>

<p><code class="terminal oddlines">git checkout -b inwork</code></p>

<p>The <code>-b</code> option is used to create a new branch and then switch to it. Without this option the same command is used to move between branches.</p>

<p>This same process was used to create <code>basework</code>.</p>

<p>I have my working repository structure, and I&#8217;m currently working on my story branch, see the asterisk.</p>

<p><samp class="stdout">jkw@mac> git branch -a
  basework
* inwork
  master
  svn/trunk
jkw@mac>
</samp></p>

<h3>The local commit.</h3>

<p>You can see details of the changes to the local working branch using the <code>git status</code> command:</p>

<p><samp class="stdout">jkw@mac> git status</p>

<h1>On branch inwork</h1>

<p>nothing to commit (working directory clean)
james@cybermac1> git st</p>

<h1>On branch inwork</h1>

<h1>Changed but not updated:</h1>

<h1>(use &#8220;git add/rm <file>&#8230;&#8221; to update what will be committed)</h1>

<h1>(use &#8220;git checkout &#8212; <file>&#8230;&#8221; to discard changes in working directory)</h1>

<p>#</p>

<h1>modified:   footer.php</h1>

<h1>deleted:    images/feed-icon-64.png</h1>

<h1>modified:   style.css</h1>

<p>#</p>

<h1>Untracked files:</h1>

<h1>(use &#8220;git add <file>&#8230;&#8221; to include in what will be committed)</h1>

<p>#</p>

<h1>includes/category-1.inc.php</h1>

<p>no changes added to commit (use &#8220;git add&#8221; and/or &#8220;git commit -a&#8221;)
jkw@mac> 
</samp></p>

<p>To add the new file show in the example to those being tracked:</p>

<p><code class="terminal oddlines">git add includes/category-1.inc.php</code></p>

<p>If I wanted to add all of the untracked files, I could use the <code>-A</code> option instead of individually naming them.</p>

<p>Now all the files are staged, the time comes to commit them to the local Git repository:</p>

<p><code class="terminal oddlines">git commit -a <em>-m "A message to describe the changes."</em></code></p>

<p>Leaving the <code>-m</code> option off will cause Git to request comments using whichever editor is defined in your configuration files.</p>

<p>I now the story is complete, and all the changes committed to the <code>inwork</code> branch, it&#8217;s time to commit them to Subversion.</p>

<h3>The remote commit.</h3>

<p>I start the remote commit process by switching to the <code>basework</code> branch:</p>

<p><code class="terminal oddlines">git checkout basework</code></p>

<p>Next I check that the remote codebase hasn&#8217;t changed, or update the changes:</p>

<p><code class="terminal oddlines">git svn rebase</code></p>

<p>I&#8217;ll merge <code>inwork</code> into <code>basework</code>:</p>

<p><code class="terminal oddlines">git merge inwork</code></p>

<p>I use my text editor to manually fix conflicts that arise. Git tells you where to find them by marking up the code. This is followed by another local commit, at which point the merge is complete.</p>

<p>Now I can try a dry run of the remote commit:</p>

<p><code class="terminal oddlines">git svn dcommit -n</code></p>

<p>It&#8217;s the <code>-n</code> option that makes this a dry run: nothing has been committed yet. It shows you the local versions to be bulk committed if you choose to go ahead. To actually perform the commit, remove the <code>-n</code>, and re-run the command, it may take a while if you&#8217;ve been busy.</p>

<h3>Verifying the remote commit.</h3>

<p>This is where leaving the <code>master</code> branch untouched pays off. <code>basework</code> has been committed to the remote <code>trunk</code>, whilst <code>master</code> still reflects the pre-commit <code>trunk</code>.</p>

<p>I switch to <code>master</code>, which should contain none of my new work, and update it from the remote <code>trunk</code>:</p>

<p><code class="terminal oddlines">git svn rebase</code></p>

<p>It should have changed to match <code>basework</code>, and if so the previous commit worked.</p>

<h3>Cleaning up.</h3>

<p>I&#8217;ve verified the commit: I have <code>master</code> and <code>basework</code> branches that are identical, so <code>inwork</code> is no longer needed, I&#8217;ll delete it:</p>

<p><code class="terminal oddlines">git branch -d inwork</code></p>

<p>Deleting a child branch of a different parent is a little dangerous, so if you&#8217;re not in <code>basework</code> you&#8217;ll get a warning. Either switch to <code>basework</code> and try again, or re-running the command with the <code>-D</code> option.</p>

<p>If I&#8217;ve finished work on this project, I&#8217;d delete the <code>basework</code> branch too, but if I&#8217;m going to continue, I&#8217;d use it to create another working branch, and I&#8217;ve gone full circle.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/working-with-git-and-subversion.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Importing a remote Subversion repository with Git</title>
		<link>http://www.conceptric.co.uk/importing-a-remote-subversion-repository-with-git.htm</link>
		<comments>http://www.conceptric.co.uk/importing-a-remote-subversion-repository-with-git.htm#comments</comments>
		<pubDate>Thu, 04 Jun 2009 12:02:38 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Everything]]></category>
		<category><![CDATA[Posts]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[git svn]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[version control]]></category>

		<guid isPermaLink="false">http://www.conceptric.co.uk/?p=189</guid>
		<description><![CDATA[To start this series about teaming Git with Subversion, I need to create a local copy of the Subversion Repository.]]></description>
			<content:encoded><![CDATA[<p>Lets get the obvious stuff over with, create a directory in which to initialise the local git repository.</p>

<p><code class="terminal">mkdir myproject
cd myproject
</code></p>

<p>The initialisation itself is pretty simple, just remember to point Git at the correct url for your Subversion repository, and watch the communication protocols.</p>

<p><code class="terminal oddlines">git svn init -s --prefix=svn/ svn+ssh://svn.repository.com/svn/<em>myproject</em></code></p>

<p>The <code>-s</code> option tells the repository to expect the typical trunk, branches and tags structure of a Subversion project. You can specify the location of your trunk, branches and tags using the <code>-T</code>, <code>-b</code>, and <code>-t</code> respectively.</p>

<p>Using the <code>--prefix</code> option is handy, ensuring that the remote directories will be prefixed with <code>svn/</code>. This makes it clear which are Subversion and which git branches later.</p>

<p>All that remains is to checkout all of the information relating to your project from the Subversion repository.</p>

<p><code class="terminal oddlines">git svn fetch</code></p>

<p>Depending on the size of the project, this could take a while, it&#8217;s downloading the entire project history from the remote repository.</p>

<p>I word of warning you about the strangeness that can ensue if the remote repository contains any tags. They will be imported as git branches, and you may find the local master branch pointing to something other that the remote <code>trunk</code>.</p>

<p>These <a href="http://www.kernel.org/pub/software/scm/git/docs/git-svn.html"><code>git svn</code> commands</a>, and all the others, are pretty well documented. Now I&#8217;ve got a Git repository, in the next post I&#8217;ll to describe my normal workflow.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/importing-a-remote-subversion-repository-with-git.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Advantages of a Git and Subversion blend</title>
		<link>http://www.conceptric.co.uk/advantages-of-a-git-and-subversion-blend.htm</link>
		<comments>http://www.conceptric.co.uk/advantages-of-a-git-and-subversion-blend.htm#comments</comments>
		<pubDate>Sat, 30 May 2009 19:48:23 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Everything]]></category>
		<category><![CDATA[Posts]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[git svn]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[version control]]></category>

		<guid isPermaLink="false">http://www.conceptric.co.uk/?p=187</guid>
		<description><![CDATA[I've had time to try Git with my remote Subversion repositories, using the <code>git svn</code> commands, and I wouldn't go back. To start this small series, I'll try to explain the enthusiasm.]]></description>
			<content:encoded><![CDATA[<p>Using <a href="http://git-scm.com/">Git</a> as a front-end to Subversion provides more comprehensive version control and flexibility in the way I work, especially for a laptop user. Everything is under active version control, with or without a connection to the remote Subversion repository.</p>

<p>Branching and merging is quick and simple, and as a result I find I do this far more often than when using Subversion alone. I also commit changes more frequently: it&#8217;s far quicker than using a remote repository, even when not off-line.</p>

<p>This sort of functionality is vital to successful version control, and I think it promotes better practice, as long as you&#8217;re only committing working software. All the local Git commits will later be bulk committed to the remote repository. However they all retain their identity as separate versions, so discipline is important, we wouldn&#8217;t want anyone finding broken code.</p>

<p>I could get all this from Git alone, but the combination retains Subversion vendor branching and the deployment advantages of my existing Subversion / Capistrano set up. I&#8217;m going to try <a href="http://github.com/">GitHub</a>, or my own remote Git repository, and exploiting the Capistrano support for Git, but at the moment why reinvent the wheel?</p>

<p>I prefer to work on the command line, and that&#8217;s the approach this series will take, but <a href="http://quiteuseful.co.uk/post/97148287/git-guis">GUIs are available for Git</a>, try typing <a href="http://www.kernel.org/pub/software/scm/git/docs/git-gui.html"><code>git gui</code></a> to check out the one bundled.</p>

<p>I use this approach for anything I need version controlled, including my Curriculum vitae/Resume, but before try this out for yourself you&#8217;re going to need to check out a local copy of that remote Subversion repository&#8230; I&#8217;ll cover that next time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/advantages-of-a-git-and-subversion-blend.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing applications for the Web</title>
		<link>http://www.conceptric.co.uk/testing-applications-for-the-web.htm</link>
		<comments>http://www.conceptric.co.uk/testing-applications-for-the-web.htm#comments</comments>
		<pubDate>Fri, 24 Apr 2009 17:22:21 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Everything]]></category>
		<category><![CDATA[Posts]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.conceptric.co.uk/?p=173</guid>
		<description><![CDATA[I'm a fan of Test-Driven Development because I enjoy the freedom that a comprehensive test suite provides: without it I tend to feel that I'm walking through a minefield.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve spent more time on web development using PHP frameworks recently, and I&#8217;m realising just how difficult it is to provide the sufficient code coverage, avoiding that feeling that I&#8217;m about to step on a mine.</p>

<p>My experiences got me thinking about what I needed to code confidently. As a minimum, I need to know that everything works before committing code to version control, but security comes with regular testing, and this is no use unless everything is covered.</p>

<p>Based on web development frameworks using the nearly ubiquitous <abbr title="Model View Controller">MVC</abbr> design pattern, the logic and side effects at each <a href="http://www.webopedia.com/quick_ref/app.arch.asp">application tier</a> must be tested, and I came up with this list.</p>

<ol>
<li>The Database tier schema, whether <abbr title="Relational Database Management System">RDBMS</abbr>, <abbr title="eXtensible Markup Language">XML</abbr> or anything else.</li>
<li>Data Access logic is usually implemented in models, but often uses built-in features of the framework, such as ActiveRecord.</li>
<li>Business logic is encapsulated in the models, libraries, and sometimes controllers.</li>
<li>Presentation logic at the server comprising controllers and their respective views.</li>
<li>Presentation and business logic at the client tier implemented by <abbr title="Document Object Model">DOM</abbr> scripting, mostly in JavaScript.</li>
<li>The actual data presentation at the client tier based on XHTML and CSS.</li>
</ol>

<p>I&#8217;ve tried to order it from inside the application, working out from the data tier to the client, and it&#8217;s quite a list; I&#8217;d be interested to hear what I&#8217;ve missed.</p>

<p>Since this is a huge topic, I hope to write a series of posts isolating specific areas as I encounter them, and comparing tools and approaches. The first will look at how a few development frameworks in popular languages appear to measure up.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/testing-applications-for-the-web.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CodeIgniter test coverage</title>
		<link>http://www.conceptric.co.uk/codeigniter-test-coverage.htm</link>
		<comments>http://www.conceptric.co.uk/codeigniter-test-coverage.htm#comments</comments>
		<pubDate>Fri, 17 Apr 2009 11:27:49 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Everything]]></category>
		<category><![CDATA[Posts]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[simpletest]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.conceptric.co.uk/?p=167</guid>
		<description><![CDATA[I'm still not happy with the code coverage I can get even with SimpleTest fully integrated with CodeIgniter.]]></description>
			<content:encoded><![CDATA[<p>I like to use libraries; they move the business logic outside of the CodeIgniter <abbr title="Model View Controller">MVC</abbr> framework, where they and their associated test suites can be made independent. Since libraries can be reused in many CodeIgniter projects this maintains their portability, yet it&#8217;s simple to integrate them into the whole application test suite, where they can be run from the browser using a custom controller.</p>

<p>Unfortunately, testing anything other than libraries and models is difficult because there&#8217;s no way to access the another important type of object: controllers. CodeIgniter positively encourages using controllers to implement business logic, consequently not being able to test them is a serious anomaly.</p>

<p>Integrating a front-end testing framework, such as <a href="http://seleniumhq.org/">Selenium</a>, might be the solution, but does that properly test the controller code? I don&#8217;t think it does; the target there is the presentation tier at the browser.</p>

<p>The lack of good <a href="http://en.wikipedia.org/wiki/Code_coverage">code coverage</a> bothers me a lot, but I continue to struggle on with CodeIgniter because I&#8217;ve found other PHP frameworks to be just as lacking. Is this a general problem with frameworks? I&#8217;m tempted to try <a href="http://rubyonrails.org/">Ruby on Rails</a> next to find out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/codeigniter-test-coverage.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>When frameworks are too friendly</title>
		<link>http://www.conceptric.co.uk/when-frameworks-are-too-friendly.htm</link>
		<comments>http://www.conceptric.co.uk/when-frameworks-are-too-friendly.htm#comments</comments>
		<pubDate>Thu, 29 Jan 2009 16:50:43 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Everything]]></category>
		<category><![CDATA[Posts]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[content management system]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[skills]]></category>

		<guid isPermaLink="false">http://www.conceptric.co.uk/?p=141</guid>
		<description><![CDATA[High quality Content Management Systems and development frameworks are everywhere, but are they all trying to be too friendly and flexible?]]></description>
			<content:encoded><![CDATA[<p><a href="http://drupal.org/project/Modules">Drupal modules</a> and <a href="http://wordpress.org/extend/plugins/">WordPress plugins</a> offer a huge range of functionality that&#8217;s easily integrated. <a href="http://codeigniter.com/">CodeIgniter</a> provides a clear program structure with plenty of utility functions within easy reach.</p>

<h3>Positive experiences.</h3>

<p>The most frequently touted benefit frameworks have to offer is minimising the time taken to code and deploy a software solution. Given my interest in Agility, this is an attraction, reducing the time to market.</p>

<p>Another solid development practice is code reuse in the form of software components, and frameworks have a place amongst them. This approach offers the reliability and security inherent in widely used and tested code. Remember to choose popular software though, or this benefit disappears.</p>

<h3>On the downside.</h3>

<p>Applications developed using frameworks have to carry significant excess baggage in the form of unused features. This raises two main issues: your codebase will be unnecessarily large, and underused blocks of code are a breeding ground for hidden exploits and errors.</p>

<p>Frameworks are designed to function in a specific way, some with more flexibility than others. This much you&#8217;d expect, after all it&#8217;s the essence of a framework, but what if it doesn&#8217;t provide everything you need? For example, I&#8217;ve spent hours trying to integrate <a href="http://www.simpletest.org/">SimpleTest</a>, a <a href="http://en.wikipedia.org/wiki/Unit_testing">unit testing</a> suite, to produce satisfactory results with CodeIgniter. My unit tests run well for my own libraries, but I&#8217;m still unhappy with the test coverage imposed by CodeIgniter&#8217;s <abbr title="Model-View-Controller">MVC</abbr> implementation.</p>

<p>Finally, they say practice makes perfect, but does reliance on any framework reduce developer skill? This isn&#8217;t a problem if everything is pre-packaged in your chosen tool, but what if a client wants something that isn&#8217;t included?</p>

<h3>Too good to ignore.</h3>

<p>That said, I&#8217;ve found all of these software very useful and there are far too many advantages to ignore them. But I often find myself fighting these same tools, frustrated at they&#8217;re eagerness to help me do something in a way I don&#8217;t want it done. I guess the key is to understand which is the right tool for the current job: the ultimate skill for a developer.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/when-frameworks-are-too-friendly.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What Git does best.</title>
		<link>http://www.conceptric.co.uk/what-git-does-best.htm</link>
		<comments>http://www.conceptric.co.uk/what-git-does-best.htm#comments</comments>
		<pubDate>Tue, 18 Nov 2008 20:55:40 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Everything]]></category>
		<category><![CDATA[Posts]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[version control]]></category>

		<guid isPermaLink="false">http://www.conceptric.co.uk/?p=122</guid>
		<description><![CDATA[I've succumbed to the lure of the cool kids version control. GIT has advantages and disadvantage over my current favourite, Subversion.]]></description>
			<content:encoded><![CDATA[<p>I run several remote Subversion repositories and connect using SSH over the Internet. Having local version control for those times I don&#8217;t have an ADSL connection was the main reason I looked at Git.</p>

<p>There&#8217;s a good <a href="http://blog.macromates.com/2008/git-bundle/">TextMate bundle to support Git</a>, but to be honest I&#8217;ve mostly used the command-line.</p>

<h3>Weaknesses.</h3>

<p><a href="http://svnbook.red-bean.com/en/1.0/ch07s04.html">Vendor branching</a> is possible, <a href="http://sourceware.org/frysk/build/git-fu.html">but awkward</a>. I frequently use vendor drops of WordPress, SimpleTest and a number of other libraries. There may be a good way of doing this, but I haven&#8217;t found it online&#8230; yet.</p>

<p>I miss the <a href="http://svnbook.red-bean.com/en/1.0/ch07s03.html">svn:externals</a> functionality, especially in applications that use a lot of plugins: WordPress in particular. Subversion allows me to define particular tagged versions of these to be pulled from their repositories during deployment without needing to bother controlling them myself.</p>

<h3>Strengths.</h3>

<p>Branch merging when trying out new ideas is a dream. I created a new branch, refactored huge sections of the codebase, and merged it all back together flawlessly. With Subversion this would have been a lot slower and more problematic. Git&#8217;s simply great for those investigatory spikes.</p>

<h3>The verdict for Git.</h3>

<p>I&#8217;ve yet to seriously try Git to interface with my remote Subversion repositories, using the &#8216;git svn&#8217; series of commands. Having local copies of these, whilst still being able to use remote Subversion would be very useful. I&#8217;ve found using remote Subversion repositories easy, but trying to push a Git repository to Subversion is not so easy. I&#8217;m also going to try deploying from a Git repository using Capistrano in the near future.</p>

<p>It strikes me that Git is best at programmer related activities and weakest in those of interest to administrators deploying applications. I shall certainly continue to use it, but alongside Subversion.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/what-git-does-best.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code ignition</title>
		<link>http://www.conceptric.co.uk/code-ignition.htm</link>
		<comments>http://www.conceptric.co.uk/code-ignition.htm#comments</comments>
		<pubDate>Sun, 16 Nov 2008 12:53:11 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Everything]]></category>
		<category><![CDATA[Posts]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[design patterns]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[trials]]></category>

		<guid isPermaLink="false">http://www.conceptric.co.uk/?p=111</guid>
		<description><![CDATA[Whilst developing a relatively simple application for managing my budgets, I've decided to experiment with a few different frameworks. With so many to choose from, how do I feel about going for CodeIgniter?]]></description>
			<content:encoded><![CDATA[<p>CodeIgniter is billed as being a lightweight PHP <abbr title="Model - View - Controller">MVC</abbr> framework. Now I&#8217;m not a big fan of PHP, despite using WordPress and Drupal, but I intend to run this application on a Synology <abbr title="Network Attached Storage">NAS</abbr>, so PHP is the only game in town.</p>

<h3>Changing the Architecture.</h3>

<p>I&#8217;m not a keen on the idea of dumping all my code in the web server root directory, so I tested the framework flexibility by rearranged the application structure a little.</p>

<p><pre class="code">
    -rw-r--r--   1 Capfile
    drwxr-xr-x  14 application
    drwxr-xr-x   3 config
    drwxr-xr-x  13 system
    drwxr-xr-x   5 public
</pre></p>

<p>Once these locations were updated in the application configuration files it all worked perfectly. The reasons for doing this sort of thing have been <a href="http://capsizedesigns.com/blog/2008/06/getting-started-with-codeigniter-part-5-loose-ends/">documented elsewhere</a>, and I agreed with them from this security standpoint, however this structure also fits better with <a href="http://www.conceptric.co.uk/capistrano-works.htm">Capistrano deployment</a>.</p>

<h3>A positive first impression.</h3>

<p>The Views deal with the presentation logic, and I like the fact that embedding PHP within the HTML is the default, instead of a complex templating system. It&#8217;s not the cleanest approach, but I prefer to have full control over my HTML.</p>

<p>As for the Controllers, the implementation is quite intuitive and you can build a friendly set of URLs with a little help from <a href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html">mod_rewrite</a> and the <a href="http://codeigniter.com/user_guide/libraries/uri.html"><code>URI</code> class</a>.</p>

<p>The form validation is a great feature that I found easy to implement within the Controllers and Views. I&#8217;ve centralised my validation rules in the global configuration file <a href="http://codeigniter.com/user_guide/libraries/form_validation.html#savingtoconfig">suggested in the documentation</a>, but haven&#8217;t got the automatic rule group feature to work yet.</p>

<p>The <code>Model</code> class is used to represent a single database table. I&#8217;m used to mapping tables with a Class in this way, but normally each instance would represent a row of data. CodeIgniter <code>Models</code> implement the <a href="http://en.wikipedia.org/wiki/Singleton_pattern">Singleton design pattern</a>, only one instance per class, from which the <code>Database</code> class methods can be called.</p>

<p>The <code>Database</code> class provides the data access layer and a good set of robust methods which return an array of <code>stdClass</code> instances representing the resulting data rows. These arrays are then forwarded to the View, where the instance variables can be directly accessed. This is quick and easy, but not very <abbr title="Object Oriented Programming">OOP</abbr>.</p>

<h3>Implementation reservations.</h3>

<p>I believe that the Model should be capable of running as a stand-alone application, once equipped with any interface, even the command-line. It&#8217;s this level of autonomy that results from the MVC design pattern: substitute a different Controller and View and it&#8217;ll still work the same way on a different platform.</p>

<p>Controllers reacting to events, whilst Views shouldn&#8217;t have direct, mutable access to instance variables. The Model should encapsulate both the data and the business logic, not something that can be effectively achieved with Singletons alone. Indeed CodeIgniter blurs this distinction by making Models optional and allowing data manipulation directly in the Controllers.</p>

<p>I&#8217;ve implemented my preferred approach by providing my own classes to replace the <code>stdClass</code>. They don&#8217;t extend the CodeIgniter <code>Model</code> class, but are instantiated within those that do, encapsulating data and business logic; including Object&#8211;relational data mapping and <acronym title="Create - Read - Update - Delete">CRUD</acronym> functionality.</p>

<p>It works well, but I&#8217;m concerned that by introducing a more rigourous approach I&#8217;m losing some of the advantages of the framework. May be I would be better to take CodeIgniter at face value, as a flexible, if a little dirty, rapid development environment that works.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/code-ignition.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why I like to be Agile</title>
		<link>http://www.conceptric.co.uk/why-i-like-to-be-agile.htm</link>
		<comments>http://www.conceptric.co.uk/why-i-like-to-be-agile.htm#comments</comments>
		<pubDate>Fri, 07 Nov 2008 20:25:11 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Posts]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[projects]]></category>

		<guid isPermaLink="false">http://www.conceptric.co.uk/?p=109</guid>
		<description><![CDATA[I've practised traditional project management techniques in Heavy Engineering, studied their use in Software Engineering, and found problems throughout. Why am I so interested in Agile techniques?]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s face the reality that no matter how clear the project goals seemed at inception, they rarely look the same by the end. I&#8217;ve worked on projects where the whole scope of the project changed between the initial planning phase and the start of the technical work. What&#8217;s more the timescale tends to shift on a daily basis and your management keep &#8216;borrowing&#8217; your resources for other vital work. This is the primary reason why I now prefer a more responsive approach; essential in a unstable world!</p>

<p>The Agile approach is more adaptable with respect to three key project variables; only the last of which, in my experience, is considered flexible in the waterfall world of engineering.</p>

<ul>
<li>Scope.</li>
<li>Time.</li>
<li>Resources.</li>
</ul>

<h3>Scope contraction.</h3>

<p>Scope flexibility is something of a taboo subject. Scope is something that is added to in both a controlled manner &#8212; providing additional revenue &#8212; or uncontrolled creep. But the point of any project is delivering something that achieves the customers business goals. This is not necessarily the product that they, or the development team, initially envisaged.</p>

<p>One uncomfortably overspent project lead to the realisation that I could have achieved the business objective well under budget by actually drastically reducing the scope. It wouldn&#8217;t have delivered exactly what the customer expected, but it would easily have achieved their goal.</p>

<p>Which is more important, expectation or results? If you have a customer representative on the team it&#8217;s much easier to explain your rationale, and the chances are they&#8217;ll like the idea of results with less work as much as you do.</p>

<h3>Timescales.</h3>

<p>If you have a customer that doesn&#8217;t mind when you deliver, you&#8217;re a rare and lucky project manager, though you&#8217;ll never actually finish anything; deadlines do provide focus. So set plenty of deadlines, that&#8217;s what iterations and releases are about.</p>

<p>Try to answer the most pressing question as quickly as possible. Leave refinements and those ever present scope changes to the next iteration, it&#8217;s probably only a few days away.</p>

<p>This rapid cycle provides useful results, whilst allowing the flexibility to quickly change direction without that wasteful churn: just tidy this up a bit then I&#8217;ll be with you.</p>

<h3>And the resources?</h3>

<p>I&#8217;m afraid the project manager has to earn their money too. Line management will always have the urge to reassign any of your key people they feel aren&#8217;t being fully employed. It&#8217;s important to emphasise that the productivity of any team depends on preventing this happening.</p>

<p>Agile teams don&#8217;t strictly segregate workload on the basis of job descriptions, that&#8217;s why you need versatile individuals. Unfortunately, these are exactly the type of individuals that those managers will want to steal away. Removing the demarcation of tasks will help ensure everyone is kept busy and that work is conducted using the minimum number of people.</p>

<h3>Better than the Waterfall.</h3>

<p>I&#8217;ve found actual project goals shift too frequently for effective use of the Waterfall approach to project management. Using iterations within this framework always felt unnatural; how do you decide how may there will be and when will you actually deliver something?</p>

<p>An Agile approach perversely leaves me feeling more in control by worrying less about control. There are a huge array of Agile software development techniques, many of which can be adapted to other engineering disciplines.</p>

<p>For Software Engineering, I would recommend reading <a href="http://www.amazon.co.uk/Art-Agile-Development-James-Shore/dp/0596527675/ref=sr_1_1?ie=UTF8&#038;s=books&#038;qid=1226088721&#038;sr=8-1"><cite>The Art of Agile Development</cite></a>. The <a href="http://www.agilealliance.org/home">Agile Alliance</a> promote the use of Agile techniques, so take a look at the <a href="http://www.agilemanifesto.org/"><cite>Manifesto for Agile Software Development</cite></a> upon which it&#8217;s all based.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/why-i-like-to-be-agile.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Capistrano works!</title>
		<link>http://www.conceptric.co.uk/capistrano-works.htm</link>
		<comments>http://www.conceptric.co.uk/capistrano-works.htm#comments</comments>
		<pubDate>Mon, 04 Aug 2008 13:52:10 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Everything]]></category>
		<category><![CDATA[Posts]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[capistrano]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.jameswhinfrey.co.uk/?p=66</guid>
		<description><![CDATA[Effective version control and Capistrano managed deployment has hugely enhanced my workflow and quality.]]></description>
			<content:encoded><![CDATA[<p>Deploying even my simplest web applications was a complicated matter:</p>

<ol>
<li>Log in as a privileged user.</li>
<li>Create the domain deployment directory.</li>
<li>Export the application code from Subversion.</li>
<li>Update the file ownership and privileges.</li>
</ol>

<p>For WordPress I also had to export code for each theme or plug&#8212;in to the required locations. So I decided to improve the situation. I&#8217;ve changed the way my WordPress sites are handled in Subversion; haven&#8217;t moved to <a href="http://git.or.cz/">Git</a> yet like the rest of the world, and I am using <a href="http://www.capify.org/">Capistrano</a> to manage the deployment.</p>

<p>Capistrano is a Ruby based remote task manager, the most commonly used tasks being for web application deployment. Obviously the original target was Ruby on Rails, but many people use it for PHP. It uses Secure Shell (SSH) as the preferred method for logging into remote servers; all communication is then encrypted.</p>

<p>What follows isn&#8217;t a full set of instructions on deploying PHP with Capistrano, <a href="http://www.hostingrails.com/forums/wiki_thread/46">HostingRails.com</a> provide a useful piece and you should look at the <a href="http://manuals.rubyonrails.org/read/chapter/97">Capistrano manual</a>, these are my thoughts. May be something more detailed might come later&#8230; but no promises.</p>

<h3>Managing the source code.</h3>

<p>The Subversion repository for each blog project uses a <a href="http://svnbook.red-bean.com/en/1.1/ch07s05.html">vendor branch</a> of the WordPress source code and  svn:externals properties to import the required themes and plug&#8212;ins from their respective repositories.</p>

<p>WordPress updates are integrated into the vendor branch and then into any of my projects without disturbing any custom code changes. For merging changes I can strongly recommend using the svn_load_dirs.pl script, it allows you to maintain file history and makes the whole process easier.</p>

<h3>And now deploy.</h3>

<p>I currently have my main Subversion and Web servers on the same machine, leaving me with the option to use the local <code>file://</code> protocol to retrieve the application files. I wanted to make my deployment script more universal so that I could use it for the production and development platforms.</p>

<p>The obvious choice was the <code>svn+ssh://</code> protocol I normally use, but in addition to SSH, I use public key authorisation with passphrases for all of my servers. A frequent problem was that Capistrano didn&#8217;t like asking for passphrases for remote machines.</p>

<p>Since the repository and deployment machines are one in the same, I can use SSH forwarding to provide a recursive tunnel by defining the following in the <em>deploy.rb</em> script.</p>

<p><pre>
<code>set :user, "me" </code>
<code>ssh_options[:forward_agent] = true</code>
</pre></p>

<p>The variable <code>user</code> tells Capistrano which user has SSH access and the <code>forward_agent</code> option allows the same SSH credentials for the tunnel to the Subversion server. Now , if your svn user is different from the ssh user you&#8217;ll need to add another couple of things:</p>

<p><pre>
<code>set :svn_user, username</code>
<code>set :repository, "--username #{svn_user} svn+ssh://hostname/repository/#{application}/trunk"</code>
</pre></p>

<p>These variables enabled me to use the default deployment tasks for my application, there&#8217;s no need to override them, just use the <code>before_</code> and <code>after_</code> hooks to define additional functionality.</p>

<h3>The result.</h3>

<p>I have two WordPress blogs deployed on my server using Capistrano and Subversion for remote control, including custom themes and third&#8212;party plugins. I&#8217;ve already redeployed to incorporate changes and everything has worked perfectly.</p>

<p>Next&#8230; Drupal?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/capistrano-works.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal revisited</title>
		<link>http://www.conceptric.co.uk/drupal-revisited.htm</link>
		<comments>http://www.conceptric.co.uk/drupal-revisited.htm#comments</comments>
		<pubDate>Thu, 24 Apr 2008 13:46:29 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[club]]></category>
		<category><![CDATA[content management system]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[writemaps]]></category>

		<guid isPermaLink="false">http://www.jameswhinfrey.co.uk/?p=58</guid>
		<description><![CDATA[Four months on and it's time to review progress on the <a href="http://northamptonshirebirdclub.org.uk/">Northamptonshire Bird Club</a> website. Is Drupal working out the way I hoped?]]></description>
			<content:encoded><![CDATA[<p>OK&#8230; as I mentioned in my <a href="http://www.jameswhinfrey.co.uk/using-drupal.htm">previous article</a>, I&#8217;d had a change of heart on the approach for the <a href="http://northamptonshirebirdclub.org.uk/">Northamptonshire Bird Club</a> website.</p>

<h3>Redefining the Architecture.</h3>

<p>I decided to start again by defining the information architecture for the site based on a proper discussion with the Club committee. The first few meetings on this topic just weren&#8217;t as well focused as they should have been; mostly my fault for not knowing what I wanted from them; but this time I tried targeting those features that the membership would really value. Each of the features that emerged seemed to fall into logical sections of the information architecture:</p>

<ul>
<li>About the Club &#8212; including notices, events and membership contacts.</li>
<li>Content on Birding &#8212; after all it&#8217;s the main focus of the Club.</li>
<li>Social groups within the Club divided by specific interest.</li>
</ul>

<p>These overall sections were used as containers for the more specific features, and these formed the basis for implementation.</p>

<p>I&#8217;ve tried an online tool called <a href="http://writemaps.com/">WriteMaps</a> for developing and sharing the architecture of this site. I haven&#8217;t decided whether it&#8217;s the best way to approach the job yet, but here&#8217;s <a href="http://writemaps.com/sitemaps/shareMap/3b3c848ehee80w3zgak2n5e4wi9m7vblx2ma8n6fmemi1orinj">the link to the detailed sitemap</a>.</p>

<h3>Implementing the Design.</h3>

<p>The original site used custom taxonomy &#8212; tagging &#8212; to enforce the architecture, with multiple sections of the site sharing the same content types. As I mentioned, this made it very confusing for the Club editors, which was reflected in the site presentation.</p>

<h4>Installing new modules.</h4>

<p>I needed to add several new modules to support the new content. There are several ways of doing this; this alone is a substantial topic; but the simplest is to download the module directory containing the code into the modules directory of your Drupal installation.</p>

<h4>Content types.</h4>

<p>For this redesign I decided that each of the features should have a dedicated content type so that users only need select the right one, there&#8217;s help text as you can see, and it&#8217;ll end up in the right place on the website. No more messing about with tags!</p>

<div style="text-align:center;"><img src="http://www.jameswhinfrey.co.uk/wp-content/uploads/the-content-types.jpg" title="The new content types" alt="The new create content menu" width="400" height="450" /></div>

<p>A great tool for this is the <a href="http://drupal.org/project/cck">Content Construction Kit (<abbr title="Content Construction Kit">CCK</abbr>)</a> module. It makes implementing new content types very easy; no PHP required; and there are a wide range of modules that provide additional data fields. I&#8217;ve used several to provide dates, images and even GoogleMaps, take a look at <a href="http://drupal.org/project/Modules/category/88">the full list of compatible modules</a> on the Drupal website.</p>

<p>Once the CCK module is installed, all the changes you want to make can be managed from the <em>Content types</em> section of <em>Content Management</em>.</p>

<div style="text-align:center;"><img src="http://www.jameswhinfrey.co.uk/wp-content/uploads/content-type-management.jpg" title="Content type management" alt="The content type management menu" width="400" height="396" /></div>

<h4>Providing access.</h4>

<p>All these new content types need to have access control set&#8211;up before you can go any further. This is done in <em>Access control</em>, under <em>User Management</em>  in the administration section of Drupal.</p>

<div style="text-align:center;"><img src="http://www.jameswhinfrey.co.uk/wp-content/uploads/user-management-menu.jpg" title="User management menu" alt="The user management menu" width="400" height="252" /></div>

<p>You should find both create and edit options to set under <em>node module</em> for the new content types.</p>

<div style="text-align:center;"><img src="http://www.jameswhinfrey.co.uk/wp-content/uploads/node-access-control.jpg" title="Node access control" alt="The node access control options" width="400" height="162" /></div>

<p>Once these are set the content types should appear on the appropriate <em>create content</em> menus.</p>

<h4>Setting up the paths.</h4>

<p>But you&#8217;ll want to set the <abbr title="Uniform Resource Locator">URL</abbr>s to reflect the new architecture before deploying.</p>

<p>I use <a href="http://drupal.org/project/pathauto">Pathauto</a> to provide aliases for my content that better reflect the structure of the website and present friendly URLs. You can do this manually, but if you can&#8217;t rely on your users to do this consistently I would recommend using Pathauto.</p>

<p>The <em>Pathauto</em> settings are under <em>Site Configuration</em>, and it&#8217;s the Node paths you want to set&#8211;up for your new content.</p>

<div style="text-align:center;"><img src="http://www.jameswhinfrey.co.uk/wp-content/uploads/pathauto-overview.jpg" title="Pathauto overview" alt="Overview of the options for the Pathauto module" width="400" height="234" /></div>

<p>These, combined with the individual content types, provide the structure for the website. For example I wanted the bird guide to appear within the birding section of the site architecture with individual entries beneath this, so I set the pattern to <cite title="Pathauto pattern for the bird guide">birding/birdguide/[title].htm</cite>.</p>

<div style="text-align:center;"><img src="http://www.jameswhinfrey.co.uk/wp-content/uploads/some-node-path-settings.jpg" title="Node path settings" alt="Examples of node path settings" width="400" height="198" /></div>

<h4>Time for a View.</h4>

<p>The Views module provides the ability to present node data in a range of different formats. With the module installed your views can be managed from the <em>Administer views</em> section found under <em>Site building</em>.</p>

<div style="text-align:center;"><img src="http://www.jameswhinfrey.co.uk/wp-content/uploads/the-views.jpg" title="Administering Views" alt="Example of the Views administration options" width="400" height="270" /></div>

<p>Here you can define new views for each of the content types and define a URL from which the specific view can be accessed in the browser. In the image above you can seen that I wanted the bird guide list to appear as the default in the bird guide, and gave it the URL <cite title="Views URL for the bird guide">birding/birdguide</cite>. These views can generate lists, tables and customised sorting, in addition to the more standard web page presentations.</p>

<h4>&#8230;And a menu.</h4>

<p>Finally we&#8217;re going to want a menu from which all our good work can be accessed. The menus and blocks in Drupal can all be found in the <em>Site building</em> section.</p>

<p>The sequence is simple, first create a new menu for the features you&#8217;ve implemented, under the <em>Menus</em> section, using the URLs of the views;</p>

<div style="text-align:center;"><img src="http://www.jameswhinfrey.co.uk/wp-content/uploads/the-birding-menu.jpg" title="The birding menu" alt="Example of the birding section menu" width="400" height="216" /></div>

<p>and then go to the <em>Blocks</em> section and put the new menu where you want it to appear on the website.</p>

<div style="text-align:center;"><img src="http://www.jameswhinfrey.co.uk/wp-content/uploads/blocks-in-the-left-sidebar.jpg" title="Defining blocks" alt="Placing the menus in left sidebar on the website" width="400" height="162" /></div>

<p>That should be it! Your new functionality has been added.</p>

<h3>Conclusions?</h3>

<p>Having established this workflow, I implemented each of the identified features one at a time, ensuring it was working and acceptable before moving on to the next.</p>

<p>I believe, and feedback suggests my users agree, that this approach to building a Drupal website is far more successful than a taxonomy based one. I still use taxonomy, but it now provides addition information for particular types of content rather than forming the basis for site architecture.</p>

<p>As for Drupal itself, it&#8217;s relatively easy to use, even without significant PHP knowledge, and the large community provides a huge range of contributed modules and support. This makes it a powerful way to develop feature rich, multi&#8211;user websites very quickly.</p>

<p>On the downside, I&#8217;ve found providing users with an easy way to upload and insert images very difficult. There are serious problems with using the popular <a href="http://drupal.org/project/tinymce">TinyMCE</a> <abbr title="What You See Is What You Get">WYSIWYG</abbr> editor and <a href="http://drupal.org/project/imce">IMCE</a> file handling together; individually they work OK, but together&#8230; I need to look at this again.</p>

<p>I would definitely recommend trying <a href="http://drupal.org/">Drupal</a> out if you need a <abbr title="Content Management System">CMS</abbr>, for an image rich website; such as a gallery; I&#8217;d try <a href="http://www.flickr.com/">Flickr</a> or, for ultimate control, hand coded <abbr title="eXtensible HyperText Markup Language">XHTML</abbr>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/drupal-revisited.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programming from a different angle</title>
		<link>http://www.conceptric.co.uk/programming-from-a-different-angle.htm</link>
		<comments>http://www.conceptric.co.uk/programming-from-a-different-angle.htm#comments</comments>
		<pubDate>Fri, 15 Feb 2008 21:25:52 +0000</pubDate>
		<dc:creator>James Whinfrey</dc:creator>
				<category><![CDATA[Everything]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[simpletest]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.jameswhinfrey.co.uk/programming-from-a-different-angle.htm</guid>
		<description><![CDATA[I don&#8217;t feel I&#8217;ve got the programming experience I&#8217;d like for my future plans. So, I&#8217;ve got one of those personal project &#8212; the type that you never seem to get round to &#8212; in mind to provide me with a good workout. Which programming platform to use for the server-side application? Whilst I have [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t feel I&#8217;ve got the programming experience I&#8217;d like for my future plans. So, I&#8217;ve got one of those personal project &#8212; the type that you never seem to get round to &#8212; in mind to provide me with a good workout.</p>

<p>Which programming platform to use for the server-side application? Whilst I have to admit that I&#8217;m not the greatest fan of PHP, it&#8217;s definitely the best option. Why? Because I need to run this application locally on a minimal server and PHP is available wherever you find Apache, and the skills should have some commercial value.</p>

<p>I&#8217;ve recently read a great deal about agile development, <abbr title="Test Driven Development">TDD</abbr> and employing software design patterns. As part of this project I&#8217;d like to apply some of what I&#8217;ve learned.</p>

<h3>A test framework.</h3>

<p>Now I&#8217;m going to need a testing framework, and I&#8217;ve gone for <a href="http://simpletest.org/">SimpleTest</a>. This framework not only provides unit testing, but the ability to create tests for web pages. I prefer to run my test suites from the command line, which is relatively easy to arrange with the TextReporter object. I&#8217;ve combined the whole thing with <a href="http://ant.apache.org/">Apache Ant</a> to automate most of the tasks in the project, including deployment.</p>

<p>Unfortunately, it appears that SimpleTest doesn&#8217;t play particularly well with PHP5, although they&#8217;re in the process of making the transition.</p>

<p>I&#8217;ve encountered the mass of error messages generated as the result of <code>E_STRICT</code>. This is easily solved by using a customised php.ini file as an option at the command prompt when executing the test code. Once this is done you can see the actual test messages!</p>

<p>A more significant problem is that the Mock object code cannot be called as static class methods in the way the documentation suggests. A little snooping through the code leads me to think that it&#8217;s due to PHP4 without the <code>static</code> keyword in the method headers required by PHP5. I don&#8217;t have a work-round for this, and I don&#8217;t want to have to alter all this code. I hope they address this as the transition to PHP5 continues, but at the moment my code is simple enough for me to write my own mocks.</p>

<p>When all is said and done, if you know how to use any of the xUnit test frameworks, SimpleTest is very easy to set-up and use.</p>

<h3>Driving with tests.</h3>

<p>Simple the tests may be, but using them to steer the direction of your coding effort takes a different mindset. The hardest part is learning which questions to ask when developing your tests. Asking the right questions about functionality will result in clean, precise code.</p>

<p>There&#8217;s always a temptation add just a little more functionality, but resist it. The point is to remain in control of the code at all times. When it&#8217;s not working, it must be because you&#8217;ve added new tests describing new functionality. The code should never contain functionality that hasn&#8217;t been demanded by a test. Good refactoring can produce beautiful code without breaking the tests &#8212; still in control.</p>

<p>I think I&#8217;m getting the hang of it in relatively simple cases, but there&#8217;s much more to learn. I&#8217;ve found it a very liberating way to develop software, whilst remaining in total control &#8212; you are using version control?</p>

<h3>Patterns in the code</h3>

<p>Whilst there are loads of <abbr title="Model&#8212;View&#8212;Controller">MVC</abbr> based frameworks out there, I want to know how it works first hand. This topic is worth an article of it&#8217;s own, and that&#8217;s what I&#8217;ll give it.</p>

<p>There&#8217;s a good chance that the core application model will need to implement a facade pattern, but lets not make any assumptions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.conceptric.co.uk/programming-from-a-different-angle.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

