2nd Revision of "Thoughts about the Best Introductory Language"

I finally got my act together and updated my "Thoughts about the Best Introductory Language" essay, with many corrections, some clarifications and several other enhancements. See the previous discussion of it here.

The licence is still CC-by.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

All I can say

All I can say is that any analysis that comes to the conclusion that Perl would be the best choice for first teaching language must be deeply flawed. I mean deep, as in a hole so deep that its bottom sticks out at the opposite side of the planet.

Agreed.

An essay like this is worthless..

I remember for example that previously on LtU, a teacher made two variants of a language: with space as indentation (like Python) or with a C-like indentation.
He found that beginners learnt much more easily with the Python-like indentation: this is very interesting, a scientific way to check what is best for introductory language.

But just arguing random reason to support language X is worthless.

Yeah, it is pretty obvious what's going on here...

I'd rather the dude just said "I really like Perl and think it should be taught as a first language" rather than pretending like he came to this conclusion after measured consideration and dispassionate application of logic and reason!

Indeed, and here is

Indeed, and here is why:

Now, if I had to summarise [Linda McIver's language] in one word it would be this: sexless. It's incredibly limited, not flexible, and not fun. It has no pointers or references and instead relies on nested structures and arrays. There are two basic data types - a number and a string. The language does not have functions as first-order objects, closures, or objects and classes in the Object Oriented Programming sense. Furthermore, it has very few ways for one to express oneself. As a result implementing many algorithms would be very difficult in it. [...] McIver's approach is flawed in the sense that she is trying too hard to save the students from all possible problems they may encounter in trying to understand their introductory language.

The author does not believe in an incremental approach to introducing new concepts. The availability of the kitchen since is paramount

And besides

...it seems that he cannot even tell first-order from first-class functions, although these are almost opposites.

The author does not

The author does not believe in an incremental approach to introducing new concepts. The availability of the kitchen since is paramount

I do believe in an incremental approach to introducing new concepts. For example, I think that it is very possible Object-Oriented Programming is not necessary to be taught at first, and its discussion delayed for later on. However, the language that McIver proposes is too limited, limiting and sexless.

If we choose a programming language, then the entire language cannot be taught at once. However, it is necessary for the students to like the language, be able to experiment on their own, and be able to make use of it later on.

This was the case for BASIC for me, back in the late 80's and PC XT era (and I continued to use QBASIC even after I learned C), and this is the case for people getting their feet wet with Perl, PHP, Python, Ruby, etc. today.

Real world

Most of the SICP exercises are about number theory, recursion, and a lot of other relatively abstract stuff, and too few are about real world...

I hereby propose James's law: when somebody uses the phrase "real world" he or she probably means "my world." Authors should be encouraged to use the later, more accurate phrase.

Why?

All I can say is that any analysis that comes to the conclusion that Perl would be the best choice for first teaching language must be deeply flawed. I mean deep, as in a hole so deep that its bottom sticks out at the opposite side of the planet.

Well, it would be useful if you told us why you think so. You've made an assertion, yet you didn't give evidence for it. Furthermore, if you believe my analysis is flawed, perhaps you'd like to point its flaws.

And finally, I gave several possible languages as good choices for introductory programming languages, not just Perl, and just said that Perl would be my preference, in part because that's what I'm most familiar with.

All of the languages

All of the languages reviewed are dynamically typed (Perl, Python, Ruby), or weakly typed (C). What about strongly typed languages like SML, OCaml, or Haskell? What about other long-standing functional languages, like Scheme or Lisp that have been used in CS programs for decades? What about a dynamically typed object-oriented language, like Smalltalk? What about long-standing logic languages like Prolog? The analysis simply isn't comprehensive enough not to be flawed.

As a personal judgment, there seem to be far too many concepts for beginners to grasp in even basic Perl programs. Simple SML programs are far simpler than simple Perl programs, for instance.

If the answer is Perl...

then you're asking the wrong question.

Nah..

If your answer is Perl, you wouldn't recognize the right question.

As I often point out, Perl is a write-only language. In contrast to APL (the other famous write-only language), it is hypothetically possible to write maintainable programs in perl. I'm not aware of any examples that exist in the wild, however, and there is a reason for that...

I believe that I learnt in that order

I believe that I learnt in that order-
Basic, Logo, Pascal, C, C++, Prolog, Java + OCaml
some other not that important (including Lustre and Esterel)

If I was to chose for someone it would be:
Logo
OCaml
Java

Then maybe Haskell or Scheme.

What does the introductory course aim to teach?

Three possible agendas:

  1. Teach reasoning about programs: My first bachelors-level course was an ancestor of Richard Bird's current PRG functional programming course, which emphasises algebraic reasoning about code, and for which Haskell is excellent. I am very happy with what I took from this course.
  2. Building up from the metal: The catenative-language advocates here have slowly been winning me over to Forth's advantages, at least for didactic purposes. It certainly seems to have the edge on C, featuring improved interactivity, more readily grasped compiler design, and better extensibility, supporting some reasonable high-level abstractions.
  3. Teach PL-principles: For presenting a well put-togther language, Scala's smooth blend of functional and object-oriented language principles has lot going for it. For supporting an incremental approach to presenting PL principles, DrScheme is hard to beat.

And there are, of course, other central goals the introductory course may wish to have. I'd like to know what didactic goals Logo is supposed to support. Exploratory learning?

BTW, I don't think perl is so awful, at least in its Pugs incarnation. Perl6 removes many of the worst misfeatures of perl5, and has learnt some good lessons from its tangoing with Haskell.

I'd like to know what didactic goals

I'd like to know what didactic goals Logo is supposed to support. Exploratory learning?

I suppose that is addressed to me.

Logo is good to learn concepts such as sequencing, loops, procedures etc. According to Wikipedia "Logo was a primary influence on the Smalltalk programming language."

The graphical interaction encourages exploratory learning. I think it is an excellent choice as a first introduction to computer programming.

Logo's mindshare

My question wasn't directed just at you, though it was your comment that provoked me to ask it. In fact several regular LtUers have expressed admiration for Logo, including Ehud and Peter van Roy. I'm curious to know more. Is it a programming language just for secondary education, or would it make sense as an introductory undergraduate course? If we want to apply Pappert's ideas to constructing a constructionist pedagogy for a course aimed at teaching general PL principles, how would we go about this. I really haven't a clue

Computer science, Logo style

Brian Harvey's three volume series, "Computer Science Logo Style", might help answer these questions. It's a "three-volume series intended mainly for teenagers and their teachers, or for adults who aren't professional programmers." Info and links are on his home page.

Is it a programming language just for secondary education, or would it make sense as an introductory undergraduate course?

My impression (based on little more than the web pages linked in this comment) is that Dr. Harvey considers it more the former (he's "interested in the use of computers in K-12 education") than the latter. He teaches an SICP-based course at Berkeley, using Scheme.

There are more things in heaven and earth, Horatio

There's not just one kind of "programmer" and especially not just one kind of "beginning programmer". A reasonable answer to the question, "What programming language should I learn?" would need to take into account the asker's background and future intentions. There's no single answer that covers an entering freshmen in computing science, a freshman in engineering, a junior high school student, a business person looking to automate his analysis tasks, and a retiree wanting to expand her horizons.

The author's perspective on programming is revealed in the article:

"The more strict the language is, then generally the less expressive it is. Programmers like to express themselves and be able to implement algorithms using the entire power of the language."

(As an aside, not all programmers "like to express themselves"; some simply want to solve a problem at hand with a minimum of effort.)

But if a person really wanted to express himself e.g. as a poet, I'd advise a rigorous study of grammar and vocabulary, with special emphasis on etymology, followed by thorough reviews of standard and contemporary literature. Only then would I turn the focus on self-expression. (Contemporary society seems overstocked with those who are more interested in expressing themselves than in learning techniques for effective expression or understanding that which has already been expressed.)

For the hobbyist, or student with weak background, an introduction to the basics of algorithmic thinking in Logo or Squeak might be a good first step. Someone with slightly more background might be up to "The Haskell School of Expression".

Beyond that, I'd recommend a dominant language in the asker's intended domain, both to take advantage of available resources and to equip the asker for conversation with others in her/his field. When/if the asker achieves basic competence in that language and is ready for more, I'd recommend a second language that still has wide usage and a rich resource base, but which has a conceptual basis as different as possible from the first.

Indeed, background is

Indeed, background is important, which is why McIver's analysis is good. It basically assumes syntax and semantics similar to high school level algebra and mathematics that most people starting a course in programming are already familiar with. I think that's fairly reasonable, and transitioning from such a language to SML should be fairly smooth, so this author's contention that it's not "sexy" or "powerful" enough, while technically correct, is not that big a deal IMO.