Wednesday, 20 October 2010

Software Craftsmanship 2010

Bit of a late one. Four of us here at DM attended the SC2010 at Bletchley Park on October 7...not sure why I'm writing this up now. Anyway, good times were had - it was a really nice setting (where the machines that cracked the Enigma were developed). There were many interesting talks available, it was a shame that they were running in parallel. Anyhow, here's a recap and my thoughts on the talks I attended.

Refuctoring Masterclass

Funny lesson, and some great comments from the crowd. We had our task of creating an obfuscated program that would print out "Hello, world!". We also had a unit test to ensure that the program, when running its
method returns that correct string. We started out by creating several helper methods, named "execute", "perform", "execute1" and so forth. When asked for a new name, someone shouted, "executel" as
look so similar in a monospace font.

James and I created an array of letters and created our hello world string by concatenating various indexes of the array together. We then had to swap computers with someone else and change their code to add a new word to the string. The code we received was creating the string through and a random number generator and seemed to be doing some cryptography of some kind. Crazy. It was only until later that I had the idea of executing system calls to a long-winded series of scripts; downloading the "hello" GNU package and compiling and running the Java example; AST transformations etc etc. Damn my lack of coffee.

The Game of Life

Interesting one. We were introduced to the concepts of Conway's Game of Life and were shown a crazy video of it being implemented in APL. I've never seen that language before and it blew my mind while also making me think "?!??!!??!" Turns out APL has its own keyboard with 50 extra keys or so - insane!

James and I chose to use Groovy for our implementation, and we were joined by some fellow codes with Java - a good chance to show others the power of Groovy. We started by writing a series of tests, focused on the life of a 3x3 grid. Developing functions to operate on this small grid, we rationalised we could simply apply them to the entire grid by iterating over the grid 3x3 cells at a time, and that would be that.

Unfortunately we didn't get a chance to fully complete the program as we got a little stuck on how to deal with the 3x3 grid being "outside" of the board's cells, e.g. in an 8x8 grid (only rows 1 and 2 on the x/y axis would be 'filled'). James later finished the code by himself - I'll get him to post it. A few completed the code in time and displayed it - one was created in F#, which seemed a cool language, one in Python (woo!) and one in Javascript - nice. I guess we spent more time testing the code than just blazing into it

Functional Koans – a fun way to learn functional programming in Scala, F# or Javascript

This looked interesting, I use Python a lot and I like its functional abilities, I'd like to improve on them. Me and James decided to use Javascript and Scala - however it took us almost 30 minutes to get set up since the code was hosted on GitHub, and it seemed all the attendees were IP blocked from logging in. We ended up getting the code from passing around a USB stick and from creating a read-only account on David's laptop.

Once we had Scala installed and ready, we had to download the Scala koan's dependencies via Maven, which James had never used. This took almost 30 minutes. We blazed through some of the JavaScript tests, only getting towards the interesting functional ones toward the end, where we were running out of time to get the Scala koans going. We stopped the JS and started Scala, only to be doing language syntax introductions, showing us how class type can be checked, how to assign variables etc. The JS ones were like this too - we should have skipped those, in hindsight.

We had the expectation that the koans would serve to show the use of functional programming, not the syntax of the language. But I guess that's a slight necessary for people unfamiliar with a language.

Overall the conference was great, enjoyed a beer in the bar afterwards and a long drive home to Wales.