TDD is still alive (JSOxford Code Retreat)

Last Sunday I went to The Jam Factory in Oxford with 20 other programmers for ‘Code Retreat’ – an event organised by JSOxford as part of their Summer of Hacks.

The aim of the event was to encourage us to code properly through a variety of techniques. We weren’t expected to finish the set tasks, but the code produced during the tasks should be perfect. Emphasis was put on code quality rather than quantity – different than other hack events.

For all 4 tasks, we had to go about producing a program to simulate Conway’s Game of Life. We had 45 minutes for each task, and weren’t expect to finish.

The first task was to pair up and program the game using pen and paper. We got stuck in writing pseudo code for the whole game. We had enough time to think through what the code would do, and we even fixed a few bugs on paper!

Next, we got onto our laptops and coded the game using Test-Driven Development. The event was organised by JSOxford, so naturally I chose to program in Python. We were encouraged to write the test before writing the function.

In task 3 we grouped around one laptop and told not to use conditionals or iteration, then we were limited to only use an immutable data structure in task 4. These tasks confused me since I hadn’t programmed like that before! Other people were using functions like map, filter and lambda to get around the iteration limitation.

Although I didn’t do so well in the last 2 tasks, I did learn a lot from the day. I learned the benefits of TDD and pair programming. TDD takes a lot of time, but the code produced at the end is of top quality. Pair programming encourages sharing of expertise, and produces a better program as a result – it should not be an excuse for employers to halve our salaries!

The problem with the day was that there wasn’t enough hacking, so the next day I hacked together my own version of Game of Life using Processing. Even my brother helped out with the programming! It’s slightly different from the original because cells have a maximum lifespan, and they explode when they reach this age. Click the image to play it, then click the animation if you want to reset it.

Game of Life screenshot

This was the first programming event I had attended, so I was overly excited by the free GitHub stickers. I thought it would be a good idea to put my name sticker on my laptop lid – turns out it wasn’t so useful for Code Retreat.

GitHub sticker with my name on

Next, I’ll be learning Ruby with White October, then I’ll be making JavaScript robots in August!


3 thoughts on “TDD is still alive (JSOxford Code Retreat)”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: