TDD Talk

images

Recently, myself and two colleagues from the BBC, ran a session on Test Driven Development at the Manchester University ‘Ultimate Programming’ society. The society is a gathering where students discuss cool things they have done with programming, and occasionally have guest speakers from industry. I found the society online and thought it would be great to get the BBC more involved in the local university happenings.

It is the first outreach project that I have undertaken, and it required a lot of preparation. Our initial idea was to get students to implement the A* search algorithm in a practical session, using TDD. However after we had all implemented our own copy of the algorithm, and realised it had taken several hours each, we realised we’d not have enough time in the 2 hour slot that we had.

Instead then, we went back to the tried and tested FizzBuzz example, which is how I learned TDD at the BBC. This was nice and simple and relatively straightforward to implement in an hour practical session. The task was to implement FizzBuzz using write-the-tests-first TDD process, and we gave approximately 1 hour for the students to undertake this task. For the rest of the time we were going through our presentation and talking about how we use TDD and other development concepts at the BBC.

The session overall went quite well, and although it showed to me how difficult it is to present in front of a group of people for an hour, we had good feedback, and I think we really gave the students a different perspective on how to write code, one that a large section of them would not have been exposed to in a standard CS curriculum. We aim to do other talks, starting with the next one, which will be a session on how we use BDD (Behaviour Driven Development) at the BBC.

Here are the slides we put together for the presentation:

Here is the model solution to the TDD exercise, written by my colleague Jack Palfry:

2 thoughts on “TDD Talk”

  1. I think the TDD session went well, but I was surprised at the how many hours of work it took to do it. Two days to prepare for a 2 hour session. I’ve had quite a bit of feedback from students at other recruitment sessions, all positive thankfully!

    I know firsthand that many of us get intimidated by programming and we shouldn’t be. University graduates with a computer science degree are a hot commodity in the job market, and tech companies are quick to snap them up.

    TDD is one of the essential skills for new programmers, writing tests first requires you to really consider what you want from the code by simplifying the design and coding process. The hard part is that it’s a big psychological shift from test last development and swapping between the tests and code can feel a bit jarring at first. If you can master it though it will make you write rock solid code.

    The calculator demo video we showed as part the presentation we gave is available at http://dl.dropbox.com/u/46047764/tdd.mp4
    and the code is at https://c9.io/spaaaaam/rpn

    I’m looking forward to the BDD session, it should be fun! Shouldn’t it be though?

    Like

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s