Towards a new programming languages course: ideas welcome!

tl;dr: This fall, I will be teaching an undergraduate PL course, with a focus on practical language design principles and tools. Feedback, questions, assignments you can share with me, etc. are all most welcome!

This fall, I will be teaching an undergraduate course on programming languages. It’s eminently sensible to ask a new hire to take on a course in their specialty, and one might think I would be thrilled. But in a way, I am dreading it.

It’s my own fault, really. In my hubris, I have decided that I don’t like the ways that PL courses are typically taught. So this summer I have to buckle down and actually design the course I do want to teach. It’s not that I’m dreading the course itself, but rather the amount of work it will take to create it!

I’m not a big fan of the sort of “survey of programming languages” course that gets taught a lot, where you spend three or four weeks on each of three or four different languages. I am not sure that students really learn much from the experience (though I would be happy to hear any reports to the contrary). At best it feels sort of like making students “eat their vegetables”—it’s not much fun but it will make them grow big and strong in some general sense.1 It’s unlikely that students will ever use the surveyed languages again. You might hope that students will think to use the surveyed languages later in their career because they were exposed to them in the course; but I doubt it, because three or four weeks is hardly enough to get any real sense for a language and where it might be useful. I think the only real argument for this sort of course is that it “exposes students to new ways of thinking”. While that is certainly true, and exposing students to new ways of thinking is important—essentially every class should be doing it, in one way or another—I think there are better ways to go about it.

In short, I want to design a course that will not only expose students to new ideas and ways of thinking, but will also give them some practical skills that they might actually use in their career. I started by considering the question: what does the field of programming languages uniquely have to offer to students that is both intellecually worthwhile (by my own standards) and valuable to them? Specifically, I want to consider students who go on to do something other than be an academic in PL: what do I want the next generation of software developers and academics in other fields to understand about programming languages?

A lightbulb finally turned on for me when I realized that while the average software developer will probably never use, say, Prolog, they almost certainly will develop a domain-specific language at some point—quite possibly without even realizing they are doing it! In fact, if we include embedded domain-specific languages, then in essence, anyone developing any API at all is creating a language. Even if you don’t want to extend the idea of “embedded domain-specific language” quite that far, the point is that the tools and ideas of language design are widely applicable. Giving students practice designing and implementing languages will make them better programmers.

So I want my course to focus on language design, encompassing both big ideas (type systems, semantics) as well as concrete tools (parsing, ASTs, type checking, interpreters). We will use a functional programming language (specifically, Haskell) for several reasons: to expose the students to a programming paradigm very different from the languages they already know (mainly Java and Python); because FP languages make a great platform for starting to talk about types; and because FP languages also make a great platform for building language-related tools like parsers, type checkers, etc. and for building embedded domain-specific languages. Notably, however, we will only use Haskell: though we will probably study other types of languages, we will ues Haskell as a medium for our study, e.g. by implementing simplified versions of them in Haskell. So while the students will be exposed to a number of ideas there is really only one concrete language they will be exposed to. The hope is that by working in a single language all semester, the students may actually end up with enough experience in the language that they really do go on to use it again later.

As an aside, an interesting challenge/opportunity comes from the fact that approximately half the students in the class will have already taken my functional programming class this past spring, and will therefore be familiar with Haskell. On the challenge side, how do I teach Haskell to the other half of the class without boring the half that already knows it? Part of the answer might lie in emphasis: I will be highlighting very different aspects of the language from those I covered in my FP course, though of course there will necessarily be overlap. On the opportunity side, however, I can also ask: how can I take advantage of the fact that half the class will already know Haskell? For example, can I design things in such a way that they help the other half of the class get up to speed more quickly?

In any case, here’s my current (very!) rough outline for the semester:

  1. Introduction to FP (Haskell) (3 weeks)
  2. Type systems & foundations (2-3 weeks)
    • lambda calculus
    • type systems
  3. Tools for language design and implementation (4 weeks)
    • (lexing &) parsing, ASTs
    • typechecking
    • interpreters
    • (very very basics of) compilers (this is not a compilers course!)
  4. Domain-specific languages (3 weeks)
  5. Social aspects? (1 week)
    • language communities
    • language adoption

My task for the rest of the summer is to develop a more concrete curriculum, and to design some projects. This will likely be a project-based course, where the majority of the points will be concentrated in a few big projects—partly because the nature of the course lends itself well to larger projects, and partly to keep me sane (I will be teaching two other courses at the same time, and having lots of small assignments constantly due is like death by a thousand cuts).

I would love feedback of any kind. Do you think this is a great idea, or a terrible one? Have you, or anyone you know of, ever run a similar course? Do you have any appropriate assignments you’d like to share with me?


  1. Actually, I love vegetables, but anyway.

About Brent

Assistant Professor of Computer Science at Hendrix College. Functional programmer, mathematician, teacher, pianist, follower of Jesus.
This entry was posted in teaching and tagged , , , , . Bookmark the permalink.

