<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title type="text"><![CDATA[]]></title>
  
  <updated>2014-04-09T15:13:18+01:00</updated>
  <id>http://chatley.com/</id>
  <link rel="alternate" type="text/html" hreflang="en" href="http://chatley.com" />
 
  
  <link rel="self" type="application/atom+xml" href="http://chatley.com/atom.xml" />
  
  <rights>Copyright (c) 2014 Robert Chatley</rights>
  <generator uri="http://jekyllrb.com/" version="1.0.3">Jekyll</generator>
 
  
    <entry>
      <title type="html"><![CDATA[Course Review - Continuous Delivery Kickstart]]></title>
      <link rel="alternate" type="text/html" href="http://chatley.com/posts/04-09-2014/cd-kickstart" />
      <id>http://chatley.com/posts/04-09-2014/cd-kickstart</id>
      <updated>2014-04-09T00:00:00+01:00</updated>
      <author>
        
          <name><![CDATA[Robert Chatley]]></name>
        
      </author>
      <content type="html">
        <![CDATA[<p>At the end of March <a href="http://twitter.com/sebrose">Seb Rose</a> and I ran <a href="http://kickstartacademy.io/courses/continuous-delivery-kickstart">Continuous Delivery Kickstart</a> in Paris. This was a two-day course, designed to introduce and discuss applying Continuous Delivery tools and techniques to your software development process. We wanted to focus on minimising the time between someone having an idea, and having that idea realised in software running in production in the hands of the users - without losing any of the rigor or reliability of our development process.</p>

<p>We were kindly hosted by <a href="http://valtech.fr">Valtech</a> who provided us with meeting rooms, and also use of their very nice canteen! As well as attendees local to Paris, we had people from London, and also from Plymouth! Thanks for making the trip.</p>

<p><img src="http://chatley.com/images/cdk/groupwork.png" alt="Group Work" /></p>

<p>We split the time in the workshop between hands-on technical exercises using particular tools to build up a deployment pipeline, and less technical exercises thinking about the overall process, and looking for bottlenecks and how to improve flow. We also tried to focus as much as possible on people’s own projects. This is difficult in a training course though, as it is difficult to replicate the complexities of a given software project away from team’s office, and to have other attendees (or the trainers) understand the subtleties of the problem at hand in a short timeframe. Similarly it is always difficult to come up with exercise situations that are complex enough to be meaningful, but still simple enough to be comprehensible. I think this is an area we can work on to try and find the right balance.</p>

<p><img src="http://chatley.com/images/cdk/laptops.png" alt="Technical Work" /></p>

<p>One of the themes of the course, and of agile development in general, is continually iterating, trying small experiments, analysing the results and using that information to steer your product direction. So we’ll be following our own advice, pondering on the feedback and how things went during this course, when we plan for the next one - so that we are continually trying to improve the quality of our training.</p>

<p><img src="http://chatley.com/images/cdk/present.png" alt="Presenting" /></p>

<p>If you’re interested in finding out when the next Continuous Delivery Kickstart is, then follow <a href="http://twitter.com/kickstartac">Kickstart Academy</a> on twitter.</p>

<p><img src="http://chatley.com/images/cdk/paris.png" alt="Paris" /></p>]]>
      </content>
    </entry>
  
    <entry>
      <title type="html"><![CDATA[Planning Cadence or Release Cadence? Which fits with Continuous Delivery?]]></title>
      <link rel="alternate" type="text/html" href="http://chatley.com/posts/03-04-2014/cd-cadence" />
      <id>http://chatley.com/posts/03-04-2014/cd-cadence</id>
      <updated>2014-03-04T00:00:00+00:00</updated>
      <author>
        
          <name><![CDATA[Robert Chatley]]></name>
        
      </author>
      <content type="html">
        <![CDATA[<p>Recently I attended the first <a href="http://www.meetup.com/Extreme-Programmers-London/events/166297392/">eXtreme Programmers London meetup</a> hosted by Rachel Davies at Unruly Media. Talking to people there, and thinking about what Rachel wrote in her recent post on <a href="http://agilecoach.typepad.com/agile-coaching/2014/02/sprint-vs-iteration.html">Sprints vs Iterations</a>, I started thinking about what sort of rhythm and cadence is good for teams aiming at Continuous Delivery. What is it that we should try to do regularly, if anything?</p>

<p>In Scrum we work in a timeboxed “sprint”. We plan work to be done in the sprint, with the aim of having a releasable product increment at the end of the sprint. If all goes well we can release our new features at the end of the sprint. Many teams have evolved their agile process to include end-of-sprint ceremonies of showcasing internally, and releasing their work. So if all goes well, we plan once per sprint, and we release once per sprint.</p>

<p>In Kanban we pull new work items into play as there is room for them in the pipeline. Ideally we start at the right hand side of our development flow, and our first aim on any given day is to get the features we currently have in progress, released. Once we’ve reduced that work in progress by releasing something, we can pull in a new piece of work from the queue at the left of the board, which is prioritised by the business. We don’t have a timebox, or a regular planning or release time, we do each when we can or when we need to. There isn’t really a fixed rhythm.</p>

<p>In XP, there are timeboxed iterations, and planning occurs at the beginning of the iteration, but it was never the intention in XP that features should only be released at the end of the iteration. Everything can be released as soon as it is accepted by the customer. If we wait for the end of the iteration, then our process is causing us to keep work-in-process that is not yet released, and not yet delivering value to the customer. That is waste. We’ve made a rule for ourself, and the process becomes a bottleneck.</p>

<p>For some teams, especially in larger organisations, there can be external factors that affect when they can release. For example, a team in a bank that I worked with had a fairly kanban-esque process in terms of development work, pulling stories in when the team had capacity to work on them, but they could not release whenever they liked, as they had to co-ordinate with change control and operations teams. Releases happened once a week, on Thursdays. So for this team, the cadence was controlled by the external release team. The rhythm of the team was determined by this, rather than by a planning cycle. Planning happened on an ad-hoc basis, but releases always came on Thursdays. This could again be a bottleneck, building up unreleased features, but it wasn’t the teams choice. This is the sort of situation where developing more of a devops culture, and working together to try and achieve easier, more frequent releases could help to deliver value more quickly.</p>

<p>It may seem like a kanban flow, in an evironment where we are free to release whenever a feature is ready, would be the ideal. However, I do still see a benefit for teams of having some kind of regularly repeating rhythm - something that always happens on Mondays, or Fridays, or on the 1st of the month. Something to build up to and to work around. Without this I have seen team slip into a casual - it’ll be ready when it’s ready - work style. Having a regular rhythm driven by some aspect of your process does seem to help people to focus on getting things done - but it’s a difficult balancing act to make sure that what controls the rhythm doesn’t also cause bottlenecks that get in the way of delivery.</p>
<hr />
<h2 id="continuous_delivery_course">Continuous Delivery Course</h2>

<p>I’m running a public two-day <a href="http://kickstartacademy.io/courses/continuous-delivery-kickstart">Continuous Delivery Kickstart</a> workshop with <a href="http://twitter.com/sebrose">Seb Rose</a> in Paris in March. Why not come along to learn, practise and discuss?</p>
<hr />]]>
      </content>
    </entry>
  
    <entry>
      <title type="html"><![CDATA[TICOSA - the Software Archaeology Conference]]></title>
      <link rel="alternate" type="text/html" href="http://chatley.com/posts/02-18-2014/ticosa" />
      <id>http://chatley.com/posts/02-18-2014/ticosa</id>
      <updated>2014-02-18T00:00:00+00:00</updated>
      <author>
        
          <name><![CDATA[Robert Chatley]]></name>
        
      </author>
      <content type="html">
        <![CDATA[<p>A couple of weeks ago, we held the <a href="http://ticosa.org">First International Conference on Software Archaeology</a> (TICOSA) here in London. <a href="http://twitter.com/duncanmcg">Duncan McGregor</a> and I chaired the conference, and we had a great day of interesting talks and discussion.</p>

<p>Some people asked what had caused us to put on this conference in the first place. The story is that Duncan and I were sitting at breakfast at another conference (<a href="http://accu.org/index.php/conferences">ACCU</a>) back in April of last year, and the topic of working with decompiled code came up (as is not unlikely whilst breakfasting at ACCU). I asked Duncan if there were any lessons that he’d taken away from the exercise of decompiling and trying to make sense of the code he’d been working on recently. He thought there were, and we posited that perhaps this might make the basis of a conference session. But where to submit it? Over the following couple of months, we looked at various conferences, but just couldn’t quite find the right audience for this session on what seemed to be, not exactly software development, or engineering, but more like <em>software archaeology</em>. A colleague jokingly (I think) suggested that maybe we should create our own conference, all about software archaeology, but we took him at his word and TICOSA was born. Though as it turned out, after looking at all of the other interesting work in the area, we ended up not including our own session in the programme!</p>

<p>The conference was one day, hosted at the Museum of London (for a sense of history) and we had a great and varied series of presentations throughout the day, and much discussion between the delegates during and afterwards. You can find the details of the talks, and quite a few of the presentation slides on the <a href="http://ticosa.org/sessions.html">conference website</a>. We didn’t really define what Software Archaeology was - on the website we just wrote that we wanted to focus “what we can learn about our present by digging up the bones of old code, and techniques for bringing ancient code back to life.”</p>

<p><img src="http://chatley.com/images/ticosa/opening.jpg" alt="Opening" /></p>

<p>Quite a few of the talks showed us some nice visualisations of looking back through version control repository history. <a href="https://twitter.com/dmitrykandalov">Dmitry Kandalov</a> showed us some animations that looked into the history of projects like JUnit, and we were able to postulate about the development culture of the team that built the product, based on the related artifacts in the version control history. The moving dots in Dmitry’s presentation made me think of <a href="https://www.ted.com/speakers/hans_rosling.html">Hans Rosling</a>.</p>

<p><img src="http://chatley.com/images/ticosa/dmitry-rosling.jpg" alt="Dmitry" /></p>

<p>Later in the day, <a href="https://twitter.com/robsmallshire">Robert Smallshire</a> gave us more visualisations. Rob animated the history of a project, so we could see the codebase change frame by frame. What looks good? What looks like a problem? What’s going on here? The visualisations don’t give us definitive answers, but they allowed us to quickly find things that looked conspicuous, places where we might like to dive in and take a look.</p>

<p><img src="http://chatley.com/images/ticosa/smallshire-map.jpg" alt="Smallshire" /></p>

<p>A lot of what was talked about was looking back into the past and finding things out, calculating metrics, changes etc. The main question I was left with was how can we take this information mined from project history, and use it day-to-day as we develop to help us build new systems.</p>

<p>Together with some of my students at Imperial College, we’re working on building some new tools that can support developers by providing them with more contextual information about the code that they are working on, based on insights mined from version control. These are just prototypes at the moment though, and we haven’t experimented with them in the wild. Let me know if you’re interested in trying them out!</p>

<p>So, will there be a TICOSA again next year? We’re not sure - maybe. It certainly seemed like there was a lot of interest during the day, and there doesn’t seem to be another destination for people to discuss quite the same topics, so maybe we will, if there’s demand?</p>

<p>Some other people penned some more detailed write-ups of the day, here are a couple of links:</p>

<ul>
<li><a href="http://www.fatvat.co.uk/2014/02/the-first-international-conference-on.html">Jeff Foster’s blog</a></li>

<li><a href="http://chrisroos.co.uk/blog/2014-02-07-notes-from-the-first-international-conference-on-software-archaeology">Chris Roos’s blog</a></li>
</ul>

<p>Thanks to <a href="https://twitter.com/solsila">Alice Gonzalez</a> for the photos used in this post.</p>]]>
      </content>
    </entry>
  
    <entry>
      <title type="html"><![CDATA[Teaching Continuous Delivery]]></title>
      <link rel="alternate" type="text/html" href="http://chatley.com/posts/01-28-2014/teaching-cd" />
      <id>http://chatley.com/posts/01-28-2014/teaching-cd</id>
      <updated>2014-01-28T00:00:00+00:00</updated>
      <author>
        
          <name><![CDATA[Robert Chatley]]></name>
        
      </author>
      <content type="html">
        <![CDATA[<p>The week before last I spent the week teaching at Oxford University. I teach a course on Agile Engineering Practices as part of the <a href="https://www.cs.ox.ac.uk/softeng/">Software Engineering Programme</a>. This is a part-time MSc programme for people who are currently working in the industry to develop a more formal academic training in computer science and software engineering. One of the great things about the programme is that the students bring a lot of experience from their everyday work to share and discuss with the class.</p>

<p>Although the course is called Agile Engineering Practices, and is rooted in the XP Practices, we use the <a href="http://continuousdelivery.com/">Continuous Delivery book by Jez Humble and Dave Farley</a> as the course textbook. We don’t follow the textbook chapter by chapter, but this was the book that I found put all the concepts and practices together in a big picture, including the more recent focus on release management, devops etc.</p>

<p>One of my models for constructing a course, is a diamond, similar to some of the creative processes described in <a href="http://www.creativitytoday.net/">Creativity Today</a> by Ramon Vullings and Igor Byttebier. In the first half of the course we have a diverging phase, where we see lots of different tools and techniques, and different problems that they solve. At Oxford I ask each of the students to present a short example of some tool that they use in their work for testing, release management, CI, build, project management, etc etc. We also discuss and do exercises related to unit testing, specification by example, refactoring, build automation, CI, working with legacy code, and more.</p>

<p>Once we get into the second half of the course, we enter the convergent phase, where we draw things back together so that they (hopefully) make sense and we can see the overarching structure of how all the different pieces fit together. In this course, it is really setting up the continuous delivery pipeline that does this. Setting up some infrastructure and trying some exercises that go end-to-end from idea to release, iterating quickly, really seems to solidify everything, and point out the value and contribution of each section of the chain.</p>

<p>We cover a lot of different tools and techniques during the week, and it was interesting to talk to the students about their learning experiences, and how things tied together in their minds. At the end of the second day, when we’d been struggling through trying to get some particulary messy legacy code under test, people’s minds were definitely being stretched. But talking to them again a couple of days later, they described getting “over the hump” as things started to crystallise in their minds and being to make sense.</p>

<p>It’s difficult to simulate the feeling of delivery outside of a project environment, and exercises can often feel artificial or trivial, but I hope that constructing the whole pipeline and putting techniques together helps to pull everything into place. Once the process and infrastructure and is set up, we are free to concentrate on building the right features, rather than on getting them approved for release - that part hopefully becomes automatic and fades into the background.</p>
<hr />
<h2 id="continuous_delivery_course">Continuous Delivery Course</h2>

<p>I’m running a public two-day <a href="http://kickstartacademy.io/courses/continuous-delivery-kickstart">Continuous Delivery Kickstart</a> workshop with <a href="http://twitter.com/sebrose">Seb Rose</a> in Paris in March. Why not come along to learn, practise and discuss?</p>
<hr />]]>
      </content>
    </entry>
  
    <entry>
      <title type="html"><![CDATA[Continuous Delivery versus Continuous Deployment]]></title>
      <link rel="alternate" type="text/html" href="http://chatley.com/posts/08-30-2013/cd-vs-cd" />
      <id>http://chatley.com/posts/08-30-2013/cd-vs-cd</id>
      <updated>2013-08-30T00:00:00+01:00</updated>
      <author>
        
          <name><![CDATA[Robert Chatley]]></name>
        
      </author>
      <content type="html">
        <![CDATA[<p>Continuous Delivery and Continuous Deployment are two fairly similar terms, but they describe two separate things. Let’s try to clear things up.</p>

<p><strong>Continuous Delivery</strong> - as described in the <a href="http://continuousdelivery.com/">book by Jez Humble and Dave Farley</a>, is the process of streamlining the workflow from someone having an idea, to having that idea implemented in software, released into production, and available to the end users. It involves breaking down features into small parts that can be delivered one at a time, so that we can have a constant stream of updates. This allows us to get rapid feedback from our users and customers about the features we are developing, and to refine them iteratively. To achieve Continuous Delivery we try to automate any task that might be a bottleneck in releasing our code - but we don’t necessarily release every single build to production. We want releasing to be a business decision, not a technical one. If a version of the code running on a demo server looks good to the business, we would like to be able to release that at the push of a button.</p>

<p><strong>Continuous Deployment</strong> - is a technical practice, first described by <a href="http://timothyfitz.wordpress.com/2009/02/08/continuous-deployment/">Timothy Fitz</a> whereby every time that a developer checks in to version control, the latest version of the code is built, and if all the tests and other build stages pass, then this version of the code is promoted automatically to the live, production environment, without any further manual intervention. Performing the technical practice of Continous Deployment naturally means that a team is continuously delivering updates to the code into production (either that, or they very rarely check in, which would clearly be a negative outcome). However, doing Continuous Deployment doesn’t mean that we are necessarily breaking work down into meaningful, valuable chunks, and focussing our efforts to deliver the most important features for our users one at a time.</p>

<p>Continuous Deployment means that every potential release (good build), becomes a release. You might have business reasons why you don’t want to do this - for example you need to align the release of a feature with some user training, or a marketing campaign. However, it is worth performing the thought experiment of whether Continuous Deployment just seems “too scary” for your team. If it does, what are you worried about going wrong? What might break? What sort of test automation, monitoring etc would you need in order to feel confident in releasing a build without further manual testing. If you have a build that is currently green but which you wouldn’t necessarily put into production - what is your green build actually telling you?</p>
<hr />
<h2 id="cd_courses">CD Courses</h2>

<p>Want to find out more? Register for one of my upcoming courses: <a href="http://bddkickstart.com/cd-details">Continuous Delivery Kickstart</a> a two-day workshop on Continuous Delivery that we’re running in London at the end of September. Or <a href="http://continuousdeploymentcambridge.eventbrite.co.uk/">Hands-On Continuous Deployment</a> a day-long tutorial at the Agile Cambridge conference.</p>
<hr />]]>
      </content>
    </entry>
  
    <entry>
      <title type="html"><![CDATA[Releasable versus Done]]></title>
      <link rel="alternate" type="text/html" href="http://chatley.com/posts/07-29-2013/releasable-vs-done" />
      <id>http://chatley.com/posts/07-29-2013/releasable-vs-done</id>
      <updated>2013-07-29T00:00:00+01:00</updated>
      <author>
        
          <name><![CDATA[Robert Chatley]]></name>
        
      </author>
      <content type="html">
        <![CDATA[<p>Many teams following some flavour of agile use a board (physical or virtual) with columns to track the progress of tasks. When we are working to optimise the flow of items through the development process - as we often do when implementing kanban or similar methods - we concentrate on pulling items towards the right. We want to get features released and into our users’ hands. Often we have the right-most column as “Ready to Release”, with columns to the left for things like “analysis”, “in development”, “QA” etc. Once a feature has passed through these phases then it is “done” and ready to be released - see below for an example from a team I worked with recently. However, I’ve been thinking this is the wrong way around.</p>

<p>Let’s think about the way a scrum or XP team works, within a fixed length iteration or sprint. At the start of the iteration they have a number of tasks in the To Do column, and gradually move them through analysis, development and QA until hopefully they are all done and end up in Ready to Release. Then at the end of the iteration we release them.</p>

<p>If we are working towards continuous delivery then we want to be able to release our code not just at the end of the sprint, but after any green build. Continuous delivery is all about making the process from idea conception to software running in production as smooth as possible. Whenever we agree that there is value to releasing the current feature set, we should be able to do so, without any technical bottlenecks or necessarily waiting until the end of an artificial timebox. As soon as a feature is ready, we want to be able to release it.</p>

<p>But what if some things aren’t ready? In a team with more than a couple of developers, it’s likely that we’ll be working on a couple of features in parallel. How can we release one feature when others are still being worked on? I’ve often heard people make the argument “we can’t release something if it isn’t done” - but I don’t think that’s right.</p>

<p><img src="http://chatley.com/images/photos/board-cols.jpg" alt="Kanban Columns" /></p>

<p>To get to a state of continuous delivery, we have to be able to release any good build, which may contain any number of incomplete features - but in a form such that they do not negatively impact the user experience. I might have added some code and tests for a feature, where the tests pass, but the code isn’t actually called from the rest of the application yet. That’s safe to deploy - the new code isn’t called - but the feature certainly isn’t complete. Or we may have a feature that we’re still working on and testing internally, but in the live system it is hidden in the UI, perhaps using a <a href="http://martinfowler.com/bliki/FeatureToggle.html">feature toggle</a>.</p>

<p>Practising continuous integration and continuous delivery means that every commit that we make is potentially releasable, but it doesn’t mean that we have to wait until our feature is complete before committing - quite the opposite in fact. It does however mean that we need to change the way that we think about adding code to the system so that we can add things iteratively and incrementally, without breaking any current behaviour. Once we can do this, we can release any time we want. The code should always be releasable, regardless of whether or not any particular feature is done.</p>
<hr />
<p>If you are interested in finding out more about these issues, don’t forget about <a href="http://bddkickstart.com/cd-details">Continuous Delivery Kickstart</a> a two-day workshop on Continuous Delivery that we’re running in London at the end of September.</p>
<hr />]]>
      </content>
    </entry>
  
    <entry>
      <title type="html"><![CDATA[Continuous Delivery Kickstart]]></title>
      <link rel="alternate" type="text/html" href="http://chatley.com/posts/07-04-2013/announcing-cd-kickstart" />
      <id>http://chatley.com/posts/07-04-2013/announcing-cd-kickstart</id>
      <updated>2013-07-04T00:00:00+01:00</updated>
      <author>
        
          <name><![CDATA[Robert Chatley]]></name>
        
      </author>
      <content type="html">
        <![CDATA[<p>We’re pleased to announce the first <a href="http://bddkickstart.com/cd-details">Continuous Delivery Kickstart</a>, to be held in London on 30th Sept-1st Oct. Based on the successful format of the popular <a href="http://bddkickstart.com">BDD Kickstart</a> training courses, Continuous Delivery Kickstart is an intensive, hands-on training looking at various aspects of Continuous Delivery, and showing you how to combine practices and tools to set up a streamlined delivery pipeline.</p>

<p>Continuous delivery is all about making the process from idea conception to software running in production as smooth as possible. You can read more about the background in <a href="http://continuousdelivery.com/resources/">Jez Humble and Dave Farley’s excellent book</a>, but to get some hands-on, practical experience of rapid iteration and automated, repeatable delivery, <a href="http://bddkickstart.com/cd-details">book a ticket</a> for our course.</p>

<p>In the two day course, we’ll teach you everything you need to be off and running with continuous delivery. We’ll start with the fundamental principles continuous delivery, and how it fits into the wider world of agile. We’ll show you how integrate a set of tools to create a deployment pipeline allowing your code to flow smoothly though all the stages from development to production. Then we’ll investigate how having this pipeline allows us to deploy code in much smaller batch sizes, iterating more quickly. We’ll look at how automating the integration, test and release processes can change the way that a development team behaves, and the way we think about developing new features.</p>

<p>We’re keeping the group small to make sure that all participants get lots of contact time with the trainers, and to make sure that we have time to discuss applying continuous delivery in your particular context. That means that the number of tickets available is limited, so <a href="http://bddkickstart.com/cd-details">sign up</a> early to make sure of your place.</p>

<p><img src="http://chatley.com/images/cdkickstart/pairing-laptops.jpeg" alt="Pair Concentrating" /></p>]]>
      </content>
    </entry>
  
    <entry>
      <title type="html"><![CDATA[Generating Machine Images from CI]]></title>
      <link rel="alternate" type="text/html" href="http://chatley.com/posts/06-18-2013/machine-images-from-ci" />
      <id>http://chatley.com/posts/06-18-2013/machine-images-from-ci</id>
      <updated>2013-06-18T00:00:00+01:00</updated>
      <author>
        
          <name><![CDATA[Robert Chatley]]></name>
        
      </author>
      <content type="html">
        <![CDATA[<p>Recently I have been investigating different ways of implementing a deployment pipeline, part of the engineering discipline of <a href="http://continuousdelivery.com/">continuous delivery</a>. Particularly I’ve been looking at this in the context of systems running in the cloud. The advent of Infrastructure as a Service systems like Amazon’s EC2 has made it very easy for teams to spin up new servers within a matter of minutes. This reduction in lead time compared with traditional infrastructure means that it is easy for teams to scale up their applications to deal with increased demand, and also facilitates creating test and development environment that mirror production environments very closely. Differences in configuration between test and production environments have always been a major cause of bugs that are only caught in production - which is too late.</p>

<p>Systems like Amazon’s EC2 (Elastic Compute Cloud) allow us to start and run servers, paid for by the hour, based on saved machine images. In Amazon’s world these are called AMIs (Amazon Machine Images). We create an AMI by starting up a machine (an <em>instance</em>) running in the cloud with a basic configuration (based on another AMI), installing whatever software we need, and setting up our required configuration, and then saving a snapshot of this machine as a machine image. This is saved into the Simple Storage Service (S3), from where it can be read and used to start new instances.</p>

<p>I have been promoting the practice of creating AMIs as an output of the build process run by your continuous integration server. Traditionally teams have used CI servers to compile code and run tests, perhaps packaging it into an archive like a zip file ready for release. I suggest going one step further, starting up a machine in the cloud, copying this zip file to it, unpacking it, setting up any configuration necessary, and snapshotting that machine as an AMI, all as part of the build process. The artefact that is the output of the CI build is an AMI.</p>

<p><img src="http://chatley.com/images/cditc/build.png" alt="CI" /></p>

<p>Once we have the AMI as the output of CI, it is easy to start up servers in a test or staging environment that we know are <em>identical</em> to those that will go into production - as we will launch them based on the same machine image. This gets rid of a whole class of problems to do with different operating system versions, libraries, or configuration options that may vary between test and production environments. This helps give us confidence in what we will release as we test in an environment almost identical to production.</p>

<p>If we use our AMIs together with Amazon <em>autoscaling groups</em> then we can effect deployment by having Amazon’s infrastructure replace old instances with new ones. An autoscaling group is a group if instances based on the same AMI. The infrastructure ensures that the group always contains at least a certain number of instances, so that if one should die for any reason a new one will be started to maintain the minimum group size. A <em>launch configuration</em> specifies the type of machine and the AMI that should be used, should the scaling group need to launch a new instance.</p>

<p>We can perform a deployment as follows. 1) create a new AMI as the output of CI, 2) create a new launch configuration referencing the new AMI, 3) update the scaling group to use the new launch configuration, 4) gradually kill off your old instances and wait for the scaling group to repopulate itself with instances based on the new AMI.</p>

