3 ms·
I've taught both, and IMHO, the Ruby is less suited for the job of an introductory language because a block (i.e. an anonymous function) is a hard concept for a
by artlogic 12y ago
I've taught both, and IMHO, the Ruby is less suited for the job of an introductory language because a block (i.e. an anonymous function) is a hard concept for a beginner to grasp and a core part of idiomatic Ruby. Python's syntax simply has "less magic" and is more regular. Ruby's syntax seems to be suited for either folks who don't really want to know what's going on (just give me a DSL and leave me alone) or students who have one language under their belt and are looking for to branch out.
That said, Ruby includes a lot of interesting concepts, and while I don't believe it's an ideal first language, those concepts certainly belong in a CS program.
- Rapzid 12y agoThat's why I think the best introductory is the usual C/C++ classes that build on a foundation of memory addresses, the stack, function calls, etc. If you spent just a few days talking about how an actual program runs, blocks are very easy to place on that foundation(haha, see what I did there?).
- epsylon 12y agoThe "Programming Language" course at coursera [1], which is directly adapted from a course at U. Washington by Dan Grossman [2] features SML, Racket and Ruby as three languages exhibiting different properties (FP, OO and static typing). (I have to say that it was extremely good !) [1] https://www.coursera.org/course/proglang https://www.coursera.org/course/proglang [2] http://courses.cs.washington.edu/courses/cse341/13sp/ http://courses.cs.washington.edu/courses/cse341/13sp/
- marcandre 12y agoA block is not an anonymous function. Try using `return`, `next`, etc... in an anonymous functions. Ruby has anonymous functions, they are called lambdas. I'd say that blocks might be easier to grasp for a true beginner that hasn't been "contaminated" by the notion of anonymous functions as fundamental objects.
- artlogic 12y agoYou are, of course, technically correct. However, I'd argue that at the level of a CS1 course, it's all just semantics. True beginners don't even understand the concept of a function, let alone an anonymous function. For a student that's struggling to understand what's happening (not just type and have faith), blocks turn into one of those 'down the rabbit hole' pieces of syntax that requires a bunch of hand waving and earnest assertions of eventual understanding. If you've got an explanation that would work in week 2 or 3 of a CS1 course, I'd love to hear it. I never found one better than "It's shorthand for a function."