top | item 25267190

(no title)

TheAsprngHacker | 5 years ago

The approach of incrementally introducing language features is what Matthias Felleisen advocates: https://felleisen.org/matthias/Thoughts/Developing_Developer... Felleisen's argument is that all general-purpose languages are too big to be appropriate for teaching, and you should use specialized teaching languages. In Northeastern University's introductory programming class, students start with a minimal Scheme called Beginning Student Language (which has primitives, function application, if, cond, and top-level define), then move up to Intermediate Student Language (which adds local), then Intermediate Student Language with Lambda (which adds function literals). Each addition is given a motivation (locals let you avoid repeat computations, local functions let you capture the environment, lambdas let you use local functions without giving them a name).

But Hedy seems to make the mistake that many curriculums do of focusing on the minutiae of syntax. Don't do that! Northeastern's course emphasizes broad concepts such as abstraction, accumulators, and generative recursion. Meanwhile, it uses simple s-expr syntax.

discuss

order

analog31|5 years ago

I wonder if a way to make a language gradual is to keep it primitive, but easy to build the more advanced features by composing them from primitive features. I mean, that's ultimately how all interesting programming is done, but it could be introduced at a much earlier and more basic level so it's not fearsome.

As an aside, I think that these online courses are a valuable resource, but it still helps to provide some human supervision, to make sure that a student hasn't fallen into a rut and given up.

TheAsprngHacker|5 years ago

I said this in my other reply, but if you can implement a language feature as a local rewrite, it does not add expressiveness. Features that add expressiveness must involve some sort of non-local transformation. A language feature adds expressiveness iff two programs that are equivalent in the base language in all evaluation contexts are not equivalent in the extended language. Felleisen came up with this idea in a paper, which Shriram Krishnamurthi explains in this video: https://pwlconf.org/2019/shriram-krishnamurthi/

qsort|5 years ago

This is an interesting approach (and also raises interesting questions concerning the relative power of languages, i.e. how adding various features relates to moving from binary logic -> regular languages -> ... -> turing complete, but I'm overthinking it...), but isn't it a tad too limiting? You at least need recursion to do anything that isn't completely trivial in Scheme, even for a CS 101 course. Wouldn't you outgrow them so quickly that you'd end up with "just Scheme, but more annoying" within a couple lessons?

TheAsprngHacker|5 years ago

You can have recursion right from Beginning Student Language (which lets you define top-level functions and call them recursively). Structural is taught early, together with lists. Structural recursion is explained together with recursive data: To unpack the data (any data, not just recursive), unpack the inner members, and therefore the structure of the program follows the structure of the data.

As someone who is taking the accelerated version of this course right now, but had prior functional programming experience, I did feel limited at first. Some other people responded negatively to the student languages because they weren't "mainstream."

As for the expressive power of languages, as a matter of fact, Felleisen wrote a paper that rigorously defines this idea. Here is a talk by Shriram Krishnamurthi that discusses it: https://pwlconf.org/2019/shriram-krishnamurthi/ It turns out that local transformations (macros) do not add expressive power. A language feature adds expressive power if you can find two programs that are observationally equivalent in the base language, but not the extended language.

jj8|5 years ago

It might feel limited for students with prior programming experience. However, my first programming course (in high-school) used BSL & co, taught from “How To Design Prgrams” (1), and it didn’t feel restrictive. Having to manually recurse, construct lists, &c. made clear exactly what later abstractions and syntactic sugar did. Rather than feeling that my hands had been tied before being introduced to, for example, higher order function, I felt I’d been granted superpowers once i had: nearly every function we’d previously struggled to write could now be written in one or two lines, and we even understood fully what those lines meant! Admittedly, this excitement was that of an absolute beginner.

(1) https://docs.racket-lang.org/htdp-langs/index.html