<p><img src="http://chatley.com/images/cditc/scaling-group.png" alt="scaling group" /></p>

<p>One of the benefits of this approach is that instances are started in the same way, whether they are launched as part of a deployment, or whether the size of the scaling group is increased and more instances are launched to deal with extra demand.</p>

<p>A slight drawback is that snapshotting and creating AMIs can take time, depending on the size of the disk image to be created, so if you are doing very frequent commits then it may net be efficient to create an AMI for every build. But, in an environment that is tending towards <a href="http://timothyfitz.com/2009/02/10/continuous-deployment-at-imvu-doing-the-impossible-fifty-times-a-day/">continuous deployment</a> I think it works well.</p>

<p>I gave a talk at the <a href="http://www.agilecambridge.net">Agile Cambridge conference</a> last year that talks about this approach in more detail. The <a href="http://www.infoq.com/presentations/Continuous-Delivery-Cloud">video is now available</a> if you would like to hear more.</p>]]>
      </content>
    </entry>
  
    <entry>
      <title type="html"><![CDATA[Ever Decreasing Circles]]></title>
      <link rel="alternate" type="text/html" href="http://chatley.com/posts/06-11-2013/ever-decreasing-circles" />
      <id>http://chatley.com/posts/06-11-2013/ever-decreasing-circles</id>
      <updated>2013-06-11T00:00:00+01:00</updated>
      <author>
        
          <name><![CDATA[Robert Chatley]]></name>
        
      </author>
      <content type="html">
        <![CDATA[<p>One of the principles of agile development is increasing feedback by decreasing cycle times, continuously iterating on products. Over the years we have seen the progression from infrequent integration, to continuous integration, to continuous delivery (and beyond!). As we see teams trying to improve their development practices, they are often encouraged to take measures to reduce the length of the cycles they work in, from releasing every 6 months, to releasing once a month, or from once a month to once a week. Rather than working on big stories or features, we try to break them down into small features. This goes all the way from product road-maps to red-green-refactor TDD loops. Reducing cycle time is generally accepted to be a good idea and something to work towards, but why are we doing it?</p>

<p>For a lot of teams, the length of the cycle is an easy thing to measure and to feel good about reducing: “we went from releasing once a month, to once a week!”. But why is it better? Two reasons: 1) limiting work in progress, 2) access to feedback.</p>

