=> Comparison with Functional Programming and Haskell
Matthew Fluet: One of the qualitative differences between Rust and Haskell seems to be the typical size of a “small, interesting function”. This manifests itself in two ways in the courses. First, while my Haskell programming assignments often ask students to implement a dozen or so functions (each with independent tests), my Rust programming assignments often ask students to implement fewer than half that (though some may lend themselves to auxiliary helper functions).
One reason for this may be that many of my exercises in Haskell ask students to implement data structures, which is a natural undertaking in Haskell. Conversely, Rust has a rich standard library that one is encouraged to use; moreover, many interesting data structures in Rust (such as those in the standard library) require some use of unsafe to be implemented efficiently, but such an approach is not appropriate when teaching Rust. The second way that this manifests in the courses is in the course structure. My Haskell course is scheduled with 50min lectures three times weekly and I devote one lecture at the end of each topic to an in-lecture pair-programming recitation, which works well with “small” functions and I was able to develop without significant effort. It seems much harder to scale down my Rust programming assignments into something that would be suitable for a 50min Recitation.
Another qualitative difference between the courses is where to find content for the second half of the course. Both courses are roughly structured with a first half on the language basics (the Haskell course uses Programming in Haskell [19] by Graham Hutton) and a second half with more advanced applications of the language. For Haskell, academic conferences (e.g., ICFP, IFL, the Haskell Workshop) and curated collections (e.g., The Fun of Programming [16] edited by Jeremy Gibbons and Oege de Moor, Pearls of Functional Algorithm Design [4] by Richard Bird) are good sources for (peer-reviewed) papers that present self-contained discussions of a topic with a high-degree of rigor.
As noted above, lots of Rust content appears online in the form of blog posts and YouTube videos, but there can be significant variance in the degree of rigor and it is rare to have a supplementary “long form” presentation of the material. On the other hand, blog posts and YouTube videos are much more familiar to BS and MS students than an academic paper (which is one reason that my Haskell course includes a “Research Paper Summary” activity that asks pairs of students to read and summarize an academic paper where Haskell is used as a research vehicle). This may simply be a reflection of the relative ages of the languages, as there is a growing collection of advanced Rust books (e.g., Rust for Rustaceans [17] by Jon Gjengset) and more frequent appearances of Rust in academic conferences, though often of the “featherweight Rust” style that tries to give a very formal presentation of some core aspect of the language. But, I believe it does reflect a qualitative difference in the language communities. The “major players” in the Haskell community typically are (or were recently) academics and/or researchers, while they typically are industry practitioners in the Rust community, though this may also be changing in both communities.
A final, and admittedly vague, difference between the courses is the incoming attitudes of the students. Students seem to have a preconceived notion that Haskell is very different from their previous programming experience (although our introductory programming course in Python does emphasize structural recursion). My impression is that students asking for help with a Haskell assignment more frequently express that they have no idea where to start, while students asking for help with a Rust assignment more frequently have some code that they believe should work and don’t understand why it is rejected by the compiler or does not behave as they expect.
[…]
One observation from the course is that Rust lends itself to revisiting a programming problem a number of times as one learns about more advanced features of the language. This is consistent with Rust’s position as a high-level systems langauge. As a high-level language, there is typically a simple and “good enough” means of accomplishing a task, but with some inefficiencies such as extraneous indirections or allocations. As a systems language, there is the opportunity to refine an initial implementation to obtain a more efficient solution. This arises often in the “Challenge” tasks in the programming assignments for the course, but also occasionally in the lecture material.
~
MASSEY, Ed Bart, 2022. Rust-Edu. pdf .
Experience Report: Two Semesters Teaching Rust Matthew Fluet Department of Computer Science Rochester Institute of Technology <mtf@cs.rit.edu> Rust-Edu Workshop 2022 https://rust-edu.org/workshop