Software developer blog

Code for fun

Yesterday I was participating in the Budapest event of Global Day of Coderetreat. It was a very intensive day of coding in pairs. The basic idea is that the same programming task - specifically the implementation of Conway's Game of Life - is repeated in six 45 minute sessions. Since the pairs were switched after every other session, and people came from different backgrounds, this was a great opportunity to learn from each other. Also one could try different design decisions, and see what are the benefits and liabilities of each.

Pair coding on the Global Day of Codetreat, Budapest

For me this was the first time I did real pair coding, and the most important experience of the day for me was that pair coding is good, good, GOOD. 🙂 Even better for me was when we were doing TDD ping-pong with Athos.

During the first session we somewhat broke the rules and wrote the code first, than the tests. (As Szasza put it: implementation driven testing...) Result: we finished the implementation, but the test coverage was poor, and I bet we would have found bugs in it, once the code went to production. On subsequent sessions we did try to stick to TDD, and mostly got pretty close to finishing the implementation. However I must admit: with every session, and every design improvement I got further and further from completing the task. 🙂

Discussing the design

It seemed to me that there were basically two approaches to the problem: the naive array based implementation smartly warped up in objects, and the the graph based approach. Both approaches can result in elegant designs, so after all it seems it doesn't really matter which solution one chooses, though the graph based solution is more easy to generalize, and the array version is much-much simpler to implement.

The hardest thing was deleting the code after every session. After certain sessions, one really felt, that it has gotten so close to ready, and would be so nice once finished, that it's just crazy to delete. However it did let us focus on new code, and it was not even possible to fall back to previous solutions. Since the 45 minute sessions are not really enough for properly implementing Life - especially if one sticks to real TDD - it would have definitely been tempting to copy past (sic!) certain parts.

Coding essentials: Laptop, energy drink, snacks.

As we were approaching the end of day, we quickly decided, that we should not wait a year before the next event, so Meza - the organizer of the Budapest event - started up a FaceBook page: Codetreat Budapest. If you wish you didn't miss yesterday - you most definitely should - then join us next time 🙂

More pictures on picasa.

@ //