my faceChris Foley is a computer programming enthusiast. He loves exploring new programming languages and crafting nice solutions. He lives in Glasgow, Scotland and works as a software developer.

Coursera: Programming Languages by Dan Grossman

Classic Rock intros; a guy with a PhD jumping up and down; and function subtyping being contravariant in the arguments: These are three things I did not expect from a course in Programming languages.

I signed up to the Coursera course in Programming Languages by Dan Grossman because I have an interest in learning programming languages. I figured the course would be pretty easy and I could pick up the basics of ML, Racket and Ruby. I was already keen on learning Racket and Ruby. I’d never heard of ML before but it couldn’t do any harm. The course said it would take 8—12 hours per week and my inflated ego translated that to 4—5 for me, because I’m special.

As it turned out, the 8—12 hours was spot on, even though I’m special (or perhaps not so special after all) and the course went a lot deeper than just learning a couple of different syntaxes. It started with ML, laying a foundation in recursion and the basics of functional programming. There was a lot of discussion about immutability, typing systems, closures, currying and probably a whole lot more that has slipped my mind. Although a lot was covered in only a couple of weeks, Dan explained everything clearly with lots of code examples.

We finished with ML and moved onto Racket. It’s another functional language but with dynamic typing. This was great for contrasting with ML’s static typing. While we were working with Racket we implemented MUPL (Made Up Programming Language) in one of the homework exercises. This was one of the best parts of the course for me. MUPL had recursion, first class functions, closures and anonymous functions. It was really fun to be taught about these concepts in one week and be guided through implementing these language features the next.

MUPL was a pretty basic language. That’s to be expected because, after all, it was only a homework exercise. However, once the core of the language was implemented, we added some syntactic sugar. It was easy to see that with a few additions to the core and a bit more syntactic sugar, the utility of the language could be easily extended.

Perhaps the biggest thing missing from MUPL is a type system. I thought this was to do with time constraints but we went more in-depth into type systems later in the course, just enough to illustrate that we were only skimming the surface of that complex topic. I now think that implementing a type system was simply beyond the scope of the course.

As the course progressed, Dan continually showed imperative and object orientated examples that were equivalent to the functional concepts he was teaching us. The emphasis was always that all programming languages are equivalent.

Finally, we moved on to Ruby which was a vehicle to explore some of the differences between functional and object orientated languages. A big emphasis was placed on the relative merits of pattern matching vs. double dispatch. This was the only part of the course where I felt any real bias on the part of Dan. He made a lot of valid points but I felt there was a certain lack of objectivity on his part. He was very keen to tell us about situations where a functional style is the better approach but only mentioned in passing some times where an object orientated approach is better.

Having said that, Dan knew most of had a background in OO programming and his job was to teach us something new. Time spent talking about the successes of OO would probably have been time wasted for the majority of the participants.

Overall, I think the course content was excellent. Dan asserted that the course would make us better programmers even if we didn’t continue to use the languages he taught us, or even if we didn’t continue to use functional programming. I haven’t had the chance to put that to the test yet but I certainly have a few more techniques in my arsenal and a new perspective on those I am already familiar with. I’ve done a bit of functional programming before so I already knew some of the course content. What I have never had is for it to all be tied together in a coherent way and compared to a paradigm I’m more familiar with. I felt that this course did that for me.

The homework exercises, I found to be interesting and challenging. They ranged from practicing writing a whole bunch of recursive functions to writing a language, maintenance programming and contrasting the idioms of different programming languages. I actually found that they got easier as the course progressed because they focussed less on detail and more on broad concepts. I know that not everyone experienced it that way and there was a lot of chat on the forums about how difficult the latter problems were.

A common complaint on the forums was the two-submission policy. The homework was marked by an auto grader and in an ideal world Dan would have wanted us to only have one shot at submitting it. He knows that there are lots of opportunities for messing up despite understanding the course so the compromise was that we were allowed two submissions and the average of those submissions would be our mark.

A few people made a big fuss about this. It didn’t bother me but this was my first online course and I was careful to read the course policy before it started. Some others assumed it would be the same as other courses where they were allowed as many submission attempts as they wanted.

Finally but probably most important was the teaching style. I found that Dan’s teaching style suited me really well. He took the time to explain important details and work through examples but at the same time kept the course moving at a good pace. I can see that some people could get left behind while others would feel that it was moving too slowly. I guess I was lucky that the course was pitched at just the right level for me.

Overall, I’m very pleased that I took the course. It has consolidated and expanded upon what I already knew about functional programming. It related all the functional concepts to object orientated programming and has got me interested in learning more about implementing languages. As a bonus, I have learned a little bit of ML, Racket and Ruby.

There are a couple of days left before the results are announced. I’m waiting with anticipation. It’s been a great course. I’ve both enjoyed Dan’s syllabus and teaching style and the Coursera platform. I have a selection of other Coursera courses lined up and I’m looking out for any future offerings by Dan Grossman.

29 March 2013