November 3, 2012

Coursera & Functional Programming Principles In Scala

Tags: Coursera, Scala, MOOC, Technical

Scala is an interesting language to a Java programmer that wishes they were doing more Functional Programming. As such a person, when I saw Coursera hosting a course called Functional Programming Principles In Scala with Martin Odersky (Scala’s creator), I immediately signed up for both the site and course. Coursera is one of the new online education websites. They partner with various universities around the world and and run their courses over the web. They have some impressive courses including an AI course by Peter Norvig and an Algorithms course by Robert Sedgewick.

The Scala course was 7 weeks long and took between 3 & 8 hours a week to complete (the first week was 3 hours and the last 8 hours). Each week consisted of an hour or two of lectures (broken into 10-20 minutes chunks) and a machine graded assignment. There was no final exam. The lectures were a good introduction to functional programming, but did appear to assume some programming ability (fine by me). Scala is not a pure functional language, but the course presented as pure a subset as possible, using immutable data structures and only the occasionally println as the only side-effect. It seems the language has either greatly improved since I first used it in 2008/9 or I completely missed the best bits back then. Now Martin covered all the stuff I remember loving about Haskell back when I was university: lazy evaluation; partial evaluation or currying; for/list comprehensions; and pattern matching (although only for case classes in Scala). The language definitely deserves another look, especially since the tooling with Eclipse is definitely much better now. I imagine my old Scala combinatorial iterator test would be much better with lazy list comprehensions.

Completing weekly assignments was definitely a mixed blessing. The only difference between this course and just finding Scala tutorials on the web was the quality of the teaching and the assignments. The assignments reinforced that week’s concepts. However, sometimes it was hard to find time to do them, as they are due a week after being released. Generally though they weren’t too hard, although the last one took me around 6 hours. The assignments were graded automatically, I imagine that is the only way thousands of assignments could be marked in the required timeframe. Unfortunately this meant that there was little feedback other than a overall grade and an indication of where marks were lost. Marks were gained for passing unit tests and some syntactic tests to ensure good code style. This means it was possible to write a less than optimal solution, but still get full marks and no feedback as how to do it better. I’m certain that a couple of points my answers were clumsy implementations - I felt there must be a better way, but got no direction as to what that could be. In this way the course can only take you to a certain level of expertise.

The assignments can also be submitted as many times as desired and each submission is graded. This made it easy to keep going until achieving 100% (as I did in each assignment). It also made me lazy. Rather than write proper tests, I just relied on the automatic grading system. If it said I got the question right, who am I to argue? I think the course coordinators may have noticed students doing this during the course as the last assignment required us to write a couple of our own tests.

The lack of human interaction with lecturers or other teaching staff could be a real problem and I think this the largest issue holding back large-scale online education. I enjoyed the course and got good marks, but it would have been easy for me to cheat (I didn’t). I can’t believe that a significant percentage of students wouldn’t have cheated. Cheating was rampant when I marked university assignments and every single one was checked by hand (which the students knew). Now with just machine checking, it must be easier to get away with it on such simple assignments (where the number of possible solutions is relatively low). Harder assignments would require prohibitive amounts of time to mark.

Most of the problems are for Coursera in increasing the legitimacy of their courses. I just wanted to refresh my Functional Programming knowledge and learn Scala. Thus, I am very happy with the course and achieved my goals. Having just completed one course I would happily sign up for another if it caught my eye (time allowing).