You are currently browsing the archives for the Kata category

August – The Guilded Rose Kata

Date: Thursday 28th August 2014
Time: 19:00
Venue: Staffordshire University – Stafford Campus (Octagon building, K102)

The Guilded Rose Kata fictionalizes the experience of working with someone else’s code. You’ll probably groan when you first see the code provided to you. The amount of code isn’t overwhelming, its the prefect balance to evoke the feeling, “I can’t wait to re-write this cruft.” It’s suggested that you use Test Driven Development with this kata. Once done, read the **spoiler** section at to see if you had a similar experience or not.

The above link also provides versions of the kata in C#, Ruby and Java. Google provides other implementation in other languages.

So, sign up at, bring yourselves, your colleagues and your favorite IDE along and we’ll have some pain fun.

June 2014 – Is TDD Dead?

Is TDD Dead?

Here lies TDD…

Date: Thursday 26th June 2014
Time: 19:00
Venue: Staffordshire University – Stafford Campus (Octagon building, K102)

Fear not, TDD is not dead, although it’s certainly been talked to death this month. This catchy title has been doing the rounds on the web recently since the Kent Beck + Martin Fowler + David Heinemeier Hansson talks. This month we are going to take a look at it ourselves, try out some different approaches and share our experiences.

For me it all started about 2 months ago when I watched Ian Cooper’s talk on TDD, Where did it all go wrong. I’ve been told over and over, that unit testing gives you the freedom to change code with the safety of maintaining functionality for the customer. So refactoring is the process of changing code without changing functionality, and those like Kent Beck would advocate your test suites allow you to safety refactor to design patterns as they emerge in the system. Yet this video struck a chord, I struggle to refactor code without breaking tests, and so lose confidence that the functionality is unchanged as the tests are now different.  Ian’s video addresses these points by highlighting different approaches and definitions to unit testing, and asks is the way some of use do TDD slowing us down.

We are going to explore this issue by scratching an itch many of you had during last months lean coding challenge, Refactoring! After a quick summary of Ian’s video, we are going to pair up and refactor a completed C# implementation of last months Checkout Code Challenge. It will be covered by two test suites. One set focusing on implementation per method and another suite on behaviour of the system. After an hour of coding we will break for a retrospective to find out how everyone’s refactoring was influenced by the different test suites, the advantages each way of testing has to offer and insights into TDD for agile development.

As we’re going to be writing code in C#, bring your laptop with visual studio set up – Project Code on GitHub

If you’re interested, please sign up on

See you there!

Jon Willis

Anagram Kata (Strikes Back)

Date: Thursday 27th March 2014
Time: 19:00
Venue: Staffordshire University – Stafford Campus (Octagon building, K102)

March is all about code kata. We shall be visiting a kata that has been run before – Anagram! If you do not know what code kata is, start with Dave’s Blog and then read his anagram kata post.

We like change, so consider throwing some into this exercise (particularly those who have done it before). Some suggestions:

  • Profile the application, perhaps in both time (execution speed) and space (memory usage).
  • Consider intermediate list processing and storage (structure the word list).
  • Try TDD in a pair.
  • Complete Dave’s suggestions – For added programming pleasure, find the longest words that are anagrams, and find the set of anagrams containing the most words (so “parsley players replays sparely” would not win, having only four words in the set).

The word list we used last time is still available on my blog. Bring your own laptops and whatever programming tools you wish. Wireless Internet access and a desktop computer with which to cut code will be available should you require it.

I look forward to seeing you this March!

January 2014 – Kata with Constraints

Calculator Kata

Calculator Kata

Date: Thursday 23rd January 2014
Time: 7:00pm
Venue: Staffordshire University – Stafford Campus (Octagon building, K102)

With the new year now behind us, to kick start 2014 Agile Staffordshire will be going back to basics with a twist. A key technique in agile development is Test Driven Development (TDD), a difficult skill to master yet often practiced through simple Kata exercises. For the uninitiated, Katas are a reference to martial arts where students repeatably practice a set of moves in order to better learn and understand. Programming Katas are similar short 10-30 minute challenges where the goal is the same but each attempt can lead you to experience a different journey.

This month we will be pairing together to do the String Calculator by Roy Osherove but with a constraint of your choosing. Kata rules are below, as are a selection of constraints but feel free to choose your own. There is no set language, but you will need one with a testing framework for TDD.

String Calculator

The following is a TDD Kata- an exercise in coding, refactoring and test-first, that you should apply daily for at least 15 minutes (I do 30).

Before you start:

  • Try not to read ahead.
  • Do one task at a time. The trick is to learn to work incrementally.
  • Make sure you only test for correct inputs. there is no need to test for invalid inputs for this kata