14 Responses to Towards a new programming languages course: ideas welcome!

  1. Dear Brent, I think you may be interested in checking these lecture notes by Olivier Danvy http://users-cs.au.dk/danvy/dProgSprog16/Lecture-notes/index.html . Good luck with this class!

  2. Jamie Hope says:

    Your reasoning is similar to the motivation behind Structure and Interpretation of Computer Programs, which was the introductory CS class at MIT (6.001) for almost 30 years. We only used one language, Scheme, throughout the semester, but were exposed to a wide variety of topics, including: functional programming, imperative programming, object oriented programming, logic programming, program evaluation (including metacircular evaluation — writing a Scheme program which evaluates Scheme programs), and compilation to a register machine architecture. If you’ve never read the SICP book, check out the preface and introductory material in Chapter 1, which provide the authors’ rationale for using a Lisp dialect and what they hoped to accomplish with the course [0]. It took me years to really appreciate how much I learned in that class (at the time, I think I was just kind of constantly slightly overwhelmed).

    I think that you’re right, it’s better to stick to a single language for the whole term. I don’t know enough Haskell to evaluate its suitability, but I know for us, using Scheme for everything helped to keep the concepts pure. When we started talking about OOP or imperative programming, we just talked about the new ideas, and didn’t get sidetracked talking about curly braces or the C preprocessor or some other quirk of a new language.

    Anyway, good luck!

    [0] https://mitpress.mit.edu/sicp/

  3. Janne says:

    Not a bad idea, and certainly better than a simple survey course. I would worry about the overlap with courses in compiler design, though. My idea when reading you post is a little different:

    Take a flexible multi-paradigmatic language with a strong macro facility (Scheme or Lisp, basically). Then look at programming languages from the point of view of what they offer: object orientation, functional programming, strong type systems, logic programming and so on – and implement each one in Scheme or Lisp using their metaprogramming and macro systems.

  4. Alok Singh says:

    I’d cut a week of learning Haskell and cut the social aspects. Fold social aspects into commentary while lecturing. Use the extra 2 weeks for learning how to make a airtight DSL.

  5. Jacob says:

    Are you familiar with Shriram Krishnamurthi’s _Programming Languages: Application and Interpretation_ (PLAI)? It seems fairly well aligned with your ideas, though the text uses Racket rather than Haskell. Here’s a link: https://cs.brown.edu/~sk/Publications/Books/ProgLangs/2007-04-26/

  6. Jay McCarthy says:

    I think that the goals of your class line up with Matthew Flatt (http://www.cs.utah.edu/~mflatt/cs5965/) and Shriram Krishnamurthi’s classes (https://cs.brown.edu/courses/cs173/2015/ and http://cs.brown.edu/~sk/Publications/Books/ProgLangs/2007-04-26/). You may find some useful things to harvest.

  7. Fred says:

    Brent, I loved my survey of programming languages class and I believe that it had a positive and lasting influence on me (and that was more than 30 years ago). As I recall we covered several diverse languages, Snobol, Forth, APL, and Pascal. We solved the same problems in each of the languages. The lesson I learned from the experience was to pick the right tool for the problem at hand. Unfortunately the industry today doesn’t appreciate the diversity of languages for both good and bad reasons. What I hope your new class does is inspire the next generation of software engineers to think, be creative, and always challenge the status quo.

  8. My fire was lit by Norman Ramsey’s course (an updated version of which appears to be here: http://www.cs.tufts.edu/comp/105-2013s/readings/index.html). The course used NR’s textbook-in-progress (which he might be willing to share). If memory serves, it was more of a survey course, but what made it stand out is that the concrete syntax of all the languages was unified into a LISP-like syntax. This made it very easy to jump from one language to the next. Each week covered a new paradigm, but there was a good dollop of theory thrown in as well.

    As for your ideas, I think you have a great outline here, and I’ve included a link to this page in my own notes for some future PL course. In particular, I remember an experiment I did once in embedding Java into Haskell. It required, of course, putting *everything* in IO and thinking quite carefully about the order of evaluation, etc. It was both fun and very educational. I’ll be curious to see where this leads!

  9. Brent says:

    Thanks, all, for the ideas, links, and encouragement!

  10. Lucas Wiman says:

    Kanren might be a good DSL to include that has fewer moving parts than Prolog but many of the same ideas.

  11. Alli says:

    Sounds very similar to the Programming Languages course (CS 421) at UIUC (everything is in Haskell, implement several languages over the course of the semester). https://courses.engr.illinois.edu/cs421/schedule/

  12. Perhaps it’s too late now, but I think (and I can’t really believe I’m saying this) that I would support the suggestions to use Racket rather than Haskell. For one thing, there are lots of great resources for this kind of thing in the Racket community, more so than for Haskell. For a second, a Lispy kind of language is fundamentally simpler than Haskell; I think your current plan means that you’ll spend quite a lot of your time teaching Haskell rather than the PL Design concepts you want to cover. And thirdly, it’ll be a good way to level the playing field between your two cohorts.

    • Brent says:

      It is indeed too late now, but thanks for the thoughts all the same. Definitely something I will take into consideration for the next time I teach the course.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s