<p>Reducing work in progress is one of the themes stressed by those following kanban methods, but as well as reducing the number of work items that we are processing concurrently, we also want to reduce their size. This has the simple benefit that they are easier for our limited human brains to think about, and easier to complete. At every point that we have something that is “complete”, we get the opportunity go gather feedback, either from team members, product managers, or direct from our users.</p>

<p>Gathering feedback is important because it tells us whether or not what we have done is good. However, the most important aspect is that we should <em>act on this feedback</em>. Many teams that I see are following an “agile method”, and are working in weekly, or two-weekly, or monthly cycles. They’re developing features and they may or may not be releasing them to live on a regular basis. But they aren’t completing the loop - they are planning and working in smaller chunks, so they have less to keep in their minds at once, but they aren’t taking full advantage of completing each section to provide new information feeding in to their plans. They are typically following a pre-formed plan to a pre-defined goal, chipping away at it incrementally, rather than learning and changing plans at every cycle. Agility is all about having the ability to change direction easily. If you aren’t going to try to change direction you lose a lot of the benefit.</p>

<p>Eric Ries’ work on the Lean Startup focusses on obtaining feedback and <em>validated learning</em> over building product increments. There are still cycles, and reducing their length is still desirable, but the main outcome from each cycle is the incorporation of the feedback, which informs what we do in the next. If we can gain the learning without building any software at all, this is in a sense <em>ideal</em>.</p>

