I’ve been teaching myself programming for a few years. I find it interesting and like the challenge of solving puzzles. Most of my learning has been through what is known as imperative languages, which are the languages that have the most likelihood of being recognised by regular folk; Java, C and Visual Basic are examples of this kind of language. There are other programming styles though, and one that has long caught my attention is functional programming. This isn’t functional programming in the sense of a “functioning level of programming” it is programming with functions. It requires a different mindset & approach than what imperative languages require. Functional programming is more akin to the mathematical equations and constructs of high school algebra or calculus than the “if this do that” constructs of imperative programming. One of the principal tenets in functional programming is that the data should not change, and that functions can be considered data. It uses a load of recursion…lots of it.
I missed out on the first run of Coursera’s Functional Programming but luckily was able to fit it in on the second iteration. The language of the course is Scala, a language for which, Martin Odersky, the presenter, is also the author. You would expect him to know his stuff and you’d be right. He knows it well! He begins the course with acknowledgement & reference to “Structure and Interpretation of Computer Programs“, a now famous MIT course. This course aligns closely with the instruction & direction of SICP, but taught through Scala in place of Scheme.
Scala is one of the hot skills these days, for several reasons;
- It promotes code that’s succinct & elegant.
- It can crunch big data across multiple processors (parallel code).
- Twitter and other new tech startups use it.
Scala is not a wholly functional programming language, it is built on top of Java and has some imperative aspects, but the course ignores these and presents all topics of functional programming as they can be demonstrated with Scala. I really enjoyed the lectures, they were very informative and just the right length to take in on my morning commute. Video lengths ranged from 5 minutes to 25 minutes, and I did need to give some a second or third viewing to take it all in. The exercises were extremely well thought out. Each week when I’d take a first look at the assignment I would think it was totally unrelated to what the video content was about. I’d struggle all week trying different approaches, consulting the course forum and then finally re-watch a clip before finally I’d just ‘get it’. It was astounding to realise that just as much effort, if not more, went into creating the assignments as went into the course content. The assignments were the real gem of learning experience for me with this course.
This course is not for everyone, and isn’t one I would recommend to a beginner. If you are interested in a friendlier introduction to the concept of functional programming take a look at this or possibly Land of Lisp: Learn to Program in Lisp, One Game at a Time!, by Conrad Barski. There is also Realm of Racket: Learn to Program, One Game at a Time! (released June 2013 so I have not read it yet) which follows the Land of Lisp path, but with Racket instead of Lisp. It uses the same games as Land of Lisp to teach and since Racket is a teaching language, I would expect it to be a trifle more accessible. If you really want to delve straight into programming enlightenment then the full text for SICP is available for self study on their website.
My final verdict on the Scala course: I loved it! 10 out of 10 (or 2 out of 2 if you can’t read binary). There are plans to run a follow on version of the course, that will one I’ll definitely look forward to.