String Calculator

  1. Create a simple String calculator with a method int Add(string numbers)
    1. The method can take 0, 1 or 2 numbers, and will return their sum (for an empty string it will return 0) for example “” or “1” or “1,2”
    2. Start with the simplest test case of an empty string and move to 1 and two numbers
    3. Remember to solve things as simply as possible so that you force yourself to write tests you did not think about
    4. Remember to refactor after each passing test
  2. Allow the Add method to handle an unknown amount of numbers
  3. Allow the Add method to handle new lines between numbers (instead of commas).
    1. the following input is ok:  “1\n2,3”  (will equal 6)
    2. the following input is NOT ok:  “1,\n” (not need to prove it – just clarifying)
  4. Support different delimiters
    1. to change a delimiter, the beginning of the string will contain a separate line that looks like this:   “//[delimiter]\n[numbers…]” for example “//;\n1;2” should return three where the default delimiter is ‘;’ .
    2. the first line is optional. all existing scenarios should still be supported
  5. Calling Add with a negative number will throw an exception “negatives not allowed” – and the negative that was passed.if there are multiple negatives, show all of them in the exception message

    stop here if you are a beginner. Continue if you can finish the steps so far in less than 30 minutes.

  6. Numbers bigger than 1000 should be ignored, so adding 2 + 1001  = 2
  7. Delimiters can be of any length with the following format:  “//[delimiter]\n” for example: “//[***]\n1***2***3” should return 6
  8. Allow multiple delimiters like this:  “//[delim1][delim2]\n” for example “//[*][%]\n1*2%3” should return 6.
  9. make sure you can also handle multiple delimiters with length longer than one char

Kata Constraints

Select ONE constraint from below.

  • No If, Else, Switch Statements
  • No mouse
  • No Classes
  • Use a functional language
  • No Mutable State
  • No Getters/Setters
  • No IDE
  • 2 Refactorings after each passing test
  • Single word method names
  • Or make one up yourself…

Many of the constraints above which affect the design of code, work towards improving object calisthenics. More on this can be found here.

The goal of the session is not to complete the Kata (you may even restart several times) but to learn through the experience of your selected constraint.

This will also be a special month, as it will be the last regular attendance of one of Agile Staffordshire’s founding members. Neil Kidd will be moving on to a new position at 7Digital, so all please wish him the best.

Hope to see you there.


November 2013 – Brooklyn Beta and Testing with C

Date: Thursday 28th November 2013
Time: 7:00pm
Venue: Staffordshire University – Stafford Campus (K102 – the Octagon building)

Brooklyn Beta is a friendly web conference aimed at the “work hard and be nice to people” crowd. Trevor Adams, a long time member of Agile Staffordshire, attended the event and will be presenting a short talk on what happened and what it might mean. The fourth Brooklyn Beta happened during 9-11th October 2013 in Brooklyn, New York.

Later in the session we shall be refactoring some C code; an exercise that grew from a post-presentation discussion in October. To get the most out of the session, access to a C compiler will be useful. The code is available via a github repository.

January 2013 – Refactoring legacy code

A little evening refactoring by joe.oconnell

A little evening refactoring by joe.oconnell

Date: Thursday 31st January 2013

Time: 7:30pm start

Venue: The Stafford Ale House

Location: Google Maps

Why Refactoring?

Well, a Happy New Year to one and all! Over the last few sessions, we’ve discussed The Alien Invasion project muted for 2013 – this project aims to change the implementation of the original Alien Invasion Challenge to support language agnostic clients. This will require reworking of ‘legacy code’ defined by Michael Feathers as ‘code without tests’.

To support this project, Paul Williams, suggested that we start 2013 with a smaller challenge to equip the group with the skills and some experience in wrapping legacy code in tests. This will then allow refactoring to be applied safely, without worry that functionality will be regressed…

The challenge

This challenge focuses on a legacy C# component with an automated build script but no unit or integration tests. During the evening, we will progressively get the code under test, at which point we will be able to change the functionality through normal TDD refactoring.

To ensure we all get equal input into the session and encourage communication and shared learning, the session shall be in the Randori Session Format – a first for Agile Staffs? This format also has the advantage of only one development machine being used, and thus there are no software or setup prerequisites for the session. The session will however use Visual Studio 2010 and Resharper to drive unit Tests using NUnit so any exposure of these would be advantageous but not required.


The code is available on GitHub and the presentation on Paul’s website. The code will be pushed back at the end of the session for reference. This will also provide the group with exposure to Github to be used for the Alien Invasion.


September 2012 – Anagram Follow Up

Date: Wednesday 26 September 2012

Time: 19:30 start.

Venue: The Stafford Ale House
Location: Google Map

It’s a follow up session! Bring your laptops and other programming apparatus. Last month we had a great session with the Anagram Kata. This month, we shall follow up with some interesting turns involving the same Kata. We shall assume the roles of developers that have happened across some code regarding Kata and have acquired responsibility of maintenance.

Trade your solutions from last month for a piece of code that you have not seen. There’s plenty of implementations in various languages in the comments section of our August post (Objective-C, Java, C#, Python and PHP amongst others). If you have attempted the kata then I encourage you to share your code for some variety. Adapt the code using one or more of the following scenarios:

  1. The code is used in a neat widget in an unspecified number of ways. You’ve been tasked with making the code extensible and adaptable to change. Refactor an existing code to achieve the goal.
  2. Adapt the algorithm employed in the existing code to perform ‘better’ in terms of time and/or space. How will you measure this? Can you cache results to improve anagram generation time for subsequent requests of identical input?
  3. If your acquired code has no formal testing applied to it, how can you be sure that it works? Create a suite of tests. What tests are required to assure required functionality in any dictionary?

Continue reading →

August 2012 – Kata: Anagrams

Date: Thursday 30th August 2012

Time: 19:30 start.

Venue: The Stafford Ale House
Location: Google Maps

Bring your laptops and your favourite coding tools! This week shall do some coding.
I am going to use another kata from Dave Thomas’ BlogAnagrams!

Continue reading →

Tag Cloud