<p>I’ll be speaking on this topic at the <a href="http://gotocon.com/berlin-2013/presentation/Towards%20Continuous%20Delivery%20-%20Ever%20Decreasing%20Circles">GOTO Berlin conference</a> in October, so look out for that session if you’d like to hear more.</p>]]>
      </content>
    </entry>
  
    <entry>
      <title type="html"><![CDATA[Training from the Back of the Room]]></title>
      <link rel="alternate" type="text/html" href="http://chatley.com/posts/01-24-2013/training-from-the-back" />
      <id>http://chatley.com/posts/01-24-2013/training-from-the-back</id>
      <updated>2013-01-24T00:00:00+00:00</updated>
      <author>
        
          <name><![CDATA[Robert Chatley]]></name>
        
      </author>
      <content type="html">
        <![CDATA[<p>A while ago I read Sharon Bowman’s book <a href="http://www.bowperson.com/books.htm">Training from the Back of the Room</a>. In the book, Bowman presents a number of techniques for getting away from the traditional “chalk and talk” form of training, and making learning a more interactive experience. She suggests connecting with previous experiences, cutting down the length of presented segments, focussing on concrete practice and exercises, and putting the learners at the centre of the activity - rather than being a passive audience.</p>

<p>I have been trying to add more of these elements to my training and educational work. I try to have a balance of about one third presentation to two thirds hands-on practical exercises.</p>

<p>Last week I taught my <a href="http://www.softeng.ox.ac.uk/subjects/APE.html">Agile Engineering Practices</a> course, part of Oxford University’s <a href="http://www.softeng.ox.ac.uk/">Software Engineering MSc</a>, which is an intensive 1-week format. It’s an in-depth look at the engineering practices that support the application agile methods to software development, and we cover a lot of different types of tools and how they support one another.</p>

<p>One things we did differently this time was to have each student research a different tool in their own time and make a short presentation (5 minutes or so) or demo describing the tool, what it was for, comparisons with any alternatives etc. This seemed to be a good way of getting the students involved in presenting some of the material, and widening the landscape of tools that we could cover in the course. The students did a good job of the presentations, and I also noted that these short talks generated a lot of questions from the rest of the class, more so than the longer sections of material that I presented.</p>

<p><img src="http://chatley.com/images/apeoxford/mark.jpg" alt="Presenting" title="Mark presenting" /> <img src="http://chatley.com/images/apeoxford/presenting.jpg" alt="Presenting" title="Tanveer presenting" /></p>

<p>For the hands-on exercises, we encourage people to pair, but it isn’t always taken up. People say they want to make sure they understand things themselves, rather than relying on their pair to solve the exercise. Some pairs are sticky, as people tend to work on the same computers from day to day. Perhaps we should do more to enforce rotation. Perhaps we might try to match (or rather mis-match) experience with a particular tool or technology in the pairs, so that someone who is more familiar can teach someone who has less experience.</p>

<p><img src="http://chatley.com/images/apeoxford/pairing.jpg" alt="Pairing" title="Students pairing" /><img src="http://chatley.com/images/apeoxford/tripling.jpg" alt="Tripling" title="Students tripling" /></p>

<p>Given the advice in the book on making learning more effective, I think I’d like to try using these sort of techniques for more of the course, but it is quite at odds with the normal university style of teaching. The students expect to be lectured to, and particularly for undergraduates, do not really appear to think of other forms of teaching as as efficient or effective. Tutorials are often attended much less than lectures. In Oxford we have the benefit that the whole class attends all the sessions for the whole week, so there might be more opportunities to innovate on the format.</p>

<p><img src="http://chatley.com/images/apeoxford/tea.jpg" alt="Pairing" title="Break time" /></p>]]>
      </content>
    </entry>
  
    <entry>
      <title type="html"><![CDATA[Continuous Delivery Workshop in Amsterdam]]></title>
      <link rel="alternate" type="text/html" href="http://chatley.com/posts/08-07-2012/cd-workshop" />
      <id>http://chatley.com/posts/08-07-2012/cd-workshop</id>
      <updated>2012-08-07T00:00:00+01:00</updated>
      <author>
        
          <name><![CDATA[Robert Chatley]]></name>
        
      </author>
      <content type="html">
        <![CDATA[<p>Together with <a href="http://uglyduckling.nl/">Ugly Duckling</a> I’m going to be running a workshop on continuous delivery and continuous deployment in Amsterdam on September 15th. Details of the workshop, how to book etc, are <a href="http://uglyduckling.nl/news/continuous-delivery-workshop-in-amsterdam/">here</a>. The workshop is free to attend, but places are limited, so sign up now if you are interested in coming.</p>

<p>Release and deployment is often still a stressful part of software delivery. We still often see teams producing large releases and problems occurring at release time. Following the principle of “if it hurts, do it more often”, we aim to automate releases as much as possible, and to do them as often as possible.</p>

<p>Continuous delivery is all about making the process from idea conception to software running in production as smooth as possible. Continuous deployment is a hot topic in the startup community. It involves iterating very quickly, releasing many times per day, pushing every good build into production. This helps to get real feedback from users using our features in production, so we can really test whether the software we have produced is what the users want.</p>

<p>In this session we will look at some of the techniques that allow us to get to this point, and try them out in hands on exercises and simulations.</p>

<p><img src="http://chatley.com/images/extremestartup/J+J.jpg" alt="Pair Concentrating" /></p>

<p><a href='http://uglyduckling.nl/news/continuous-delivery-workshop-in-amsterdam/'><img src='/images/cd/flyer.png' width='242' /></a></p>]]>
      </content>
    </entry>
  
    <entry>
      <title type="html"><![CDATA[Making Music with Clojure and Overtone]]></title>
      <link rel="alternate" type="text/html" href="http://chatley.com/posts/10-28-2011/overtone" />
      <id>http://chatley.com/posts/10-28-2011/overtone</id>
      <updated>2011-10-28T00:00:00+01:00</updated>
      <author>
        
          <name><![CDATA[Robert Chatley]]></name>
        
      </author>
      <content type="html">
        <![CDATA[<p>This week I attended the London Clojure Dojo for the first time. It was a special edition focussed on making music using <a href="http://overtone.github.com/">Overtone</a>. A couple of weeks ago I was presenting a Clojure tutorial at the <a href="http://www.fpday.net/fpday2011/index.php">FPDay</a> conference in Cambridge, and met <a href="http://sam.aaron.name/">Sam Aaron</a> there. Sam is one of the main proponents and developers of Overtone, and he came to London to give us an introduction - then it was up to us to see if we could make any interesting music, or at least noises.</p>

<p>Overtone is a piece of software written in Clojure that provides a front-end to a synthesiser - we were using SuperCollider. By writing and evaluating bits of Clojure code, we can send commands to the synthesizer to create sounds. Sam explained how the components of SuperCollider work internally, with synths, busses and buffers, but when we came to try it, it seemed like people could be more creating using Overtone by working at a higher level of abstraction, talking about notes and chord progressions, rather than frequencies and waveforms. Music seems to fit quite naturally with levels of abstraction, from notes we build chords, or fill in bars, then build these into bars and phrases, and maybe use these to assemble a higher level form like a Viennese waltz or a twelve-bar blues.</p>

<p><img src="/images/overtone/sam-landscape.jpg" alt="Group" /></p>

<p>It was interesting to see that the group was made up of some people who knew a lot about programming, but not so much about music, others who were musicians, but didn’t really know much about programming, and some who fell in between. Some people came from the perspective of having learned an instrument, others were more familiar with synthesis and creating sounds, and then perhaps using software like Cubase or GarageBand to sequence sounds into compositions.</p>

<p>We split into groups and played around with trying to make some music, then at the end we came back together for a show (and listen) and tell. It was pretty impressive what people could come up with in just over an hour, with little prior knowledge of the system.</p>

<p><img src="/images/overtone/nicholas.jpg" alt="@ntoll" /></p>

<p><a href="http://twitter.com/ntoll">Nicholas</a>, who trained at the Royal College of Music but later studied computing and now works in a startup as a programmer, used Overtone to create a piece of music inspired by Steve Reich’s <a href="http://www.youtube.com/watch?v=AnC5DhNqZ6w">Piano Phase</a>. He took a sequence of notes and generated a repeated cycle in the Clojure code. Then he played two voices of this sequence at the same time, one very gradually speeding up, creating phase shifts with the version playing at a constant tempo.</p>

<p><img src="/images/overtone/marius.jpg" alt="Marius" /></p>

<p>Marius and his group took some of the example code as a starting point, playing a dubstep track, but then hooked up an iPad app <a href="http://hexler.net/software/touchosc">touchosc</a> that allowed them to interact with the music in realtime by using sliders on the screen of the iPad. They used this to modulate the pitch of the music, and superimpose another tune over the top.</p>

<p>For our own efforts, we contentrated on the lower level end of things, looking at how to create instruments and control the synthesiser by sending it messages. We created sequences of frequencies (pitches) and times to change frequency. In this way we could slide notes up or down over time. We realised that to do this better, and better emulate something like a piano glissando, we needed to make the steps in frequency proportional to the current frequency, as the frequency of a note doubles with every octave rather than increasing linearly, but we didn’t have time to figure out the maths. Here’s a snippet:</p>
<div class='highlight'><pre><code class='clojure'><span class='p'>(</span><span class='nf'>definst</span> <span class='nv'>square-wave</span> <span class='p'>[</span><span class='nv'>freq</span> <span class='mi'>440</span><span class='p'>]</span> <span class='p'>(</span><span class='nf'>square</span> <span class='nv'>freq</span><span class='p'>))</span>

<span class='p'>(</span><span class='k'>def </span><span class='nv'>times</span> <span class='p'>(</span><span class='nb'>take </span><span class='mi'>220</span> <span class='p'>(</span><span class='nb'>iterate </span><span class='o'>#</span><span class='p'>(</span><span class='nb'>+ </span><span class='mi'>30</span> <span class='nv'>%</span><span class='p'>)</span> <span class='mi'>0</span><span class='p'>)))</span>

<span class='p'>(</span><span class='kd'>defn </span><span class='nv'>change-pitch</span> <span class='p'>[</span><span class='nv'>t</span> <span class='nv'>f</span> <span class='nv'>inst</span><span class='p'>]</span> <span class='p'>(</span><span class='nf'>at</span> <span class='p'>(</span><span class='nb'>+ </span><span class='nv'>t</span> <span class='p'>(</span><span class='nf'>now</span><span class='p'>))</span> <span class='p'>(</span><span class='nf'>ctl</span> <span class='nv'>inst</span> <span class='ss'>:freq</span> <span class='nv'>f</span><span class='p'>)))</span>

<span class='p'>(</span><span class='kd'>defn </span><span class='nv'>falling-pitches</span> <span class='p'>[</span><span class='nv'>start</span><span class='p'>]</span> <span class='p'>(</span><span class='nb'>take </span><span class='p'>(</span><span class='nb'>/ </span><span class='nv'>start</span> <span class='mi'>2</span><span class='p'>)</span> <span class='p'>(</span><span class='nb'>iterate dec </span><span class='nv'>start</span><span class='p'>)))</span>
<span class='p'>(</span><span class='kd'>defn </span><span class='nv'>rising-pitches</span> <span class='p'>[</span><span class='nv'>start</span><span class='p'>]</span> <span class='p'>(</span><span class='nb'>take </span><span class='nv'>start</span> <span class='p'>(</span><span class='nb'>iterate inc </span><span class='nv'>start</span><span class='p'>)))</span>

<span class='p'>(</span><span class='kd'>defn </span><span class='nv'>slide</span> <span class='p'>[</span><span class='nv'>pitches</span> <span class='nv'>inst</span><span class='p'>]</span> <span class='p'>(</span><span class='nb'>map </span><span class='p'>(</span><span class='k'>fn </span><span class='p'>[</span><span class='nv'>x</span> <span class='nv'>y</span><span class='p'>]</span> <span class='p'>(</span><span class='nf'>change-pitch</span> <span class='nv'>x</span> <span class='nv'>y</span> <span class='nv'>inst</span><span class='p'>))</span> <span class='nv'>times</span> <span class='nv'>pitches</span><span class='p'>))</span>

<span class='p'>(</span><span class='nf'>square-wave</span><span class='p'>)</span>
<span class='p'>(</span><span class='nf'>slide</span> <span class='p'>(</span><span class='nf'>falling-pitches</span> <span class='mi'>440</span><span class='p'>)</span> <span class='nv'>square-wave</span><span class='p'>)</span>
<span class='p'>(</span><span class='nf'>slide</span> <span class='p'>(</span><span class='nf'>rising-pitches</span> <span class='mi'>220</span><span class='p'>)</span> <span class='nv'>square-wave</span><span class='p'>)</span>
<span class='p'>(</span><span class='nf'>stop</span><span class='p'>)</span>
</code></pre></div>
<p>Overall a very interesting and enjoyable evening working on something fun with some clever people. I certainly hope to return to the dojo and to try out some more things with Overtone.</p>]]>
      </content>
    </entry>
  
    <entry>
      <title type="html"><![CDATA[Top Down TDD in Clojure with Brian Marick]]></title>
      <link rel="alternate" type="text/html" href="http://chatley.com/posts/09-21-2011/marick-clojure-tdd" />
      <id>http://chatley.com/posts/09-21-2011/marick-clojure-tdd</id>
      <updated>2011-09-21T00:00:00+01:00</updated>
      <author>
        
          <name><![CDATA[Robert Chatley]]></name>
        
      </author>
      <content type="html">
        <![CDATA[<p>This week I attended a two-day course on top-down TDD in Clojure, led by <a href="http://twitter.com/marick">Brian Marick</a>. The course was organised through the London agile community group the <a href="http://xpday-london.editme.com/eXtremeTuesdayClub">Extreme Tuesday Club (XTC)</a> and generously supported by <a href="http://www.zuehlke.com/en/">Zuhlke Engineering</a> who provided the venue, allowing us the use one of their conference rooms, and access to enough tea and coffee to get us through two days of thinking and programming.</p>

<p>The aim of the course was to learn about, and to try out, techniques for test-driven development in Clojure, especially using <a href="https://github.com/marick/Midje">Midje</a> - a tool that Brian wrote to enable programmers to use a form of mocking during development of Clojure programs. Using Midje allows programmers to explore a problem working in a breadth-first manner, without having to define all of the supporting functions at lower levels of implementation until later on.</p>

<p><img src="/images/marick/brian.jpg" alt="Marick" /></p>

<p>The course attracted a pretty experienced group of attendees, with some regular Clojure programmers, including a couple of people who help to organise the London Clojure Dojo, and some TDD experts including Steve Freeman and Nat Pryce, the authors of <a href="http://www.growing-object-oriented-software.com/">GOOS</a>. This led to some very interesting and detailed discussions, and also meant that the course quickly changed from being an instructor-led tutorial into more of an exploratory workshop, debating the pros and cons of various approaches to problems.</p>

<p><img src="/images/marick/group.jpg" alt="Group" /></p>

<p>A Midje test defines some facts about the world as we would like it to be, once we have finished our program. For example we could be writing a program to calculate the vegetarian breakfast menu for a hotel. We can state a fact that we want to be true, and some clauses to set up the situation under which this could be the case. For example, we can say that the vegetarian menu will be cereal, provided that the full menu is cereal or a full-english, a full-english contains meat, but cereal does not. Using Midje we could define that like this:</p>
<div class='highlight'><pre><code class='clojure'><span class='p'>(</span><span class='kd'>ns </span><span class='nv'>midje-example.core</span> <span class='p'>(</span><span class='ss'>:use</span> <span class='nv'>midje.sweet</span><span class='p'>))</span>

<span class='p'>(</span><span class='nf'>fact</span> <span class='p'>(</span><span class='nf'>veggie-breakfast</span><span class='p'>)</span> <span class='nv'>=&gt;</span> <span class='p'>[</span><span class='nv'>..cereal..</span><span class='p'>]</span> 
  <span class='p'>(</span><span class='nf'>provided</span> <span class='p'>(</span><span class='nf'>breakfast-menu</span><span class='p'>)</span> <span class='nv'>=&gt;</span> <span class='p'>[</span><span class='nv'>..cereal..</span> <span class='nv'>..full-english..</span><span class='p'>])</span>
  <span class='p'>(</span><span class='nf'>provided</span> <span class='p'>(</span><span class='nf'>contains-meat?</span> <span class='nv'>..full-english..</span><span class='p'>)</span> <span class='nv'>=&gt;</span> <span class='nv'>true</span><span class='p'>)</span>
  <span class='p'>(</span><span class='nf'>provided</span> <span class='p'>(</span><span class='nf'>contains-meat?</span> <span class='nv'>..cereal..</span><span class='p'>)</span> <span class='nv'>=&gt;</span> <span class='nv'>false</span><span class='p'>)</span>
<span class='p'>)</span>
</code></pre></div>
<p>We can use Midje’s meta-constants (denoted by two dots before and after the name, e.g.. <code>..cereal..</code>) to fill in the test, even though we have not yet decided the data structure that we will use to model food items or menus. We use the <code>provided</code> clauses to define sufficient properties of the meta-constants to make the test work. This is the top-down nature of this style of TDD, we will move on to making these decisions later, but can get our higher level function working first.</p>

<p>Clojure isn’t happy if we use things that are not defined, so we create a skeleton definition of <code>veggie-breakfast</code> which is our function under test, and use Midje to create skeletons for our other unfinished functions.</p>
<div class='highlight'><pre><code class='clojure'><span class='p'>(</span><span class='kd'>ns </span><span class='nv'>midje-example.core</span> <span class='p'>(</span><span class='ss'>:use</span> <span class='nv'>midje.sweet</span><span class='p'>))</span>

<span class='p'>(</span><span class='nf'>unfinished</span> <span class='nv'>breakfast-menu</span> <span class='nv'>contains-meat?</span><span class='p'>)</span>

<span class='p'>(</span><span class='kd'>defn </span><span class='nv'>veggie-breakfast</span> <span class='p'>[]</span> <span class='p'>[])</span>

<span class='p'>(</span><span class='nf'>fact</span> <span class='p'>(</span><span class='nf'>veggie-breakfast</span><span class='p'>)</span> <span class='nv'>=&gt;</span> <span class='p'>[</span><span class='nv'>..cereal..</span><span class='p'>]</span> 
  <span class='p'>(</span><span class='nf'>provided</span> <span class='p'>(</span><span class='nf'>breakfast-menu</span><span class='p'>)</span> <span class='nv'>=&gt;</span> <span class='p'>[</span><span class='nv'>..cereal..</span> <span class='nv'>..full-english..</span><span class='p'>])</span>
  <span class='p'>(</span><span class='nf'>provided</span> <span class='p'>(</span><span class='nf'>contains-meat?</span> <span class='nv'>..full-english..</span><span class='p'>)</span> <span class='nv'>=&gt;</span> <span class='nv'>true</span><span class='p'>)</span>
  <span class='p'>(</span><span class='nf'>provided</span> <span class='p'>(</span><span class='nf'>contains-meat?</span> <span class='nv'>..cereal..</span><span class='p'>)</span> <span class='nv'>=&gt;</span> <span class='nv'>false</span><span class='p'>)</span>
<span class='p'>)</span>
</code></pre></div>
<p>Then we can run Midje, and it tells us that our fact is not confirmed - which is not unexpected, as we haven’t written our function yet. Now we complete the implementation, run it again, and show that things are working.</p>
<div class='highlight'><pre><code class='clojure'><span class='p'>(</span><span class='kd'>ns </span><span class='nv'>midje-example.core</span> <span class='p'>(</span><span class='ss'>:use</span> <span class='nv'>midje.sweet</span><span class='p'>))</span>

<span class='p'>(</span><span class='nf'>unfinished</span> <span class='nv'>breakfast-menu</span> <span class='nv'>contains-meat?</span><span class='p'>)</span>

<span class='p'>(</span><span class='kd'>defn </span><span class='nv'>veggie-breakfast</span> <span class='p'>[]</span> 
  <span class='p'>(</span><span class='nb'>filter </span><span class='p'>(</span><span class='nb'>complement </span><span class='nv'>contains-meat?</span><span class='p'>)</span> <span class='p'>(</span><span class='nf'>breakfast-menu</span><span class='p'>))</span>
<span class='p'>)</span>

<span class='p'>(</span><span class='nf'>fact</span> <span class='p'>(</span><span class='nf'>veggie-breakfast</span><span class='p'>)</span> <span class='nv'>=&gt;</span> <span class='p'>[</span><span class='nv'>..cereal..</span><span class='p'>]</span> 
  <span class='p'>(</span><span class='nf'>provided</span> <span class='p'>(</span><span class='nf'>breakfast-menu</span><span class='p'>)</span> <span class='nv'>=&gt;</span> <span class='p'>[</span><span class='nv'>..cereal..</span> <span class='nv'>..full-english..</span><span class='p'>])</span>
  <span class='p'>(</span><span class='nf'>provided</span> <span class='p'>(</span><span class='nf'>contains-meat?</span> <span class='nv'>..full-english..</span><span class='p'>)</span> <span class='nv'>=&gt;</span> <span class='nv'>true</span><span class='p'>)</span>
  <span class='p'>(</span><span class='nf'>provided</span> <span class='p'>(</span><span class='nf'>contains-meat?</span> <span class='nv'>..cereal..</span><span class='p'>)</span> <span class='nv'>=&gt;</span> <span class='nv'>false</span><span class='p'>)</span>
<span class='p'>)</span>
</code></pre></div>
<p>At the moment, for the smoothest experience, you need to use the emacs integration that Brian has developed. There is a leiningen plugin, but it is quite slow to run, so running even a small test suite can take a good few seconds, which is slightly annoying. It would be nice to have some effective tooling to work with the La Clojure plugin for IntelliJ. I think that that would help with Midje adoption.</p>

<p>We spent a good deal of time discussing static versus dynamic dependencies in Clojure programs, how to create seams to inject dependencies on underlying components, and whether doing so was required or idiomatic in Clojure. I don’t think we reached any firm conclusions, but it was interesting to explore possibilities and constraints.</p>

<p><img src="/images/marick/smiles.jpg" alt="Group" /></p>]]>
      </content>
    </entry>
  
    <entry>
      <title type="html"><![CDATA[On Learning JavaScript]]></title>
      <link rel="alternate" type="text/html" href="http://chatley.com/posts/07-18-2011/on-learning-javascript" />
      <id>http://chatley.com/posts/07-18-2011/on-learning-javascript</id>
      <updated>2011-07-18T00:00:00+01:00</updated>
      <author>
        
          <name><![CDATA[Robert Chatley]]></name>
        
      </author>
      <content type="html">
        <![CDATA[<p>In the last week, I have been learning JavaScript. Like many people, I had previously written little bits and pieces of JavaScript on web projects to try and make various bits of HTML pages dynamic, but I’d never looked at it in depth as a proper programming language. I’ve now come to quite like it.</p>

<p>I think that one of the things that affects people’s judgement of JavaScript is the environment of the browser and the interaction with the DOM. With all of the browser inconsistencies, and the clunkiness of the DOM API, the experience of writing JavaScript can be a bad one. I know I certainly never enjoyed it before. It never really felt like a proper language, but now I think I just wasn’t doing it right. Somewhere this week I read that JavaScript is the only language that people feel that they don’t need to learn before they use it. Development often follows a <a href="http://www.mcs.vuw.ac.nz/comp/Publications/CS-TR-02-9.abs.html">post-modern</a> approach of Googling for snippets and pasting them into HTML pages.</p>

<p>I wanted to give JavaScript a chance as a proper language, so I wanted to try it away from the browser. Thankfully, the current popularity of <a href="http://nodejs.org/">node.js</a> means that there is an easy way to try out programs using a command-line interpreter. Not everything you write in node needs to be a web server. It is a full JavaScript interpreter built on V8, so it can run any valid script. The other tool that I wanted was something to do unit testing. I find that test-driven development is a very helpful approach in learning a new language, as for every example I try it can give me fast feedback on whether or not my code works as I expect. I looked around for a unit testing tool for node, getting some good advice from <a href="http://twitter.com/david_harvey">David Harvey</a> and <a href="http://twitter.com/raoulmillais">Raoul Millais</a>. In the end I settled on <a href="https://github.com/futuresimple/jessie">jessie</a>, which is an enhanced runner for <a href="http://pivotal.github.com/jasmine/">jasmine</a>, and allows you to write <a href="http://relishapp.com/rspec">rspec</a>-like specs, and to run them easily from the command line.</p>

<p>The other thing I needed was a source of knowledge. I read two books which I found helpful. The first was Douglas Crockford’s <a href="http://oreilly.com/catalog/9780596517748">JavaScript: The Good Parts</a>. This is a good introduction, laying out the fundamentals of the language. It is reasonably short and easy to understand. It does not cover the who language - as the title says, only the subset that Crockford considers the good parts. It is a little concerning that the book has appendices called Bad Parts and Awful Parts. The style of this book is terse, at some places to the point of bluntness, but it is quite easy to read. To accompany this, I found it useful to watch the Google I/O <a href="http://www.youtube.com/watch?v=seX7jYI96GE">presentation by Alex Russell</a>. This covers few basics, but gives an idea of how to think about the language. The second book I read was Stoyan Stefanov’s <a href="http://oreilly.com/catalog/9780596806767">JavaScript Patterns</a>. This book is much more advanced. It does have an introduction to the language but it moves pretty fast. Don’t read this book as your first JavaScript book. It is good though, and has lots of useful information about object-creation, inheritance mechanisms and design patterns.</p>

<p>The main characteristics of the language as far as I can see, some of which were slightly surprising to me, are: JavaScript is a functional language and functions are first class citizens; Functions are the only way to define scope; There are no classes; Almost everything is an object; Almost everything is mutable. These characteristics make it very different from its (almost) namesake Java, which is another source of confusion. There seem to be many ways to try to make JavaScript work more like Java, by implementing things that are a bit like classes and classical inheritance, but I now see that doing this is not really in the idiom of the language.</p>

<p>I thought I would just run through one of the examples that I’ve put together this week, which helped me to understand things better. It’s writing a program to generate the Fibonacci sequence, something that I’m sure most programmers have done at least a few times in their lives in programming exercises. To start with I wrote a test:</p>
<div class='highlight'><pre><code class='javascript'><span class='nx'>require</span><span class='p'>(</span><span class='s1'>&#39;./fibonacci&#39;</span><span class='p'>)</span>

<span class='nx'>describe</span><span class='p'>(</span><span class='s2'>&quot;Fibonacci Sequence&quot;</span><span class='p'>,</span> <span class='kd'>function</span><span class='p'>()</span> <span class='p'>{</span>
	
  <span class='kd'>var</span> <span class='nx'>fib</span> <span class='o'>=</span> <span class='k'>new</span> <span class='nx'>FibonacciSequence</span><span class='p'>();</span>

  <span class='nx'>it</span><span class='p'>(</span><span class='s2'>&quot;defines the first two terms to be 1&quot;</span><span class='p'>,</span> <span class='kd'>function</span><span class='p'>()</span> <span class='p'>{</span>
    <span class='nx'>expect</span><span class='p'>(</span><span class='nx'>fib</span><span class='p'>.</span><span class='nx'>term</span><span class='p'>(</span><span class='mi'>0</span><span class='p'>)).</span><span class='nx'>toEqual</span><span class='p'>(</span><span class='mi'>1</span><span class='p'>);</span>
    <span class='nx'>expect</span><span class='p'>(</span><span class='nx'>fib</span><span class='p'>.</span><span class='nx'>term</span><span class='p'>(</span><span class='mi'>1</span><span class='p'>)).</span><span class='nx'>toEqual</span><span class='p'>(</span><span class='mi'>1</span><span class='p'>);</span>
  <span class='p'>});</span>
		
  <span class='nx'>it</span><span class='p'>(</span><span class='s2'>&quot;has each term equal to the sum of the previous two&quot;</span><span class='p'>,</span> <span class='kd'>function</span><span class='p'>()</span> <span class='p'>{</span>
    <span class='nx'>expect</span><span class='p'>(</span><span class='nx'>fib</span><span class='p'>.</span><span class='nx'>term</span><span class='p'>(</span><span class='mi'>2</span><span class='p'>)).</span><span class='nx'>toEqual</span><span class='p'>(</span><span class='mi'>2</span><span class='p'>);</span>
    <span class='nx'>expect</span><span class='p'>(</span><span class='nx'>fib</span><span class='p'>.</span><span class='nx'>term</span><span class='p'>(</span><span class='mi'>3</span><span class='p'>)).</span><span class='nx'>toEqual</span><span class='p'>(</span><span class='mi'>3</span><span class='p'>);</span>
    <span class='nx'>expect</span><span class='p'>(</span><span class='nx'>fib</span><span class='p'>.</span><span class='nx'>term</span><span class='p'>(</span><span class='mi'>5</span><span class='p'>)).</span><span class='nx'>toEqual</span><span class='p'>(</span><span class='mi'>8</span><span class='p'>);</span>
  <span class='p'>});</span>

<span class='p'>});</span>
</code></pre></div>
<p>This uses a test syntax pretty similar to the rspec syntax that may well be familiar to Ruby programmers. Although it looks like we’re using <code>new</code> to create an object of the class FibonacciSequence, there are no classes in JavaScript. We’re calling a constructor function, that returns a new object, but there are no classes. Here’s the implementation.</p>
<div class='highlight'><pre><code class='javascript'><span class='nx'>FibonacciSequence</span> <span class='o'>=</span> <span class='kd'>function</span> <span class='nx'>FibonacciSequence</span><span class='p'>()</span> <span class='p'>{</span>
  <span class='k'>this</span><span class='p'>.</span><span class='nx'>term</span> <span class='o'>=</span> <span class='kd'>function</span> <span class='p'>(</span><span class='nx'>i</span><span class='p'>)</span> <span class='p'>{</span>
    <span class='k'>if</span> <span class='p'>(</span><span class='nx'>i</span> <span class='o'>===</span> <span class='mi'>0</span><span class='p'>)</span> <span class='p'>{</span> <span class='k'>return</span> <span class='mi'>1</span><span class='p'>;</span> <span class='p'>}</span>
    <span class='k'>if</span> <span class='p'>(</span><span class='nx'>i</span> <span class='o'>===</span> <span class='mi'>1</span><span class='p'>)</span> <span class='p'>{</span> <span class='k'>return</span> <span class='mi'>1</span><span class='p'>;</span> <span class='p'>}</span>
    <span class='k'>return</span> <span class='k'>this</span><span class='p'>.</span><span class='nx'>term</span><span class='p'>(</span><span class='nx'>i</span> <span class='o'>-</span> <span class='mi'>1</span><span class='p'>)</span> <span class='o'>+</span> <span class='k'>this</span><span class='p'>.</span><span class='nx'>term</span><span class='p'>(</span><span class='nx'>i</span> <span class='o'>-</span> <span class='mi'>2</span><span class='p'>);</span>
  <span class='p'>};</span>
<span class='p'>};</span>
</code></pre></div>
<p>We should also specify what happens in the case of a negative argument. Let’s say we expect an exception to be thrown. We can add a test for that:</p>
<div class='highlight'><pre><code class='javascript'>  <span class='p'>...</span>
  <span class='nx'>it</span><span class='p'>(</span><span class='s2'>&quot;is not defined for negative terms&quot;</span><span class='p'>,</span> <span class='kd'>function</span><span class='p'>()</span> <span class='p'>{</span>
    <span class='nx'>expect</span><span class='p'>(</span><span class='kd'>function</span><span class='p'>()</span> <span class='p'>{</span> <span class='nx'>fib</span><span class='p'>.</span><span class='nx'>term</span><span class='p'>(</span><span class='o'>-</span><span class='mi'>1</span><span class='p'>);</span> <span class='p'>}</span> <span class='p'>).</span><span class='nx'>toThrow</span><span class='p'>(</span><span class='s2'>&quot;Argument may not be negative: -1&quot;</span><span class='p'>);</span>
  <span class='p'>});</span>
  <span class='p'>...</span>
</code></pre></div>
<p>Note how the expectation has to be set up slightly differently, as we don’t want to call the piece of code that we’re expecting to throw an exception while we’re in the middle of setting up the expectation. We wrap the code we want to test in an anonymous function, and pass that to jessie for it to call later, when the time is right. In the implementation, we throw an error in a fairly standard way. The only thing to note is that as JavaScript isn’t strongly typed, we don’t have to throw something that is a sub-type of a particular exception class. There are no classes. So we can throw whatever we want. Here I just threw a string, although you could easily construct your own exception object if you preferred. Updating the implementation gives us:</p>
<div class='highlight'><pre><code class='javascript'><span class='nx'>FibonacciSequence</span> <span class='o'>=</span> <span class='kd'>function</span> <span class='nx'>FibonacciSequence</span><span class='p'>()</span> <span class='p'>{</span>
  <span class='k'>this</span><span class='p'>.</span><span class='nx'>term</span> <span class='o'>=</span> <span class='kd'>function</span> <span class='p'>(</span><span class='nx'>i</span><span class='p'>)</span> <span class='p'>{</span>
    <span class='k'>if</span> <span class='p'>(</span><span class='nx'>i</span> <span class='o'>&lt;</span> <span class='mi'>0</span><span class='p'>)</span> <span class='p'>{</span> <span class='k'>throw</span> <span class='s2'>&quot;Argument may not be negative: &quot;</span> <span class='o'>+</span> <span class='nx'>i</span><span class='p'>.</span><span class='nx'>toString</span><span class='p'>();</span> <span class='p'>}</span>
    <span class='k'>if</span> <span class='p'>(</span><span class='nx'>i</span> <span class='o'>===</span> <span class='mi'>0</span><span class='p'>)</span> <span class='p'>{</span> <span class='k'>return</span> <span class='mi'>1</span><span class='p'>;</span> <span class='p'>}</span>
    <span class='k'>if</span> <span class='p'>(</span><span class='nx'>i</span> <span class='o'>===</span> <span class='mi'>1</span><span class='p'>)</span> <span class='p'>{</span> <span class='k'>return</span> <span class='mi'>1</span><span class='p'>;</span> <span class='p'>}</span>
    <span class='k'>return</span> <span class='k'>this</span><span class='p'>.</span><span class='nx'>term</span><span class='p'>(</span><span class='nx'>i</span> <span class='o'>-</span> <span class='mi'>1</span><span class='p'>)</span> <span class='o'>+</span> <span class='k'>this</span><span class='p'>.</span><span class='nx'>term</span><span class='p'>(</span><span class='nx'>i</span> <span class='o'>-</span> <span class='mi'>2</span><span class='p'>);</span>
  <span class='p'>};</span>
<span class='p'>};</span>
</code></pre></div>
<h3 id="update">Update:</h3>

<blockquote>
<p>After posting this, <a href="http://twitter.com/raoulmillais">Raoul</a> commented that it would have been more idiomatic to return <code>undefined</code> rather than throwing the error in the above example. It would also seem to fit rather better with the problem domain, given the way I named my test. Changing this gives the below:</p>
</blockquote>
<div class='highlight'><pre><code class='javascript'><span class='p'>...</span>
 <span class='nx'>it</span><span class='p'>(</span><span class='s2'>&quot;is not defined for negative terms&quot;</span><span class='p'>,</span> <span class='kd'>function</span><span class='p'>()</span> <span class='p'>{</span>
   <span class='nx'>expect</span><span class='p'>(</span><span class='nx'>fib</span><span class='p'>.</span><span class='nx'>term</span><span class='p'>(</span><span class='o'>-</span><span class='mi'>1</span><span class='p'>)).</span><span class='nx'>toBeUndefined</span><span class='p'>();</span>
 <span class='p'>});</span>
<span class='p'>...</span>
<span class='nx'>FibonacciSequence</span> <span class='o'>=</span> <span class='kd'>function</span> <span class='nx'>FibonacciSequence</span><span class='p'>()</span> <span class='p'>{</span>
  <span class='k'>this</span><span class='p'>.</span><span class='nx'>term</span> <span class='o'>=</span> <span class='kd'>function</span> <span class='p'>(</span><span class='nx'>i</span><span class='p'>)</span> <span class='p'>{</span>
    <span class='k'>if</span> <span class='p'>(</span><span class='nx'>i</span> <span class='o'>&lt;</span> <span class='mi'>0</span><span class='p'>)</span> <span class='p'>{</span> <span class='k'>return</span> <span class='kc'>undefined</span><span class='p'>;</span> <span class='p'>}</span>
<span class='p'>...</span>
</code></pre></div>
<p>The other feature that I wanted to implement was the ability to iterate through the sequence, rather than just calculating specific terms. As the sequence is mathematically infinite, an internal iterator wasn’t going to be much use here, as although it would be very easy, and idiomatic, to pass in a closure to apply to each element of the sequence, this might never terminate. At least for this example, we want an external iterator.</p>
<div class='highlight'><pre><code class='javascript'>  <span class='nx'>it</span><span class='p'>(</span><span class='s2'>&quot;can be iterated through&quot;</span><span class='p'>,</span> <span class='kd'>function</span><span class='p'>()</span> <span class='p'>{</span>
    <span class='kd'>var</span> <span class='nx'>seq</span> <span class='o'>=</span> <span class='nx'>fib</span><span class='p'>.</span><span class='nx'>iterator</span><span class='p'>();</span>
    <span class='nx'>expect</span><span class='p'>(</span><span class='nx'>seq</span><span class='p'>.</span><span class='nx'>next</span><span class='p'>()).</span><span class='nx'>toEqual</span><span class='p'>(</span><span class='mi'>1</span><span class='p'>);</span>
    <span class='nx'>expect</span><span class='p'>(</span><span class='nx'>seq</span><span class='p'>.</span><span class='nx'>next</span><span class='p'>()).</span><span class='nx'>toEqual</span><span class='p'>(</span><span class='mi'>1</span><span class='p'>);</span>
    <span class='nx'>expect</span><span class='p'>(</span><span class='nx'>seq</span><span class='p'>.</span><span class='nx'>next</span><span class='p'>()).</span><span class='nx'>toEqual</span><span class='p'>(</span><span class='mi'>2</span><span class='p'>);</span>
    <span class='nx'>expect</span><span class='p'>(</span><span class='nx'>seq</span><span class='p'>.</span><span class='nx'>next</span><span class='p'>()).</span><span class='nx'>toEqual</span><span class='p'>(</span><span class='mi'>3</span><span class='p'>);</span>
    <span class='nx'>expect</span><span class='p'>(</span><span class='nx'>seq</span><span class='p'>.</span><span class='nx'>next</span><span class='p'>()).</span><span class='nx'>toEqual</span><span class='p'>(</span><span class='mi'>5</span><span class='p'>);</span>
  <span class='p'>});</span>

  <span class='nx'>it</span><span class='p'>(</span><span class='s2'>&quot;can have multiple independent iterators&quot;</span><span class='p'>,</span> <span class='kd'>function</span><span class='p'>()</span> <span class='p'>{</span>
    <span class='kd'>var</span> <span class='nx'>seq</span> <span class='o'>=</span> <span class='nx'>fib</span><span class='p'>.</span><span class='nx'>iterator</span><span class='p'>();</span>
    <span class='nx'>expect</span><span class='p'>(</span><span class='nx'>seq</span><span class='p'>.</span><span class='nx'>next</span><span class='p'>()).</span><span class='nx'>toEqual</span><span class='p'>(</span><span class='mi'>1</span><span class='p'>);</span>
    <span class='nx'>expect</span><span class='p'>(</span><span class='nx'>seq</span><span class='p'>.</span><span class='nx'>next</span><span class='p'>()).</span><span class='nx'>toEqual</span><span class='p'>(</span><span class='mi'>1</span><span class='p'>);</span>
    <span class='nx'>expect</span><span class='p'>(</span><span class='nx'>seq</span><span class='p'>.</span><span class='nx'>next</span><span class='p'>()).</span><span class='nx'>toEqual</span><span class='p'>(</span><span class='mi'>2</span><span class='p'>);</span>
  
    <span class='kd'>var</span> <span class='nx'>seq2</span> <span class='o'>=</span> <span class='nx'>fib</span><span class='p'>.</span><span class='nx'>iterator</span><span class='p'>();</span>
    <span class='nx'>expect</span><span class='p'>(</span><span class='nx'>seq2</span><span class='p'>.</span><span class='nx'>next</span><span class='p'>()).</span><span class='nx'>toEqual</span><span class='p'>(</span><span class='mi'>1</span><span class='p'>);</span>

    <span class='nx'>expect</span><span class='p'>(</span><span class='nx'>seq</span><span class='p'>.</span><span class='nx'>next</span><span class='p'>()).</span><span class='nx'>toEqual</span><span class='p'>(</span><span class='mi'>3</span><span class='p'>);</span>
    <span class='nx'>expect</span><span class='p'>(</span><span class='nx'>seq</span><span class='p'>.</span><span class='nx'>next</span><span class='p'>()).</span><span class='nx'>toEqual</span><span class='p'>(</span><span class='mi'>5</span><span class='p'>);</span>
  <span class='p'>});</span>
</code></pre></div>
<p>Implementing this turns out to be quite straightforward. One of the key messages from Alex Russell’s talk mentioned above was that when we program in JavaScript we need to reverse our thinking, from objects where we store data and then attach behaviour, to functions which - through the mechanism of closure - have data storage attached. Here my iterator function is defined as a property of the sequence object, so I can access it from the sequence, and when I call it, it returns a new object which is the iterator, with a <code>next()</code> method. The iterator’s index is just a local variable inside the <code>iterator()</code> function, whose state is maintained as part of the closure. We don’t need to store it in a field. The only thing that looks slightly strange, and took me a while to get my head around, was the need to make the assignment <code>that = this</code>. We need this in order to store a reference to the sequence object inside the closure, otherwise we won’t later have access to the <code>term()</code> method. This is due to the “special” way in which the keyword <code>this</code> works. <a href="http://www.jslint.com/">JsLint</a> wasn’t very happy about me using the <code>++</code> operator to increment <code>i</code>, but I thought it could keep its opinion to itself on that one.</p>
<div class='highlight'><pre><code class='javascript'><span class='nx'>FibonacciSequence</span> <span class='o'>=</span> <span class='kd'>function</span> <span class='nx'>FibonacciSequence</span><span class='p'>()</span> <span class='p'>{</span>
  <span class='k'>this</span><span class='p'>.</span><span class='nx'>term</span> <span class='o'>=</span> <span class='kd'>function</span> <span class='p'>(</span><span class='nx'>i</span><span class='p'>)</span> <span class='p'>{</span>
    <span class='k'>if</span> <span class='p'>(</span><span class='nx'>i</span> <span class='o'>&lt;</span> <span class='mi'>0</span><span class='p'>)</span> <span class='p'>{</span> <span class='k'>throw</span> <span class='s2'>&quot;Argument may not be negative: &quot;</span> <span class='o'>+</span> <span class='nx'>i</span><span class='p'>.</span><span class='nx'>toString</span><span class='p'>();</span> <span class='p'>}</span>
    <span class='k'>if</span> <span class='p'>(</span><span class='nx'>i</span> <span class='o'>===</span> <span class='mi'>0</span><span class='p'>)</span> <span class='p'>{</span> <span class='k'>return</span> <span class='mi'>1</span><span class='p'>;</span> <span class='p'>}</span>
    <span class='k'>if</span> <span class='p'>(</span><span class='nx'>i</span> <span class='o'>===</span> <span class='mi'>1</span><span class='p'>)</span> <span class='p'>{</span> <span class='k'>return</span> <span class='mi'>1</span><span class='p'>;</span> <span class='p'>}</span>
    <span class='k'>return</span> <span class='k'>this</span><span class='p'>.</span><span class='nx'>term</span><span class='p'>(</span><span class='nx'>i</span> <span class='o'>-</span> <span class='mi'>1</span><span class='p'>)</span> <span class='o'>+</span> <span class='k'>this</span><span class='p'>.</span><span class='nx'>term</span><span class='p'>(</span><span class='nx'>i</span> <span class='o'>-</span> <span class='mi'>2</span><span class='p'>);</span>
  <span class='p'>};</span>
  <span class='k'>this</span><span class='p'>.</span><span class='nx'>iterator</span> <span class='o'>=</span> <span class='kd'>function</span> <span class='p'>()</span> <span class='p'>{</span>
    <span class='kd'>var</span> <span class='nx'>i</span> <span class='o'>=</span> <span class='mi'>0</span><span class='p'>,</span> <span class='nx'>that</span> <span class='o'>=</span> <span class='k'>this</span><span class='p'>;</span>
    <span class='k'>return</span> <span class='p'>{</span>
      <span class='nx'>next</span><span class='o'>:</span> <span class='kd'>function</span> <span class='p'>()</span> <span class='p'>{</span>
        <span class='k'>return</span> <span class='nx'>that</span><span class='p'>.</span><span class='nx'>term</span><span class='p'>(</span><span class='nx'>i</span><span class='o'>++</span><span class='p'>);</span>
      <span class='p'>}</span>
    <span class='p'>};</span>
  <span class='p'>};</span>
<span class='p'>};</span>
</code></pre></div>
<p>So that is the end result, and I think it looks quite neat. It is pretty functional in style. It doesn’t define any types or classes, only functions, and the test looks pretty much like an rspec test. Overall I’m quite pleased with the way I was able to write programs in JavaScript once I understood how it worked, and what was idiomatic. I feel I should pursue this some more, especially with the growing interest in Node in the industry.</p>]]>
      </content>
    </entry>
  
    <entry>
      <title type="html"><![CDATA[Agile Engineering Practices in Oxford]]></title>
      <link rel="alternate" type="text/html" href="http://chatley.com/posts/07-04-2011/oxford-agile-engineering-practices" />
      <id>http://chatley.com/posts/07-04-2011/oxford-agile-engineering-practices</id>
      <updated>2011-07-04T00:00:00+01:00</updated>
      <author>
        
          <name><![CDATA[Robert Chatley]]></name>
        
      </author>
      <content type="html">
        <![CDATA[<p>Last week I taught the first iteration of the <a href="http://www.softeng.ox.ac.uk/subjects/APE.html">Agile Engineering Practices</a> course, as part of Oxford University’s <a href="http://www.softeng.ox.ac.uk/">Software Engineering MSc</a>. For a while this MSc programme has included a module on <a href="http://www.softeng.ox.ac.uk/subjects/AGM.html">Agile Methods</a> taught by <a href="http://www.martinitconsulting.com/agile/home.html">Angela Martin</a> which has proved very popular with the students. That course compares the various different named agile methods, and focusses mostly on issues of process and human communication.</p>

<p>My new course aims to compliment this with an in-depth look at the engineering practices that support the application of such a method to software development, and allow a product to be developed iteratively and incrementally, continuously delivering valuable features. The students on the course are studying part-time, taking time out from jobs in industry, so they brought their own experiences from their working lives. This led to interesting discussion and debate on a number of topics.</p>

<p>I wanted the course to be very practical, so we spent more than half of the week in the computer lab working on hands-on exercises. With a relatively small class and the intensive format of the course (each module is taught as a solid week of classes) we were able to have one exercise follow on from another, and try to pull all of the tools and techniques together. We started with some work on version control strategies, and then followed this up with creating an automated build and setting up a continuous integration server. Over the next couple of days we looked at refactoring techniques, introducing seams to legacy code to try and get it under test, and various testing techniques at the unit and system level. To conclude the arc we spent some time looking at release and deployment techniques. I encouraged the students to pair program, learn from each other and help each other out.</p>

<p><img src="/images/apeoxford/elena-ola.jpg" alt="Elena and Ola pairing" title="Elena and Ola pairing" /><img src="/images/apeoxford/shah-david.jpg" alt="Elena and Ola pairing" title="Shah and David pairing" /></p>

<p>We covered a lot of different technical topics, and I found it hard to recommend one book for the students to use as their course textbook. We looked at subjects detailed in Joshua Kerievsky’s <a href="http://www.industriallogic.com/xp/refactoring/">Refactoring to Patterns</a>, Freeman and Pryce’s <a href="http://www.growing-object-oriented-software.com/">GOOS</a>, Michael Feathers’ <a href="http://www.amazon.co.uk/Working-Effectively-Legacy-Robert-Martin/dp/0131177052">Legacy Code book</a> and Gojko Adzic’s <a href="http://specificationbyexample.com/">Specification by Example</a>. In the end I gave the class references to all of these books, but recommended Jez Humble and Dave Farley’s <a href="http://continuousdelivery.com">Continuous Delivery</a> as the book that motivated all the themes and gave the big picture of what we were trying to do - minimise the cycle time from idea to delivery, and allow that cycle to be repeated frequently and reliably.</p>

<p>We had a good week, and (I think) the students enjoyed the class. There is definitely room for improvement though. Our end of course retrospective produced some ideas for things to add and change. The next iteration of this course in Oxford is in January, so we’ve got some time to tune the materials. I’m looking forward to it. I should also thank my teaching assistant <a href="http://www.cs.ox.ac.uk/people/jim.whitehead/">Jim Whitehead</a>, who was a great help throughout the week.</p>

<p><img src="/images/apeoxford/class.jpg" alt="The class" title="The class" /></p>]]>
      </content>
    </entry>
  
    <entry>
      <title type="html"><![CDATA[SPA2011 - The Great Egg Race]]></title>
      <link rel="alternate" type="text/html" href="http://chatley.com/posts/06-20-2011/spa-great-egg-race" />
      <id>http://chatley.com/posts/06-20-2011/spa-great-egg-race</id>
      <updated>2011-06-20T00:00:00+01:00</updated>
      <author>
        
          <name><![CDATA[Robert Chatley]]></name>
        
      </author>
      <content type="html">
        <![CDATA[<p>At the <a href="http://www.spaconference.org">SPA2011</a> conference, we set the attendees a challenge. We invited people to build something during the conference. We suggest they form teams, and use the challenge to show off their development skills, perhaps using a new technique learned at the conference, or showing everyone the benefits of the One True Way (whichever way they happen to think that is). We set aside time in the programme for people to work on their projects, but I think the majority of the work was done in the hallway, the coffee breaks, the bar, and possibly even in other people’s sessions… We gave the challenge the name The Great Egg Race after the 1980s <a href="http://www.bbc.co.uk/archive/great_egg_race/">BBC television series</a> hosted by Prof Heinz Wolff.</p>

<p><a href="http://twitter.com/marcevers">Marc Evers</a> and I facilitated, but we based the challenge on an idea from <a href="http://twitter.com/mfeathers">Michael Feathers</a> that he presented in his <a href="http://www.xp2011.org">XP2011</a> workshop <a href="http://xp2011.org/program?sid=401&o=1">Refactoring in the 4th Dimension</a>. In that workshop Michael encouraged people to use his <a href="https://github.com/michaelfeathers/repodepot-ruby">repo-depot</a> ruby library to explore some data that he had extracted from some git repositories, to try and extract patterns over time. Is it more common for people to commit at some times of the day or the week rather than others? Are there correlations between commits and changes in complexity? etc etc</p>

<p>For the SPA workshop, we wanted people to focus on visualising the data in interesting ways. There was a strong theme going through the conference of Javascript, HTML5 and other presentation technologies. We wanted to harness interest in this and have people generate interesting visuals from the repository data. We announced the challenge in the opening plenary session on Monday. Somehow people found time in between all of the rest of the conference activities to come up with some pretty impressive things. Unexpectedly, Michael Feathers dropped by the conference as he was passing through London that day and came to see what people were up to, which was a nice surprise. At the closing plenary on Wednesday, our three finalists presented their work in some lightning demos.</p>

<p>Dear presenters, if I have described your entry wrongly below, please let me know and I will correct it!</p>

<p><a href="http://twitter.com/stonsoftware">Stephan Eggermont</a> and Diego Lont used their Smalltalk skills to create some extensions to the <a href="http://www.moosetechnology.org/">Moose</a> platform to allow people to dig down into individual commits and changes. The visualisation uses a grid pattern with different colours representing code complexity.</p>

<p><img src="/images/eggrace/EggRaceStephanDiego.jpg" alt="Stephan and Diego" title="Stephan and Diego" /></p>

<p><a href="http://twitter.com/aparker42">Andrew Parker</a> produced a visualisation using animated circles to show change. The circles moved, grew and changed colour representing time and complexity, producing a moving chart in the style of Hans Rosling’s well-known presentations of data. A nice feature was how the colours faded out when the file wasn’t touched for a long time.</p>

<p><img src="/images/eggrace/EggRaceAndrew.jpg" alt="Andrew" title="Andrew" /></p>

<p><a href="http://twitter.com/lassekoskela">Lasse Koskela</a> created an HTML5 visualisation based on a clock face. Time span forward through the history of the project being analysed, and as commits happened, they were displayed on the clock as the spinning hand passed them, this allowed the viewer so see which parts of the day were most common for checking in. He was also able to adjust the speed, to skip through times in the project’s history where he knew there was no activity, which was a nice touch.</p>

<p><img src="/images/eggrace/EggRaceLasse.jpg" alt="Lasse" title="Lasse" /></p>

<p>A quick and unscientific poll of the audience revealed that the majority of people liked Andrew’s entry the best, so he was declared the winner (and is pictured below with his prize). Thanks to everyone for taking part in the challenge, I hope you enjoyed it, and got to try out something that you might not normally get to do day-to-day. Thanks again to Michael for letting us use his tools as a starting point.</p>

<p><img src="/images/eggrace/EggRaceAndrewWinner.png" alt="Andrew Wins" title="Andrew Wins" /></p>]]>
      </content>
    </entry>
  
    <entry>
      <title type="html"><![CDATA[Work Experience for Grownups]]></title>
      <link rel="alternate" type="text/html" href="http://chatley.com/posts/06-16-2011/work-experience-for-grownups" />
      <id>http://chatley.com/posts/06-16-2011/work-experience-for-grownups</id>
      <updated>2011-06-16T00:00:00+01:00</updated>
      <author>
        
          <name><![CDATA[Robert Chatley]]></name>
        
      </author>
      <content type="html">
        <![CDATA[<p>At some point last year, I had the idea of spending some time with a team that I don’t normally work with, with the aim of gaining ideas and experience. Unfortunately I didn’t get around to putting it into practice, but last week I found I had some free time, and with the help of the good people at <a href="http://www.7digital.com">7Digital</a> I was able to do it. I call this Work Experience for Grownups.</p>

<p><a href="http://www.7digital.com">7Digital</a> is a smallish but growing company, working in the music industry, with a team of about 20 developers, plus operations, product, sales and business teams making about 50-60 staff in total. The dev team is divided into three sub-teams, focussing either on back or front-end systems, but all work mostly in .NET, and follow agile practices (although practices may vary between teams, depending on what each team feels works best for them). Strangely, 7Digital currently occupy the Shoreditch office space that I worked in about five years ago with <a href="http://www.kizoom.com">Kizoom</a> - so it was a little bit strange being back in the office, but with a different company.</p>

<p><img src="/images/7digital/Office.jpg" alt="7Digital Office" title="The 7Digital Office" /></p>

<p>As you can see in the picture, most of the developers work in pairs. This is a really good thing for an outsider wanting to come and join the team (either temporarily or permanently). A new person can get right into the heart of things and work on something useful, even if they aren’t particularly experienced in the domain, or with the particular technology being used.</p>

<p>It seems more common for companies to take on interns or people doing work experience placements who are relatively inexperienced. One of the differences about doing it as a more seasoned professional is that you are (hopefully) able to contribute something to the team. Although you likely wouldn’t feel comfortable taking on a piece of work on your own (and if you did, then I’d question how useful a learning experience you were having), you can work reasonably effectively as part of a pair, offering a fresh pair of eyes and possibly new insights on problems, as long as your pair can put up with you asking a lot of questions.</p>

<p>I spent the week with the Services team, who work on providing APIs to other teams, and to external customers. We spent a fair bit of time working on tests and features, and also trying to debug various problems with bits of infrastructure. From a technical point of view, this was an immersive approach to learning, and so I didn’t get a full understanding of all, if any, of the individual pieces, but got an idea of how things fit together. Coming out of it, I didn’t feel I’d be confident in starting a new .NET project from the ground up, but coming in to the middle of an existing one, I would at least have an appreciation of the lie of the land.</p>

<p>From a process point of view, I was on firmer ground, and after observing the way the team worked for a few days, felt able to offer a few suggestions, or at least highlight a few things that I’d noticed. Each of the delivery teams uses some form of Kanban board (although each team has designed their board with different columns etc). We talked quite a lot during the week about the flow of features across the board, release processes, what was holding up things from being released. They release approximately once a week, but there isn’t any strict iteration cycle (they had tried that before and decided to abandon it). They are trying to get to a state of continuous flow, releasing every feature when it is finished, perhaps releasing daily or even many times per day, but at the moment they seem quite far from that. We spent some time discussing where they want to be, the challenges, and how they might be able to change their process to get there. One thing that seemed very positive was that everyone seemed to be thinking about ways to evolve the way that the team works, and to improve. One comment that I made in a retrospective, about concentrating on pulling features across the board from the right (into production), rather than pushing them from the backlog on the left to fill up empty slots where the WIP limit had not been reached, was immortalised in a poster by <a href="http://twitter.com/ChrisAnnODell">Chris</a> and stuck on the wall. That’ll teach me to be careful what I say</p>

<p><img src="/images/7digital/PullFromTheRight.jpg" alt="Pull from the right" title="Pull from the right" /></p>

<p>Thanks to <a href="http://twitter.com/robbowley">Rob</a>, <a href="http://twitter.com/hibri">Hibri</a>, <a href="http://twitter.com/bendrury">Ben</a> and the team for letting me spend the week with them. It was certainly useful for me, and I hope that it was of some use to them too. Having done this once, it’s something that I’d like to do again, perhaps a couple of times per year, as an ongoing way of learning new things by seeing tools and practices in use at the coal face - quite a different experience from reading about them, or trying them out on small personal projects. I also think that doing your first week with a team, on a project, or in a company, is a skill that we can practise and get better at. Learning how to get up to speed more quickly, or what things a new person most needs to know to start being useful on your team, can only be a good thing. I wasn’t paid for the time I spent with 7Digital, but looked at the week as a pretty cheap form of training. I’d encourage people to try it, and for more teams and companies to think about welcoming people in. Please let me know if you have ideas about this.</p>

<p><img src="/images/7digital/RobPairing.png" alt="Rob pairing" /> <img src="/images/7digital/Radiator.png" alt="Information Radiator" /></p>]]>
      </content>
    </entry>
  
    <entry>
      <title type="html"><![CDATA[Extreme Startup]]></title>
      <link rel="alternate" type="text/html" href="http://chatley.com/posts/05-27-2011/extreme-startup" />
      <id>http://chatley.com/posts/05-27-2011/extreme-startup</id>
      <updated>2011-05-27T00:00:00+01:00</updated>
      <author>
        
          <name><![CDATA[Robert Chatley]]></name>
        
      </author>
      <content type="html">
        <![CDATA[<p>At <a href="http://xp2011.org/">XP2011</a> in Madrid, <a href="http://mattwynne.net/">Matt Wynne</a> and I ran a workshop called Extreme Startup. This is a workshop that we devised to simulate the environment of a startup, where there is high uncertainty as to what the market wants, and teams must iterate rapidly to develop a product. The accepted agile engineering practices are supposed to support working in an iterative fashion, with changes of direction and strategy, without compromising quality. We wanted to see what happened when we increased the frequency of iteration, under the pressure of competition. Would the practices help? Or would some (or all) of them fall by the wayside?</p>

<p>We asked the participants to form teams, to compete against each other. Most formed pairs. The task we set them was to build a small webserver that could respond to requests that we would send them. We didn’t tell them in advance what the requests would be, the only way for them to discover this was to build something, launch it into the marketplace, and see what they received. For each request, the response was scored, and running totals kept for each teams score. We displayed a leaderboard on screen throughout the session.</p>

<p>We played the main part of the game for about an hour, and the atmosphere was tense. Pairs huddled over laptops, tailing logs, programming solutions, checking their scores. The competition was tight, and the top of the leaderboard changed often throughout the session. We spent some time peering over their shoulders to try and determine their various strategies.</p>

<p><img src="/images/extremestartup/Teams.jpg" alt="Team Playing" /></p>

<p>After an hour or so, we called the end of the competition. As a group, we reflected on the exercise, and the decisions that people had made. There were varying strategies, but a common thread was that under the pressure of the competition and varying requests, people had coded quickly, and perhaps messily, and had not written many tests. They weren’t particularly proud of what they had written, but it had worked. Presumably it was “good enough” for the task in hand.</p>

<p>We want to run this session again, and we want to take more notice of how the scores vary throughout the session. Perhaps we can plot a graph and maybe tie specific events or phases back to particular aspects of the graph. We also wonder what would happen if we ran the exercise over a longer timescale, perhaps a whole day. It wouldn’t be possible for people to maintain the same intensity and concentration over a whole day, so we wonder how their strategy would change. I also wonder what would happen if the teams were larger.</p>

<p>This is definitely a fun exercise. We hope to run it again in future, and some of the particpants from XP2011 have gone on to run the session with their own user groups.</p>

<p><img src="/images/extremestartup/J+J.jpg" alt="Pair Concentrating" /></p>]]>
      </content>
    </entry>
  
</feed>