A couple of years ago, one of our technical architects at the Hut Group ran a few code dojos to give the team experience of TDD and Pair Programming. The team has grown massively in the meantime, so I thought it would be a good opportunity to try it again.

To quote from codingdojo.org a dojo is:

…a meeting where a bunch of coders get together to work on a programming challenge. They are there have fun and to engage in DeliberatePractice in order to improve their skills.

So, I booked the boardroom, setup an Intellij project on my MacBook and waited for the developers to arrive. In the end about 10 people came, with a range of development experience from less than a year, to more than we’d care to admit to.

The exercise I chose for the group was to implement the “fizz buzz” game. Basically for a given natural number greater zero return

  • “fizz” if the number is divisible by 3
  • “buzz” if the number is divisible by 5
  • “fizzbuzz” if the number is divisible by both 3 and 5
  • otherwise return the number

The first comedy moment was when we went round the table and tried to play “fizz buzz”. You’d have thought a group of highly skilled IT professionals would be able to do simple mental arithmetic, but this is apparently not the case…

The problem itself isn’t all that complicated, a decent developer could write the code in 5 minutes, but the point of the exercise isn’t really the end solution. More important is how you get to it. A pair of developers worked at the laptop. The driver types, focuses on tactics and writing clean code that compiles and runs. The navigator focuses on strategy. How the code fits into the overall design, which tests will drive the code forward, and which refactorings will improve the entire codebase.

We also wanted to build the solution using Test Driven Development. You write a test that fails, write some code to make it pass and then refactor. With a problem this simple it is quite difficult to force yourself to follow these steps.

We started with the simplest case we could think of, i.e. if you pass in 1, you get 1 back and built from there. We managed 7 iterations in the time we had available and got to a reasonable solution.

Going through the exercise prompted a lot of interesting debate. We talked about how you identify test cases, different ways of implementing the algorithm and even got into some OO design. I think the group found the exercise useful, I guess the proof will be when I see how many people come to the second code dojo.

There was one thing that I didn’t think worked too well. The navigator didn’t really get to contribute as the entire group chipped in ideas so effectively we had 10 navigators, but I’m not sure if this wasn’t a good thing.

Next time I may try using cyber-dojo which would allow pairs to work at the same time. It is a pretty neat site where you select a exercise and can code it online in a huge number of languages. One thing it does prove is that Java is a bit of a nightmare without an IDE, Ruby is the future!

As discussed earlier I have been playing with bootstrap for a few weeks and I’m beginning to get into in now. Below is an example of a screen I re-developed to replace a horrible accordion control with tabs and pagination from bootstrap.

I think it looks much better now and it was pretty simple to implement.

Before
After

I’m not a big fan of developing user interfaces. Back in the day I used a tool called OpenROAD to write GUIs for database applications. It was a bit like VB, in that it was an event driven 4GL, but it stored everything in an Ingres database. You couldn’t do proper version control. There was no separation of business logic from presentation logic and you used on grids to position everything. I got quite good at it, but it put me off GUIs for ever.

Moving forward to the present day. I work for one of the UK’s largest online retailers and not liking GUIs is a bit of a disadvantage. I can knock up a webpage pretty quickly and can even do css to a degree, but I’m far from great and not in the same league as our front-end dev team.

I’ve been listening in on a few conversations and Bootstrap from Twitter came up. Bootstrap aims to provide Simple and flexible HTML, CSS, and Javascript for popular user interface components and interactions. I have to admit it seems to do it pretty darn well. I’ve been having a play with it this evening and have managed to knock up a couple of decent (in my opinion) looking screens pretty easily. I’ve got a functional nav-bar, some drop down menus and a reasonable looking form. All the javascript you need comes with it, the css is easy to apply to the html and there are some nice looking icons with it as well. All in all it’s been a pretty painless experience.

It might be time to buy some flip-flops, get a couple of shirts from Threadless and see if I can join the design team… (although my complete lack of talent will probably count against me).

If you interested, Bootstrap can be found here.

An example of my efforts is here.

YAGNI or You Ain’t Going To Need It – the battle cry of the committed agilista. Software developers, myself included, have a rather annoying tendency to over engineer their solutions. We sit there thinking that with a little bit of extra effort we can build a framework or make the code easily extensible so that when the next problem comes along it will take us no time at all to build a solution.

There just two problems:

  1. It never takes a little bit of effort
  2. The “extensible” code you build is never that extensible – it never fits tomorrow’s problem

Hence YAGNI! You build enough to solve today’s problem, and worry about tomorrow’s problem tomorrow.

Why am I blogging about YAGNI? As previously mentioned I have been writing a skills matrix application for work so I can track the level of skill in my team over time. I have high hopes of building an all singing, all dancing system in ruby on rails that will be all things to all men. Unfortunately, I want to know what we know today not in six months. So I built a version that did the bare minimum and released it. I started with collecting the data, I’ve now added a report and will start tracking changes next. I’ve not really worried about how I’m going to build the new functionality and I’m hoping it will all come out in the wash.

Now I could be wrong about YAGNI, it may turn out that I did need it after all. But if worst comes to the worst, I’ve got the data, I’ve learnt a lot of ruby and the next version of skillz will be better. I’m pretty confident I can make it all work, and I’m really good a data migrations if it doesn’t. I can always use Excel if I have to…

You may have noticed that I’ve recently added lots of buttons to this blog. I’m not a web developer, and I looked around for ages to find a way to create buttons that I liked the look of. I tried images, the sliding door technique and a multitude of other things. I eventually discovered this article on WebDesignerWall. It’s really simple to use and I think the buttons it produces look great.

example 1 example 2 example 3

I think it’s a great way of doing it and an excellent tutorial. It won’t work on IE6, but if you use IE6 you get what you deserve ;)