The Road to Functional Programming

Two years ago, I attended DunDDD (Dundee – Developer Developer Developer), the conference named after a chant Steve Ballmer started during one of his many eccentric moments. At the conference there were 4 tracks (Big Data, Web Development and I’m unsure what the other two were looking at the agenda) – but you were free to hop between them as you pleased. At the time I had just started working in an international team, was realising the power of source control (or catastrophic risk of a lack of source control…) and was curious about big data (like most people in 2012).

Agenda DunDDD 2012

Agenda DunDDD 2012

One thing to note about DunDDD is that it is a bit of a Microsoft centric conference – despite the generic developers title. Still there are plenty of non Microsoft based talks and even the ones that aren’t can be pretty good (if a little sales like at times). By late afternoon I was a little tired (part hangover, part early morning train to Dundee) and didn’t feel like I could sit through another sales like pitch, so I took a gamble and switched to Gary Short‘s talk on “Not Everything is an Object”. I had overheard him talk about the bad UI decisions on hiding the power off options in Windows 8 and he sounded like he would be fun to listed to. Some other delegates at the conference had heard Gary talk before and had nothing to good things to say about his talks – so why not.

Not Everything is an Object

Not Everything is an Object

The talk focused around how as an industry we had become obsessed with OO style programming and languages and crucially wanted to prove to us that this was a bad thing – that the world couldn’t always be described well by using objects. Instead functional programming could do things a lot better (in some/most places). His preferential functional language was Clojure. This wasn’t my first encounter with functional languages – for a very brief time at university we made use of Haskell (badly) –  but it was my first good/interesting encounter. Clojure has a couple of advantages over some of it’s alternatives – mainly running on the JVM, meaning you didn’t have to give up the warm embrace of familiar old dog Java. This post isn’t about Clojure – but I will get around to that post very shortly. He had an example about a doctors surgery (or hospital) which he described in OO with the help of the audience – causing some debate at the time. When it came time for the Doctor object to become sick and mutate into a patient he demonstrated the pitfalls of OO – although I think it might be possible to build a better model as someone else suggested. While I can’t quite remember what he did with Clojure to solve the problem – by the end of the talk it did sound like a viable alternative if only a little better. Gary’s talk can be found on slideshare here.

Adrian @ TM

Adrian @ TM

That would be the last time I encountered Clojure or functional programming for some time – or at least I thought it was at the time of my first draft post. It turns out the talk I was about to mention by Adrian Mowat at Techmeetup Glasgow, was a lot older than I thought. Adrian gave what would become my first in depth (from a hands of and watch approach) look at Clojure. Again I was curious and a little more sold that it could be a good route to go down for coding.

 

Seven Languages in 7 Weeks

Seven Languages in Seven Weeks

Earlier this year would be the first time I would get my hands dirty learning a bit of the language. The monthly(ish) Code Craftmenship meetup in Glasgow – Code Craft had decided to do a group reading and work through the text book “Seven Languages in Seven Weeks” which I mentioned in this blog post. While I didn’t get as far into the book as I would liked to have (real life and work get in the way of keeping a good pace), I did finally at least write a few lines of Clojure. The focus of the book however was on the strengths and weaknesses of the languages rather than actually learning them however.

Fast forward from then through summer and we end up here. The seed may have taken almost 2 years to grow, but I have finally made the decision to learn more Clojure. While I haven’t gotten too far yet, I hope to make regular posts on my journey to a more functional world.