Thoughts about the Best Introductory Language

I wrote an essay titled "Thoughts about the Best Introductory Language which discusses the suitability of various languages as introductory programming languages, covers several approaches to that, explains why they are wrong or right, etc. I believe the final conclusion is less important than the actual insights and discussion presented there.

Read, share, comment and enjoy!

Comment viewing options

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

The more strict the language

The more strict the language is, the less expressive it is.

Some languages, like Haskell, derive their expressive power exactly because of the restrictions imposed.

The "It Should Have a Decent IDE" Fallacy

The more important consideration is that it should include an interpretive environment that allows experimentation with the most trivial of statements/programs - a REPL or transcript of some sorts.

The "Structure and Interpretation of Computer Programs" Approach

HTDP is probably the more appropriate for a larger variety of beginners.

Different people I talked with agreed to me that "You cannot do anything with Scheme".

I think they're underestimating the power of Scheme. Scheme will take you to extremely advanced programming that few other languages will - some of the most advanced research in programming uses Scheme. (The Dr. Scheme IDE is also quite nice and friendly). I think what these compratiots are saying is more economic than technical in spirit - i.e. the jobs are in C, Java, Perl, etc... and the growth they speak of is not in terms of the expressive power of PLs, but rather in terms of whether they want to have the PL represent a direct experience with trade. There's nothing particularly wrong with wanting to ride the popularity waves - by virtue of being popular, these languages will have a much wider community and more libraries to draw from.

Of course, the practical problem is twofold. First, the popular language of today may well become the anachronism of tomorrow. My first course was in FORTRAN - it was the most popular language for computer science at the time. Looking back, I realize that Lisp would've been much more beneficial for me - at the time it would not have been apparent. The fact that I probably still would not have used Lisp in my profession does not alter that verdict.

A second consideration is that the number and diversity of PLs is increasing with time. The most important point of college is not to learn a bunch of facts or fixed ways of doing things - rather learning how to learn is the most important facet of any that pursue higher education. So the question about a PL shouldn't just concern whether that PL is practical, but also must consider the longer run ramifications about how well it feeds into the process of learning. If I learn language X, does it help me learn the underlying concepts that will help me when I have to deal with various other languages? Computer Science is still a relatively young field, and the tools and languages we use are constantly evolving (or becoming antiquated). Best to teach the principles behind programming and PLs and leave the particular details as an exercise.

All things considered, I'd say that Perl is the best choice now, as Python is too strict and unexpressive, and Ruby is documented in an extremely inadequate way.

Realizing that there are a lot of smart people who do a lot of interesting things with Perl, I cringe at the suggestion of Perl being the PL used for introductory courses. The reason is that any course that uses Perl as the PL will become hopelessly lost in teaching syntax. The purpose of an introductory programming course should not be about teaching any specific PL, be it Scheme, Basic, Python, ML, .... The purpose is to teach about how to think and how to learn to use a PL to express ideas.

My suspicion is that how one answers the question of what PL to use depends on what one is trying to teach. From a conceptual standpoint, teaching with Scheme will allow one to spend about a day on syntax and the rest of the year on concepts. Teaching with Perl, OTOH, will allow one to jump into solving practical problems of a certain variety and leave little time for one to delve into advanced topics in PLs.

The unstated assumption in the discussion is motivation - the teachers must enjoy the language they choose - and the students should not approach it with drudgery.

LtU links

I guess I'd be remiss if I didn't point out that the subject of the first PL has come up a number of times on LtU. Unfortunately, I can't seem to locate most of the discussions - the discussion on the HtDP text is the best place to start. And CS 61A from Brian Harvey is a nice intro course that should serve as a comparison.

Added proviso

The purpose of this essay is to contemplate what is the best introductory programming language to teach for beginning programmers, or for them to teach themselves.

I guess I should note that these are two very distinct questions. The first question is what PL is best for an introductory course - which is what I was responding to above. The second question is what's a good first language to pick up on your own.

Perl makes little sense in answer to the first question, though it can be fine for the second. In a classroom setting, a structured approach is necessary. In a basement setting, a PL which can give positive feedback and a sense of empowerment is more important.

Interesting you should mention

My path to programming was what you describe precisely. I started out teaching myself perl from the camel book until I was fairly comfortable and confident in my ability to make the computer do something. I worked for a year in my spare time on what for me was a really big project, though was actually just a simple web content management system. At a certain point, I felt I wasn't really getting any better at coding, just writing more code so I sought out more formal information. I eventually found SICP and the associated video lectures online. I probably learned more from that book than the previous 2 years of coding in perl.

In my mind the self-taught progammer really needs some combination of a well supported (in both the library and available books sense) language and a separate more formal language to fully understand the subject. I'm not convinced perl is the best choice for the former, because although it has great libraries and a number of really good beginner oriented books, it didn't really make sense to me until I started learning about unix.

The main problem with scheme as an only language for a self-directed course, is that you won't grow until you hit something big enough that it exposes the flaws in your process. It's very easy to get a web hosting package that includes perl or php support or get involved with that sort of development. I think it's much harder to find an opportunity to use scheme in a beginners' context.

I think setting matters a lot, though. In the Visual Effects industry, the best first language seems to be python at the moment since a number of high end software packages such as Maya and Houdini, along with a slew of not so large packages are all embedding python into their interface. That combines an immediate context to use the language with an instant feed back loop in which to practice. Of course ten years ago I guess I would have been saying the same thing about TCL...

Agreed

Having taught an introductory computer science course using Scheme for the past three years, I have to agree with what Chris said above. Some of the comments in Shlomi's essay hold for MIT Scheme and SICP but not for PLT Scheme and HtDP. Personally, I would refuse to teach an introductory course using Perl on human rights grounds, but to each their own -- I hope we are entering an era where many different approaches can flourish. --PR

ditto

I couldn't have said it better myself. I've taught out of SICP for the past six years, and while it does have its issues, I think the meta-approach of teaching Scheme as a way of understanding the big ideas of programming is far better in the long run than teaching a language with the view that this will be the main language you'll use to program in for a long time to come (not that the author of the article said that in so many words, but the implication is there). At Caltech we follow this up with a course teaching a number of languages (C, C++, Java, Ocaml, Haskell, Python, pick any one you want) where the students can put their knowledge into practice. It seems to work well. Having said that, I would be happier if there was more practical programming done in Scheme, which is an unjustly underrated language. Essentially all of the criticisms of Scheme in the original article don't apply to the DrScheme/MzScheme environment.

What about a subset?

It's been said of PL/I that there was a great little language in there somewhere, and probably several of them. The same has been said of Ada, and is largely true of Perl.

People who come to Perl from C often program it like C, while Lisp people treat it as a Lisp dialect and people from other backgrounds do likewise. If it can be used to emulate all those styles, then it could be used to teach all of those styles if wielded carefully.

There are certainly drawbacks to Perl as a first language. I'm just not sure the size of the language is one of them.

One could easily teach a subset of Perl. If someone learned the parts of Perl with the prettiest syntax and the features most commonly supported in other languages, it wouldn't have to be so daunting. People teaching Lisp usually don't jump right into CLOS, for example. I certainly wasn't taught the Turbo Vision libraries at first in Pascal or the parallelism and exception handling at first in Ada.

The positives of a subset of Perl are that one could teach a completely procedural class with it, a completely functional class with it, or a completely OO class with it. The styles are not enforced in Perl, which for an introductory class could be a drawback. However, the ability to teach multiple styles one after another in the same language could be a boon.

Perl also has a huge repository of useful libraries which is freely available, easily searched, and easily installed. The advantages of getting programs running with the help of existing code is one thing which should be taught fairly early.

Perl is Perl. One problem with teaching circumscribed languages is that the students then find them lacking in power and tend to extend them in mutually incompatible ways instead of learning new languages. Perl is powerful, and is defined by a freely available open source implementation.

Perl has an established community. It's not good form to ask others to do one's homework and is frowned upon by the community. People are often willing to help, though. Not every language has a place where the authors of the manuals and of the language itself congregate and answer questions from beginners and old hands alike. Perl has several, and that's an advantage for the student.

Perl has several learning books, a language reference book, best practices manual, an OO title, an algorithms title, and a couple of advanced topics books, books on specific domains in the language, and more. All of the typical support literature used to teach a language from novice to expert are available.

There's a lot to be said for using Perl as a teaching language. Perhaps a first language, and perhaps not. Of course, as with any tool designed more for power than safety, there are serious drawbacks to consider. This is particularly true for the novice. However, the use of chisels, saws, rifles, lawnmowers, sledgehammers, knives, and stove tops are often taught very early in their respective disciplines. Bodily injury and death are certainly more important to avoid than programming errors in a batch payroll application for a fictional widget company (one of my first assignments).

I don't believe that having lots of syntax available means that someone cannot be taught a subset of that syntax. No early elementary school student I know speaks or reads in the type of English we are using here. However, they learn the language more as they use it. Mastery of vocabulary and grammar outside one's daily usage is not expected of a small child or of an adult just learning a foreign language. Likewise, if a programming language has a subset which can be used to write useful programs, there's nothing wrong with teaching that first and moving on to more ways to say things later.

A kernel language approach is best

My knock is not against Perl as either a first or nth PL. Mostly I just don't think it a good choice for a PL for an introductory course in Comp Sci (though the quality of the first course hinges much more on the quality of the teacher rather than the particular PL used). I don't think of Java, C# or C/C++ as appropriate first languages either - though they are the PL of choice in many a CS department.

No matter which language you use, either you're going to use a subset (like Scheme) or the language is going to be minimal in specification (like Pascal). So, yes, theoretically you could start with a kernel in Perl for the language and then append new constructs onto it as needed when advancing through the curricula. Not knowing Perl well enough, I don't know how successful one could be in chopping it up in manner that represents a logical progression of computation models.

If we restrict ourselves to defining a PL for a first course in Comp Sci, one has to ask what message (concepts) one is trying to convey. Although there are wealth of materials available for learning Perl, I'm not sure that the material is intended as an introductory course to computer science. Material intended to teach a language is much different than material intended to teach a whole field of study.

So it's about the text?

Material intended to teach a language is much different than material intended to teach a whole field of study.

This is perhaps the best statement of why to choose one language over another I have seen. As it happens, it's not about the language at all, but about the text.

There are a handful of programs using Perl as an introductory language. I did not attend one. While Perl itself may not be as suitable as Scheme as a first language, I have no doubt that it is more suitable than the Basic which I was first taught. It may be more suitable than Ada, which is the initial language encountered where I started college.

To quote Zvi Lamm*, an ideological choice is made when:

(1) It is vital to act.
(2) There is more than one way to act.
(3) It is impossible to decide rationally or empirically between the options.
(4) One must therefore choose between the possible courses of action without having all the data needed for decision.

(from Ideologies and Educational Thought, used without permission)

It is impossible for the novice programmer himself to decide rationally or empirically due to lack of data which language would be best to learn first. The instructor or institution must therefore weigh the costs and benefits. However, each person who has experience with multiple languages already has opinions of them. I know of no metric for measuring the progress of students under disparate initial languages comparatively.

I also know of little research into the results of differing orders of presenting concepts in Computer Science or even "just" programming. If these measurements existed, we may find that the most important concepts for a student to understand are not necessarily the best to present first. False models are often usefully replaced by more accurate models in many fields. Likewise, it may turn out that a language which is less regular in syntax is actually easier to digest for a beginner. Context, after all, is very important in natural languages.

Perhaps at this point, the quality of the material and the talent of the instructor are the most important factors? Of course, the talent of the instructor in a classroom style of education is always a large part of a successful program. Perhaps, though, the material is more important than the language used in the course?

Would it be acceptable to use pretty much any language which supports a concept to teach it, if the instructor and the supporting materials present it properly? Or is there something special about the syntax of Scheme (or Pascal, Ada, Modula, Python, Lisp, Haskell, IO...) which makes it genuinely easier to teach or easier to learn?

The types of languages with which one feels most comfortable are in large part determined by the path followed to programming. Let's not kid ourselves here. Most people do not take on a major in Computer Science to become Computer Scientists. They take it to become software developers. Is it so bad to question whether different ends are best served by the same means? If a linguist is interested in computational linguistics, there's a very real possibility that certain theory will come in handy while much else will be largely be little used. If a social scientist wants to develop software to track statistics, the math and indeed the performance needed are much less than a real-time control for a vehicle.

Should an introductory class, which is what most will take for a minor or as an elective, actually be so much about Computer Science as about good development of software? Teaching a student to express thoughts clearly (in code and documentation), to reuse code when it is advantageous, to think through code logically, how to find proper algorithms, and to debug a program may be far more important early topics than recursion, data structures, and how to implement or design new algorithms.

If the goal is to instruct students the bounds of good style, a language which supports only an elegant style of representation may not be ideal. If the goal is to teach someone to use the power of a language when it is available, using a verbose tautological language may be actively contrary to that goal. If the goal is to get students to think about the possibility of alternative implementations, then a completely orthogonal language is surely contrary to the goal.

An electrical engineer will likely believe that an "elegant" language is one written entirely with NAND instructions. A mathematician will likely look for mathematical representation and functional purity. A logician may look at internal consistency, boolean control structures, and orthogonality as the most important traits of a language. A linguist will likely look at the mnemonics of the operators, keywords, and standard library calls before anything else. Many a deadline-driven programmer will tell you that conciseness of code, visual differentiation of syntax which serves different purposes, strong debugging support in the implementation, a large standard library, and good access to additional libraries are the keys to his success. An accountant likely cares as much about the guaranteed precision of numeric representations as anything else.

Considering the differing constituency of the students and their influences, perhaps languages which suit those other than professors of CS are the best introductory languages.

If the text is really more important than the specific language, then perhaps all of this is moot.

(* I initially credited Ehud for this quote. It turns out it's something I read in one of his father's papers. Sorry for my confusion. )

In the spirit of

That's a brilliant writeup

Although it talks methodology, it's very similar to my thoughts and feelings on language selection. It's not the language that matters as much as the people: how they communicate, what concepts are most comfortable to them, and how they can express what they understand about a situation in code will determine their own best language.

Perhaps, then, a language that fits how the professors think is at odds with how the students think? Is the difficulty in teaching new students the fact that students don't "get" what the professors are teaching, or that the professors need to think more like the students?

It should be easier for the professors, who are now well versed in the field but once were not, to relate to the students than vice versa.

Perhaps, then, a language

Perhaps, then, a language that fits how the professors think is at odds with how the students think? Is the difficulty in teaching new students the fact that students don't "get" what the professors are teaching, or that the professors need to think more like the students?

Which is ironic, since the ultimate goal is to teach the students to think more like the professors. :-)

The ultimate goal

The ultimate goal of the program as a whole would definitely teach the students to think like the professors.

It may be that the introduction is a good place to reach the students on common ground, and then expand their thinking towards that of the professors. This is in contrast to trying to make a clean break from what's come before their introductory courses, and setting up a framework for thought separate from anything many of the students have known.

I'm not sure of which is better, but I don't think anyone else is really certain either. I'm not sure there's even an existing language that would successfully do all of these things:

1. allow a layperson (which is what an absolute novice student is) to learn to program more easily
2. still be suitable for teaching the concepts the professors feel need to be taught
3. do so without actively encouraging poor habits of thought and programming

It may be very helpful for such a thing to exist.

Achieving it

Those features are pretty much exactly what underlies the choice of Scheme for books like HtDP. You might be interested to read this TeachScheme, ReachJava! page from the TeachScheme project. It addresses a number of the issues that have been raised in this thread.

The Ultimate Goal

teach the students to think like the professors

No disrespect to any professors here but professors only exist to teach students, so your argument assumes the circular justification of academia that ignores the rest of the world.

Given that most students leave academia to work in industry, perhaps the ultimate goal should use a different measure of success e.g. to teach students how to write useful programs? Note that professors rarely have any experience of writing programs that are used by the rest of society.

Cheers,
Jon.

Other problems

...professors only exist to teach students...

Professors nominally exist to "advance the state of human knowledge", with teaching being a secondary responsibility (it's handy to have those with advanced knowledge pass it on). Granted, some professors seem to focus more on publication counts and making themselves seem important than on either actually advancing human knowledge, or on teaching students. But that's a separate issue.

Given that most students leave academia to work in industry, perhaps the ultimate goal should use a different measure of success...

That raises yet another issue, which is the unfortunate trend towards using CS programmes to train software engineers. Computer science and software engineering are different disciplines, with fundamentally different motivations and goals. David Parnas did a far better job than I could articulating the differences in his paper "Software Engineering Programmes Are Not Computer Science Programmes", so I won't bother repeating his arguments here.

Professors

Professors nominally exist to "advance the state of human knowledge",

No. Researchers (both in industry and in academia) exist to advance knowledge. In most of the world, teaching is a core part of being a professor.

Either way, most of the world's best code does not come from professors (it may come from researchers). So the word "professor" has no place that definition.

Cheers,
Jon.

"Professor"

I think you are using the word "Professor" with diffrent meanings.

Acording to wikipedia:

"The meaning of the word professor .. varies. In most English-speaking countries, it refers to a senior academic who holds a departmental chair, generally as head of the department, or a personal chair awarded specifically to that individual. In some countries like in the United States, Canada and India, individuals often use the term professor as a polite form of address for any teacher, lecturer, or researcher employed by a college or university, regardless of rank. In some countries, e.g. Austria, Romania, Serbia and Italy, the term also applies to high school teachers. (See differences and main systems below for more information.)"

I know that at least in sweden, the title of professor involves something like 70% reaserch and 30% teaching.

70/30 sounds about right for

70/30 sounds about right for US Universities as well, in my experience. Some professors teach more than others, but if they have the money for buyouts, they can teach as little as one or two courses per year. And research impact is, while not the only factor, certainly more important than teaching skills in determining tenure.

Research

Note that professors only exist in teaching institutions and that most research is done in industry and not in academia.

Cheers,
Jon.

I don't know whether to

I don't know whether to laugh or cry...

Language influences Text

The background research for HtDP is about as close as you're likely to get to a methodical treatment of the subject.

About the only thing I can personally add is that based on translating bits of SICP into a bunch of other languages, I can say without a doubt that the text as it was written would not have been written with the same emphasis, examples, or sequence if they had chosen any other language than Scheme. Which is just my way of saying that the Text is the most important thing outside of the teacher - but that text is very much influenced by the foundation of the PL used.

Zvi Lamm is my father.

Zvi Lamm is my father.

perl

I think perl is not flexible at all it is a very specialised language. What is a introduction in programming without drawing something on the screen?? Yes it is boring. You know what language is pretty good at drawing Java yes that is right Java is more fun and more flexible than perl as an introductory language!!! Maybe perl is better at boring ascii files.

Please insult languages only on facts, please

Perl has libraries for Tk, OpenGL, SDL, wxWidgets, curses, Glade, Gnome, gtk, gtk2, Qt, and Etk for example. These are all graphics, menu, or otherwise UI libraries other than "boring ascii files".

Perl also has libraries for ImageMagick, GD, and rrdtool support. It has libraries for SVG support.

Perl is used for log monitoring and CGI programs, yes. It's also used for bioinformatics, network server software, virus scanning, artificial intelligence, automation, database front-ends, audio, games, e-commerce, network administration, tying together other languages, and tying together software written in other languages. It's a fully working general-purpose language with lots of freely redistributable libraries which are easy to find.

Perl may have its demons. People don't like the syntax. They think there's too much syntax. They think the syntax is too sloppy. The Perl community takes some some small liberties with CS vocabulary in a few areas. It's easy to use Perl to shoot yourself in the foot, or to strangle yourself with spaghetti code. The partly compiled, partly interpreted mode of operation can get confusing. The interpreter is a mess of updated implementation and is difficult to modify.

Please, pick any three of the above to complain about. But please, please, please do not bash languages based on false representations of them.

How about not insulting

How about not insulting languages at all?

LtU is not for insults (nor language advocacy).

I'm not trying to advocate a language

I am aware that Perl, Javascript, and certain other languages draw the ire of the academic computing crowd for reasons I'm not sure I understand. Lack of elegance or even "general ickiness" may be reasons to dislike or advise against a tool. They are not reasons to make false assertions about them in an effort to discredit their usefulness.

There are obvious drawbacks to a language like Perl, and the trade-offs have often been considered by those using the language. However, I would expect that on LtU the true drawbacks of a language are enough to recommend against it if one is planning to do so.

Perhaps "insult" was a strong word, but that's what was happening. I don't feel I have the authority as a relative outsider on LtU to say "stop that, that's not policy". I believe anyone in such a forum, though, can spot an outright untruth and point it out.

"an outright untruth"

maybe your examples are better reasons for not using perl at all but the context here is an introductory language let me present a random pick of the libraries you mention and look at what you need to do to install them

http://search.cpan.org/dist/Wx/docs/INSTALL.pod#wxPerl_installation

http://gtk2-perl.sourceforge.net/win32/

http://www.melax.com/perl/getit.html

Also I was not that serious. I read pieces of the article of the original poster and I did not take it to serious so that explains my mood when i was reacting.

I don't think installation is much of a concern.

I accidentally replied to the main post just a minute ago. It was meant to be here. I'll summarize by saying that the language, and not the ease of installation of its runtime and libraries, should be the primary focus.

Frequently Unasked Question

"Why do you want to write software?" It's absolutely ridiculous to attempt to answer the question "Which language should I learn first?" without the answer to this.

I disagree.

I disagree. I started learning programming when I was 8 ... do you think I knew the answer "why do I want to write software?"? Of course not, it was just learning for the sake of the fun of learning. The reasons for writing software change, as you grow and mature. The goal of learning a first language is to learn fundamental concepts about programming and be equipped to easily learn new languages, or specialize as needed. Besides, not everyone who learns programming will even end up writing software.

few want to write software

I can relate, but I had also agreed with Paul's sentiment, that, "What do you hope to achieve by your effort?" is a frequently unasked question that can really matter. In your case, if you didn't have a strong motivation to limit what might work for you, you might have enjoyed better results. Goals can be strong blinders to perception, but this goes without notice much of the time.

Folks like you who enjoy learning for the sake of learning might be somewhat rare. Perhaps a more raw and unbiased curiosity streak correlates with high intelligence. A joy in finding out how things work doesn't appeal to everyone (more's the pity). And folks who have it can easily overlook pragmatic goals in others to get a specific unstated but expected payoff.

My own sons are 12 and 15, but I haven't started teaching them to program because I can't think of any good reason to give them why they should, and they need one, despite the fact they're both top percentile in math. If I could demonstrate a relation between coding and the video games they play (which I can't) that would be enough for them. But they simply lack raw curiosity in seeing what happens in text displays, since they've been spoiled by high feedback graphic environments.

Within my mental simulation (imagining a process of selling them on programming), all plausible avenues I consider end in their boredom and disinterest after 20 minutes or so, following by increasing resistance to give me attention later for more tries. (I'm already well familiar with a pattern of avoidance associated with attempting to instil an interest in something that bores them.) I actually seem to be doing best lately by not explaining what I'm doing, since the mystery of that gibberish I'm writing has a little intrigue.

They both want to affect the world in a way that would matter beyond learning an abstract new skill. Here's the motivation I think would work for them: if they could make a thing they enjoyed, and could show a friend and not be ridiculed for pursuing lame triviality, then they might see a purpose in it. The bar of avoiding ridicule from their jaded peers is a rather severe one. If it's not amazing eye candy, and it's just some low impact technical feat, then it had better at least be something no random joe can do just as easily. Just having a blog for example wouldn't do it.

I've been thinking my best bet is making it possible for them to program a server in some way, so they can show friends they've altered the way a system behaves that their friends can also use. If it was feasible for them to be makers, and not just users, then this might give them a path to follow suiting their reward oriented focus. [cf]

Hmm...

Perhaps setup a framework so that they could set up some Internet-borne social program. Say a chatroom, online bulletin board (as in analogy to the physical thing, not BBS) or forum for their friends. I don't know your sons well enough to know what exactly you'd need to add, to make that value-added. Maybe something like a website where they and their friends could upload text and pictures, add comments on each others content etc. An assumption in this line of thought is that having their own exclusive system would appeal to them, otherwise they'd probably respond with, "I can just do that with MySpace."

In general, one way you may want to approach this is to build a basic system and show them how they could extend it. Using the above example, let's say you made a system that would allow users to be made and have them post text. Then demonstrate adding the ability to post pictures (probably a requisite for it to be interesting to them). Then suggest ideas like adding the ability to add comments, or maybe inline music/video, emoticon support, skinning, various features other such systems support, anything you might be interested in. Make sure you only suggest a few of these at any time, and make sure you always add in "or anything you guys would like."

Just some ideas, that you may or may not have thought of.

(sorry this reply is so long)

I did think about all those things, and some others. But in my response here I'll try to get back to the issue that caused me to reply, so I can stay on topic. I was trying to say something about programming languages, and learning them, and goals for application, and the way everyone projects their own goals on others without question. The question of how to inspire my sons to learn programming is more an illustrative problem I see pertaining to the chicken and egg problem of motive and learning. But I appreciate the desire to be helpful with suggestions.

Derek Elkins: Perhaps setup a framework so that they could set up some Internet-borne social program.

Yes to "framework" but no to "social program" since I see the influence of their peers as a drawback to be tolerated and not an end to be cultivated by amplifying the means they have at hand to replace phones and tools like MySpace when they get to them. (It makes me flinch just to think of what I'd have to do to keep a social site from having things appear that would get me and them in trouble.) I wouldn't mind if they wanted a social site, if motivation made them push harder to get through technical stuff they see as just means -- but there's no reason to make it easy.

A week ago I told my older son it was hard to choose the right level to present them with tech info. As an example analogy, I told him I might aim to teach him to build a computer. At one end, I could try to teach him every little suffocating detail about hardware, and of course no substantial headway would occur in reasonable time. Or I could have him call someone on the phone and say "build me a computer with these parts", which would result in a computer being built quickly, but without him having learned anything about doing it himself.

The trick in a framework would be getting the level so he was the creator rather than user at all the levels that explain what causes a system to do something. If his part was mostly "asking to have things done" in some pre-defined slots, this would make him a passive user, which I see as not educational.

So I'd like him to see (eg) content that appears in socket traffic, because seeing all inputs and outputs -- and writing the code that responds to this -- gives the overview I think is essential to making and completely understanding the part that makes the active decisions. But then there's a big jump from that low level to one high level enough to be interesting as a result they can control. It would be best to develop the framework with them, using a language that kept them away from unnecessary detail. But I'd have to present some initial thing as a fait accompli for them to extend, as a starting example they liked but was not too complex to understand.

I've been thinking about semantics of a language plus system that would make it easier to write i/o processing systems at a high level, and it influences what I'd try. Please forgive my not saying anything about it though. I try not to broadcast ideas I have in public anymore, since it doesn't help me get things done, and it increases risk of inspiring others to erect IP roadblocks where I'm going.

(Actually, I've been thinking it's convenient to have code that's incomprehensible to others, so that after it's released, it's that much harder for folks to point at bits and claim any parts relate to IP of others -- eg, if you could see the code was good for solving problems in a domain where there were patents. So I say, good luck figuring that out.)

I need to sum this up (and on the topic I cited in the first paragraph). I think what you want to do with programming skill should influence a language you choose to learn first, since if you learn a language and still can't do your application, then you've been had somehow. So if I want my sons to program, I should teach them a language to do something they want done, where the two go hand in hand. I just don't have the combination of application and language lined up yet. Current applications they might like have tools involving too much stuff for beginners. I wish others already had server projects for rank beginners so I could refactor them to be simpler still.

Is "Why do you want to write software?" the best question?

Is a better question, "What kind of software do you want to write?"?

Perhaps it is, "Which language makes the faculty most efficient at turning these 5,000 freshmen into 4,000 sophomores, and eventually 2,500 graduates, in the CS department?".

"Which language is going to help the majority of students learn the future material most effectively?"?

"Which language gets us into the topic at hand most conveniently?" is a good one, too.

"Which language will raise our placement rate with employers high enough that we can recruit new freshmen more easily?" may be a valid question.

I'm not sure which of these questions is the most important. Surely, for the individual student, it is about their goals.

The faculty have their owns goals, including a numbers game of graduating a certain percentage of students with a certain minimum understanding of the field.

The commercial development employers of course want the students trained in whatever language they already use. This is sometimes even in spite of radical gains of efficiency in new development that could be gained by splitting maintenance and new projects into different languages.

There is probably no right answer to all of these questions. If there were, we'd all be using the same language.

Check out Processing

It would be interesting to try teaching Processing as a first programming language. Here are the relevant features:

1. Graphics! It's optimized for producing animated graphics, and that's what the standard library is meant to do easily. Just look at some of the examples and I'm sure anybody here at LtU could start programming right away. I produced a mildly cool demo about 45 minutes after I first downloaded Processing. And then I wrote this cool thing, which still gives me happy feelings.

2. It has a vaguely familiar syntax. It's very similar to Java, since it mostly is Java with sugar on top and some nice built-in functionality. It gives most of the same advantages of teaching Java, and the knowledge is portable to Java proper.

3. A simple, beginner-friendly IDE. It's everything you'd want for the purpose of letting beginners get right to coding.

The language itself is pretty unremarkable; it is based on Java after all. I would be happier with a fun language like the ones that get discussed on LtU all the time, but the cardinal rule of teaching seems to be that the students are more baffled than you expect, even taking this rule into account. Processing seems to be a very pretty ugly compromise.

Awesome!

Absolutely awesome. This is exactly the kind of thing I was talking about.

Cheers,
Jon.

Previously, on LtU...

Folks who appreciate Processing would probably also appreciate Breve.

I think that scheme is the

I think that scheme is the single best language to learn as an introductory language (as well as a normal use language :P). You can explain the syntax in a matter of moments, and it hides all of the complexities of lower level programming, as well as providing all of the fun things of higher level programming, all in a very simple, uniform and easy to understand way.

I think it does the best job of hiding what you don't want to touch while not getting in the programmers way enough that you can teach and demonstrate the various aspects of PLT easily.

superficial

You don't seem to have any major insights into this topic. That's OK, neither do I; but you don't see me writing "papers" about it and submitting links to them to blogs left and right.

Moreover, the core language is limited and most practical code tends to become very verbose in it. For example, whereas in Perl one would write $myarray[$i]++ to increment an array element by one, in Scheme it would be: (vector-set! myarray i (1+ (vector-ref myarray i))).

You talk as if this was (a) a common thing to do in Scheme code, (b) a clear case of a disadvantage as opposed to a tradeoff.

The most common programming style in Scheme is functional code over recursive datatypes like lists or trees. Incrementing the elements on numerically-indexed arrays is not a very common thing to do.

Arrays are a special, core type in C, C++, Java, Perl, Python, Ruby, and many other languages, special syntax for accessing and mutating their elements. Not so in Scheme, where vectors are just another datatype, and as all datatypes in Scheme, the interface to them consists of plain old functions, following a set of naming conventions. Thus vector-set! and vector-ref follow the same convention as string-set! and string-ref, and when you implement your own datatypes, you follow these conventions. It all follows its own internal, largely consistent stylistic logic.

Also, what makes you think that the verbosity of the Scheme code there is bad? Given the conventions that govern Scheme code, if I didn't know off the top of my head how to use vectors, and I saw that code, I would be able to guess right away what it was doing (and this is not a theoretical example—I program in Scheme almost every day, and I hardly ever use vectors). On the other hand, I have no clue what the dollar signs in $myarray[$i]++.

Brevity and frequency go hand-in-hand: you want frequent stuff to be brief so as to not get in the way of reading and writing the code, and infrequent stuff to not be brief so as to be more readable. And there are already tools to abbreviate common complex tasks: functions and macros. Do you find yourself incrementing the i-th element of a vector all the time in a program? Well, write a function to do it:

(define (vector-increment! v i)
  (vector-set! v i (+1 (vector-ref v i))))

In short, I don't claim to know whether Scheme is a good teaching language, but I can sure tell that some of your objections to it are very superficial. I can also tell that you did not address its strengths at all in your evaluation; e.g., the extensive use of higher-order functions to abstract away usage patterns (e.g. map, fold, filter) that either can't practically be done in the alternatives you consider, or is just in fact not common practice. (The only language in your list that comes close to that is Ruby, which goes a pretty far way, but still falls short.)

Not to be a jackass, but...

You don't seem to have any major insights into this topic. That's OK, neither do I; but you don't see me writing "papers" about it and submitting links to them to blogs left and right.

I haven't even read the essay, but my first reaction to the post was similar to this. Essentially, my first thoughts were, "Who are you that I should care about your 'insights' and 'conclusions'?" This is not to say you shouldn't write about your thoughts and publish them or that they aren't valuable, but unless your name has "street cred" in the community you are presenting them to, you should use a less authoritative approach. Instead of clauses like, "explains why they are right or wrong", something like "reasons I think some are better than others" would be more appropriate. Alternatively, as opposed to "street cred", if you had some objective reason to think your results were authoritative, e.g. a study, then that information should be included as well.

To me it's not even "street

To me it's not even "street cred" that's at stake here. First off, calling something a "paper" connotes a set of scholarly standards that the page he links doesn't even remotely meet.

Second, comparing two or more things fairly requires a degree of understanding of the things being compared that the author clearly lacks. For example, he doesn't show any evidence of knowing Scheme very well. More importantly, he doesn't show any evidence of understanding what the problems are that people who teach programming to beginners face. He's just yet another programmer who's stating his opinion about what language(s) he'd like others to learn.


Can we please stop the ad

Can we please stop the ad hominem discussion and get back to programming languages issues (if there is anything new to say on the subject of introductory courses, which I doubt).

Thanks.

Cover v. Content

I was talking only about how the LtU post was presented; this does not require me reading the "paper", reading the "paper" is completely irrelevant. Furthermore, implicit in what I was saying is that the presentation turned me off from even wanting to read the "paper" (you can call that arrogant if you like.*) Finally, as I said absolutely nothing about teaching, I don't see how I could underestimate it or overestimate what I know about it.

* Now I have read most of it and at least skimmed all of it, and had my perception completely validated. I see absolutely no reason why I "should have read the 'paper'" as I did not address it at all.

I am sorry

http://xkcd.com/c202.html

Superficial?

the extensive use of higher-order functions to abstract away usage patterns (e.g. map, fold, filter) that either can't practically be done in the alternatives you consider, or is just in fact not common practice.(The only language in your list that comes close to that is Ruby, which goes a pretty far way, but still falls short.)

I can tell that some of your objections to e.g. perl are very superficial. Map and filter (aka grep) are extremely common in perl code. Reduce less so, but it's still there. Perl Essentially Resembles Lisp.

Scheme can stand on its own merits, there's no reason to pretend that other languages, even lowly 'scripting' languages, are incapable of HOF.

Not quite there yet

Scheme can stand on its own merits, there's no reason to pretend that other languages, even lowly 'scripting' languages, are incapable of HOF.

Perl's HOF support is good, afaik, but Python and Ruby are still quite challenged in that department. Python has fixed many of the bugs it historically had with closures, but it still restricts the contents of anonymous functions, and Ruby has a lexical scope problem. Also, none of them support tail recursion, which is why they always focus on the shallow applications of HOFs, such as map and filter (as long as map and filter themselves are not implemented recursively).

Also, none of them support

Also, none of them support tail recursion
Not true. Perl has "proper" tail calls, though they are spelled funny and not used very often:
sub foo {
    if ($_[0] < 1e7) {
        @_ = ($_[0] + 1);
        goto &bar;
    }
    $_[0]
}

sub bar {
    if ($_[0] < 1e7) {
        @_ = ($_[0] + 1);
        goto &foo;
    }
    $_[0]
}

Things

Here is an outrageous idea. Can a young person learn programming before they learn something about the "things" they may want to program. Software is always a representation of other things. In the environment of the 21'st century all the things have disappeared into a web of software abstraction, but the things are still there as forms or frameworks. Can young people today see what these things really are without the physical forms? When I grew up there were telegraph sets and teletype machines with paper tape. Later on communications was computerized in steps, gradually untill we reach today's iternet. Where have all the things gone? Can you see them? The software is only an abstraction of these things that have come and gone but live on as forms hidden in a mass of inscrutable code.

Looking at it the other way

Looking at it the other way this could be reason why younger programers are better at working with abstractions, than older ones.

The losing battle for typesetting and visualization

I know I'm about to start fighting a losing battle in this forum but I really believe that graphics are vitally important for a language, particularly for beginners.

I'm really keen on F# right now and my dream is to provide an integrated environment that makes visualization as easy as possible. The language is already great for data dissection thanks to its legacy and interoperability. If F# had the declarative graphical capabilities of tools like Mathematica and Matlab I think it would largely displace them.

The potential is enormous (take a look at Don Syme's channel 9 video) and I so disappointed to see people write "The 'It Should Have a Decent IDE' Fallacy" when a decent IDE is just a baby step towards an integrated technical computing environment with typesetting and visualization.

Does anyone here share my dream?

Cheers,
Jon.

Losing battles

I know I'm about to start fighting a losing battle in this forum [...]

I so disappointed to see people write "The 'It Should Have a Decent IDE' Fallacy"

The quote about the decent IDE fallacy is from an article on someone else's site, and that article has come in for some valid criticism here. Your losing battle lies elsewhere. Search LtU for discussion of e.g. DrScheme if you want to see some perspectives of LtU members on IDEs and graphical tools for beginning (and other) users.

IDEs

In addition to the OP's essay, various comments above (e.g. by Chris Rathman) indicate to me that many people are content with a slightly-better-than-emacs IDE. DrScheme is nice, but it is a world away from the integrated technical computing environments with typesetting and visualization that I was referring to.

Cheers,
Jon.

IDEs

What Chris wrote and what the original article said are two different things, so quoting one and responding to the other is confusing.

An "integrated technical computing environment with typesetting and visualization" sounds like a wonderful thing, but it doesn't seem to have much bearing on the choice of the best introductory programming language right now. Teaching programming to students right now requires that they learn to create and deal with programs in their traditional symbolic form, so I agree with Chris that an "interpretive environment that allows experimentation" is a priority. That's not an argument against IDEs or other kinds of environment, it's a statement of relative importance in the teaching of programming.

Don't love love the REPL

I couldn't disagree more. Having an integrated technical computing environment with typesetting and visualization should be the single most important factor in choosing an introductory programming language right now.

Demanding an "interpretive environment that allows experimentation", while valid, is wildly out of date. It predates GUIs. You might as well demand a QWERTY keyboard. It reaks of monochromatic teletype interaction with a mainframe. Typing with one finger because you have to hold a clipboard whilst awkwardly straightening crazily large glasses.

Why not sex up the teaching a little bit and use something from the 21st century?

Learning Scheme in a REPL is an awful experience compared to learning Mathematica in a notebook.

Cheers,
Jon.

Dreams and vapor

Having an integrated technical computing environment with typesetting and visualization should be the single most important factor in choosing an introductory programming language right now.

So which such environment(s) & language(s) are you recommending? F# with Visual Studio, perhaps? Earlier you wrote "my dream is to provide an integrated environment that makes visualization as easy as possible". I'm not arguing with your dream. The point is that until such an environment is actually available to students, it's moot as a choice factor for an introductory programming language.

Learning Scheme in a REPL is an awful experience compared to learning Mathematica in a notebook.

If the goal is to teach a more general-purpose language than Mathematica, that doesn't help.

Hardwood software

Mathematica, Matlab, R, S-Plus, Maple, MathCAD, MuPad... All awesome compared to the state-of-the-art in the FPL world. All vastly better suited to beginners.

Awesome for what?

For some values of "introductory language", those may be suitable. But if the goal is to teach beginners to program using a general-purpose programming language, starting with one of those environments may be counterproductive. You'd also need to compare their use to that of the various environments that have been designed for teaching programming.

But this is all just underscoring that the appropriate choice depends greatly on what the student is trying to learn, or what the teacher is trying to teach.

Very true

But for what definition of "general purpose"?

How can first-class graphics be "counterproductive"?

I agree that "it depends" but doesn't Mathematica provide strictly more than Scheme, for example?

Cheers,
Jon.

Different axis

Personally, I consider Mathematica to be an application that happens to have an embedded programming language that can be used to extend, restrict, and automate that environment. Being Turing complete, the theory would say that anything that can expressed in any other PL can be programmed. I'm not sure I'd want to use it to write web applications - though I'm sure some enterprising individual has probably done something along those lines at some point in time (on a dare if nothing else).

There is a gray area between computer users and computer programmers. Take calculators - most people just punch in the numbers and the calculator does it magic. Well, in the beginning, much of programming involved little more than number crunching like trajectories. But programming is different than being an end-user. A programmer automates things to make things possible and easier so that others can use the process to accomplish things (the fact that the end user and the programmer may be one and the same person is irrelevant).

At the top of the food chain are those that program for other programmers - programs that help others write programs - also known as programming languages. I find that the further you get up this abstraction pyramid, the less useful visual tools are in the process (still useful for conveying ideas, but not so useful in the actual process to construct processes - i.e. the formal algoritms). For example, it would probably be infeasible to have written the Mathematica package in the PL used in Mathematica (IIRC, they used C).

Ok, so not everyone has the talents of Wolfram - that goes without saying. And there are many more users of Mathematica than were involved in the construction of Mathematica itself. Which is just another way to say that not everyone needs to be writing things from scratch - need a ray-tracer, why study or write one - many already exist. But then that begs the question of why one would use ray-tracers for teaching O'Caml to scientists - very few will make a paycheck writing them from scratch. Most will simply acquire a software package to accomplish their task.

Of course, one could apply the same logic to the material in SICP. Not many people are going to need to write a square root function or a picture language. Indeed, if the code has already been written (which by coincidence is true of most examples that you'll find in an beginner text), then you'll not likely be writing code that does the exact same thing in most professions. So the idea must be to learn a way of thinking - the solution to 2 plus 2 has been known for a long time - but it's still useful knowledge to acquire for those that use numbers.

Parsing, data structures, evaluation, et al are all important concepts for those that seek to automate things for others. They are fundamental building blocks to programming in any language - including Mathematica, R, etc....

There's that misconception again

Mathematica... I'm not sure I'd want to use it to write web applications

Mathematica targetted people writing web applications by providing Mathematica applets (example). So Mathematica is actually fine for writing web applets, unlike many FPLs...

that begs the question of why one would use ray-tracers for teaching O'Caml to scientists

A ray tracer is the ideal example program to teach OCaml to scientists because:

  • it is beautiful
  • it is a numerical algorithm
  • it showcases OCaml's features

Like several other people here, I used to naively believe that people bought books and did courses for the technical content. Then I started trying to sell this stuff. Few people bought it. My family went hungry. That focused my mind. I was forced to learn how to sell stuff and the number one lesson from industry is "sex sells". It doesn't matter if you're trying to sell technical content to technical people, the fact is nobody will care about your work unless you make it interesting, unless you make it captivating, unless you use typesetting, tables, charts, diagrams and even real-time interactive 3D visualization.

Teaching people programming is my business and, were I not good at it, my business would go under. That is in stark contrast with jo-academic here who can discuss GADTs until they go blue in the face because, at the end of the day, there is almost no correspondance between the effectiveness with which they convey information and the grant funding they receive.

Don't get me wrong. Two years ago I was jo-academic. I had never sold a thing. I thought "hey, I'll be a consultant and teach people functional programming using plain-text languages". Boy was I wrong. Teaching is not about the information you present, it is about getting that information into the student's brain as efficiently as possible. And that needs graphics.

Cheers,
Jon.

Mathematica targetted people

Mathematica targetted people writing web applications by providing Mathematica applets (example). So Mathematica is actually fine for writing web applets, unlike many FPLs...

How would it compare to a web framework say like Ruby on Rails or any number of Java web frameworks? Personally I don't think web apps are appropriate for a first course. The contest is not about which one does web apps better. It is about teaching fundamental principles that are applicable to any number of PLs or environments. I don't think teaching RoR is in order - but I do think that the material should be equally applicable to web apps as it is to graphical presentations and a whole slew of other domains.

ray tracer is the ideal example program to teach OCaml to scientists

I'd agree that it can serve as a good example for the purposes of teaching. But then the supposition is whether the majority of programmers will ever actually write ray tracers for a living?

I was forced to learn how to sell stuff and the number one lesson from industry is "sex sells".

The problem with using sex and money in an analogy is that it brings up many images - prostitution and pornography on the more prurient end.

It doesn't matter if you're trying to sell technical content to technical people, the fact is nobody will care about your work unless you make it interesting, unless you make it captivating, unless you use typesetting, tables, charts, diagrams and even real-time interactive 3D visualization.

Agreed that one must pay meticulous attention to these aspects - but I also happen to think that content matters as well. My personal preference at the moment is for the works of Dan Friedman - he's managed to have a high quality product while also selling a lot of books over a long period of time. Perhaps not as many books as he could sell if he decided to write a title along the lines of "The Little Ajax", but then optimizing revenues is not always the number one goal either.
Teaching people programming is my business and, were I not good at it, my business would go under.
Well, programming is my business, and if I were not good at learning... yada yada yada...

That is in stark contrast with jo-academic here who can discuss GADTs until they go blue in the face because...

Not particularly good tact in these parts - such things are against the spirit and guidelines which seek to discourage such overgeneralizations. Personallly I'd counter a "sex sales" quip with an "but ideas change the world". In the specific case of GADTs, it is a hard problem that is trying to be cracked. People like Wadler have shown that ideas about generic programming may arise from the world of academia, but eventually these things do impact the programming world at large.

Don't get me wrong. Two years ago I was jo-academic. I had never sold a thing. I thought "hey, I'll be a consultant and teach people functional programming using plain-text languages". Boy was I wrong. Teaching is not about the information you present, it is about getting that information into the student's brain as efficiently as possible. And that needs graphics.

Nothing wrong with choosing good examples that can make a connection with a target audience, but in the context of the current discussion on first PL's and the PL used for a first course has the same considerations. If it were a matter of connecting with a wider audience, then Perl would have probably more combined appeal than Mathematica, Scheme, Haskell, ML combined (Perl as being a first PL having started this discussion). And Java would go way beyond that.

So do you think Java by virtue of having wider (sex) appeal to the mass of students serves as a good PL for the purposes of an introductory computer science course? Sure we could come up with lots of valid reasons why any other language (Mathematica, Scheme, F#) are better than Java, but if we take the argument at prima facie value, the winner should be the one that the target market finds the most attractive. Of course, if we apply such criteria to comp sci, the next thing you know is that the English Department will decide that in order to appeal to incoming students, Harry Potter will be used instead of Shakespeare.

Captivating the student

How would it compare to a web framework say like Ruby on Rails or any number of Java web frameworks?

I have absolutely no idea (not having used either) but I'd like to know.

Personally I don't think web apps are appropriate for a first course.

Depends what the course is on. Not being able to compile a program written in language X into a standalone executable used to be a strong argument against using or teaching language X. Soon, most GUIs will be web based instead of stand-alone and many PLs will follow.

But then the supposition is whether the majority of programmers will ever actually write ray tracers for a living?

None, of course. If you calculate the derivative of x^3-x-1 on a calculus course, how many of the students will go on to do that for a living? Is it bad to differentiate cubics in an example?

The problem with using sex and money in an analogy is that it brings up many images - prostitution and pornography on the more prurient end.

Ok. Interesting. The words sex and money do not have those connertations for me. Hmm.

Anyway, if you don't make your work interesting or seemingly-relevant, nobody will notice it.

Well, programming is my business, and if I were not good at learning...

Asymmetric. I must also program and learn. An academic need not worry about sales, marketing, revenue, profit margins etc.

That is in stark contrast with jo-academic here...
Not particularly good tact in these parts - such things are against the spirit and guidelines which seek to discourage such overgeneralizations.

My point is certainly not an overgeneralization. Academia provides a vastly more stable livelihood than a small business. There are enormous fundamental differences between the two. I am not saying that one is better. I am saying that it is best to take both into account, to learn from both.

Personallly I'd counter a "sex sales" quip with an "but ideas change the world". In the specific case of GADTs, it is a hard problem that is trying to be cracked...

Absolutely. I am not saying that we should not think about GADTs whilst having sex. I'm saying: if you don't make your meme's attractive, they'll never reproduce.

So do you think Java by virtue of having wider (sex) appeal to the mass of students serves as a good PL for the purposes of an introductory computer science course?

Yes, I do. I think we can do better. I think I can make F# into something better. But Java is fine for now.

If we take the argument at prima facie value, the winner should be the one that the target market finds the most attractive.

No, you should choose the one that is most effective at teaching.

Of course, if we apply such criteria to comp sci, the next thing you know is that the English Department will decide that in order to appeal to incoming students, Harry Potter will be used instead of Shakespeare.

From my point of view, this is like choosing between monochrome and color. William grew up on black and white and is happy without color. Phillipa believes that color is only for mathematicians. I believe everyone can benefit from the widespread adoption of color and, once I've spray painted the place, I'm going to shout about how I did it and sell cans of paint. Body painting is probably the nearest I'll get to sex.

Cheers,
Jon.

Going all the way

The problem with using sex and money in an analogy is that it brings up many images - prostitution and pornography on the more prurient end.

Ok. Interesting. The words sex and money do not have those connertations for me. Hmm.

You seem to be missing a rather obvious connection. Prostitution = sex for money; Pornography = sexually explicit media, often exchanged for money.

This brings up the question, why bother with something as boring as a CAS like Mathematica, or mathematical & scientific graphics? Shouldn't programming be taught using, say, a scriptable version of a game like Grand Theft Auto, so that students can work with (virtual) sex and money directly in their exercises and projects?

Anyway, if you don't make your work interesting or seemingly-relevant, nobody will notice it.

The "seemingly" qualifier is refreshingly honest, and reminds me of another recent LtU forum post. But wouldn't it be better to make the work actually relevant, and sell that fact?

NANDoom

Heh. That reminds me of an idea I had a while back. My friend Dennis had come up with a goofy Doom based process management tool. It mapped your processes to monsters in Doom, where shooting them would renice the the corresponding process and killing one would kill the corresponding process. It was fun to get the monsters to attack each other and watch the processes on your machine randomly shut down.

Anyway, I started wondering about Doom based computation and mapping circuits to dungeons and inputs to monsters and see if a universal Doom gate could be built. But then I went out for pizza and never really though about it again.

It mapped your processes to

It mapped your processes to monsters in Doom

Everyone that I know of loved that idea. Us having heard about it betrays the fact that it is a sexy idea. Not practicable, perhaps, but certainly food for thought.

Cheers,
Jon.

This doesn't half get

This doesn't half get political, no? I've used sexual analogies to "sell" ideas in computing before, but generally there's been slightly more commonality involved than just "hey, I can make a smutty pun here!".

In fact, I think I can break them down into two groups:

1) Describing some kind of pleasurable interaction or working relationship. That'd be the running theme of the article I wrote for The Monad.Reader about type-level hackery.

2) Dealing with the perverse! I don't think you can really get to be a good hacker without a sense for it - pushing the boundaries of what can be done often requires a taste for doing things that really aren't "supposed" to do that.

But that kind of thing isn't really what's meant in "sex sells" normally - it'd be a far more pleasant concept otherwise.

Sex

You seem to be missing a rather obvious connection. Prostitution = sex for money; Pornography = sexually explicit media, often exchanged for money

I got the connection but I personally don't think of prostitutes when I hear sex or pornography when I hear money. For me, there is a stronger connection to love, family and marriage. Apparently this makes me some kind of wierd curiosity on LtU, like an albino nubian.

This brings up the question, why bother with something as boring as a CAS like Mathematica, or mathematical & scientific graphics? Shouldn't programming be taught using, say, a scriptable version of a game like Grand Theft Auto, so that students can work with (virtual) sex and money directly in their exercises and projects?

We can certainly learn from the success of that games series because it is very popular among the student population. That doesn't mean we should get students implementing electronic prostitutes though.

But wouldn't it be better to make the work actually relevant, and sell that fact?

Exactly. You said "sell", and that means "make it appear relevant" and "tell people about it". You must sell ideas because their relevance is not likely to be obvious.

I spent half of my PhD improving wavelet-based time-frequency analysis. Then I commercialized it as a product. The product did not sell. Why?

Precisely because I had then the view then that you guys have now (no, not the one about prostitutes, the other one). I thought that my great idea would sell itself, after all it is obviously relevant for many people.

That is completely wrong. Not only do most people doing signal analysis not know about the entire subject area of time-frequency analysis, they do not appreciate the benefits of wavelets or the importance and relevance of the uncertainty principle.

My idea was relevant, but to sell it I must make it seem relevant. And those are two very different things.

Cheers,
Jon.

Misattributing beliefs is

Misattributing beliefs is enough of a no-no here when you spell the person in question's name correctly!

Now, if you want to go into details? I don't think typesetting is a big deal until it comes to presentation time, and what typeset haskell code I've read certainly hasn't been how I'd want code display on screen while it's being edited - it's nice to have, but mostly I want it by way of code-to-TeX convertors. Do I have uses for visualisation tools? Sure, but I don't need them in my IDE and I also want full-blown GUI tools so that I can build visual editors quickly. What I largely don't care about are graphing tools - if someone wants to write the lib that's fine, but if your visualisation centres around graphs I don't care about your product.

So I want some of what you're talking about, but not in the form you propose and not modelled on a tool that's still primarily *aimed* at mathematicians - my working tradition is different, and some of that's for a reason (notation!). My ideal working environment for now looks suspiciously like a REPL for a sufficiently reflective language with a GUI lib attached, and one of these days I'll get round to spending some serious time with something in the Smalltalk tradition as a result.

Some of what I'm asking for here is significantly more powerful than just graphics, perhaps that might be food for thought?

I'm so sorry

Misattributing beliefs is enough of a no-no here when you spell the person in question's name correctly!

I cannot apologise enough. You may call me "John".

I don't think typesetting is a big deal until it comes to presentation time,

When you are secretly coding in your bedroom on some shameful project, do you inline everything and not indent properly, deferring those tasks until someone looks at the code?

Perhaps I am unusual, but I obsess about appearance, even in my bedroom.

and what typeset haskell code I've read certainly hasn't been how I'd want code display on screen while it's being edited - it's nice to have, but mostly I want it by way of code-to-TeX convertors.

Do you like color syntax highlighting and automatic code indentation?

Do I have uses for visualisation tools? Sure, but I don't need them in my IDE

Strictly, I want to see them in the stdlib of the language and not in the IDE. Although things (e.g. execution path visualization) can be great in an IDE.

and I also want full-blown GUI tools so that I can build visual editors quickly.

Can you elaborate on this? Do you mean something like Windows Forms or something else?

What I largely don't care about are graphing tools - if someone wants to write the lib that's fine, but if your visualisation centres around graphs I don't care about your product.

My product currently centers around triangles but, hey, its in development. ;-)

I am just as interested in network visualization, for example.

So I want some of what you're talking about, but not in the form you propose and not modelled on a tool that's still primarily *aimed* at mathematicians - my working tradition is different, and some of that's for a reason (notation!). My ideal working environment for now looks suspiciously like a REPL for a sufficiently reflective language with a GUI lib attached, and one of these days I'll get round to spending some serious time with something in the Smalltalk tradition as a result.

F# already has a reflection, a REPL and GUI libs attached. I have yet to use the GUI libs extensively but they look great.

Some of what I'm asking for here is significantly more powerful than just graphics, perhaps that might be food for thought?

Absolutely.

If I might share my dream: I want typeset mathematics (LaTeX/MathML), 2D vector graphics and 3D scenegraph-based visualization. I want it declarative and as purely functional as possible.

When the F# REPL sees a value that represents typeset mathematics, 2D vector graphics or a 3D scene, I want it to transparently spawn a visualization of the value. I want throwback from the visualization back to F#, e.g. so you can edit a call graph or a mathematical expression visually.

I want everything hardware accelerated so you can fly around documents and do sophisticated visualizations without having to worry about performance.

So far, everything except throwback is working in OCaml and typesetting isn't up and running in F# yet. My God is it beautiful. I wish you could see what I see.

I would say "coming soon" but I am concerned about the reaction that might evoke from Chris or Anton.

Cheers,
Jon.

Mathematica in Mathematica

In general I agree with what you're saying, but:

For example, it would probably be infeasible to have written the Mathematica package in the PL used in Mathematica (IIRC, they used C).

Only a very small core of Mathematica is written in C, the very vast majority of Mathematica (as in 90% to 95%) is written in Mathematica. Yes it has a lot of functionality designed for CAS purposes, but it does actually have a fairly decent amount of general purpose programming functionality -- it just doesn't tend to be highlighted quite so much when you are just doing CAS work.

Only a very small core of

Only a very small core of Mathematica is written in C, the very vast majority of Mathematica (as in 90% to 95%) is written in Mathematica

Its source code is written in a combination of C and Mathematica, and for Version 5, the code for the kernel consists of about 1.5 million lines of C and 150k lines of Mathematica - The Mathematica Book, by Stephen Wolfram.

You can write a decent kernel implementation in 2kLOC of OCaml.

Cheers,
Jon.

Is more strictly better than less?

But for what definition of "general purpose"?

Potentially anything where the need would arise to switch away from the CAS due to it not being appropriate to the tasks the students need to tackle.

How can first-class graphics be "counterproductive"?

That's an easy one: they could distract the student from what they're actually supposed to be learning. "Captivating" isn't necessarily always good. But what I was originally getting at was that the semantic characteristics of the language may not be appropriate, depending on how learning will progress after the CAS.

I agree that "it depends" but doesn't Mathematica provide strictly more than Scheme, for example?

"More" implies quantity of something, but it's semantic quality that I'm suggesting can be an issue. In some quite successful approaches to teaching programming, less is certainly more: "more" can distract from the core principles that are being taught.

What?

So your more precise definition of "general purpose" is "potentially anything"? Come on. Name something that you want to do in teaching computer science that you can't do in Mathematica?

Cheers,
Jon.

Specific is the new general

So your more precise definition of "general purpose" is "potentially anything"?

That's certainly a pretty good definition of "general purpose" (which can also be defined as "not limited in use or function"), but for the "more precise definition", you should have avoided truncating my original statement.

Name something that you want to do in teaching computer science that you can't do in Mathematica?

Strict evaluation, static type systems, type inference, higher-order modules. (You might be able to fake the latter, but I doubt that it would provide a good basis for instruction.)

In any case, I haven't said that CAS languages wouldn't be suitable for any introductory teaching of programming. They're presumably very suitable for teaching people who plan to go on to do mathematical or scientific programming work, for example. They're less likely to be suitable for someone who's planning to go on to develop typical IT apps in Java or C#. I personally wouldn't use them as a first language to teach core PL semantic concepts, either: they tend to have too much arbitrary syntactic and semantic quirkiness.

Some of Mathematica's features might make for an interesting case study later in a course. However, its cost tends to be an inhibiting factor, even with academic pricing, and the essential semantic features of its language can be found in quite a few other "free" languages. Given that, it's not clear what positive factors exist to favor the choice of Mathematica or any other commercial CAS, except when teaching people who need to learn the CAS in question. You've mentioned graphics as such a factor, but many of the other teaching environments for programming also emphasize graphics, for the same sorts of reasons.

"General purpose"

Let's start with some proposed "general purpose" programming languages: C++, Java, C#, Python, Lisp, Scheme, SML, OCaml, F# and Haskell and rule them out as we go...

Strict evaluation

C++, Java, C#, Python, Lisp, Scheme, SML, OCaml, F#

static type systems

C++, Java, C#, SML, OCaml, F#

type inference

C++, C#, SML, OCaml, F#

higher-order modules

SML, OCaml

Your list of "general purpose" languages grows thin.

Cheers,
Jon.

type inference C++,


type inference

C++, C#, SML, OCaml, F#

My toenails start to curl when people say C++ has type inference.

Credence

I was only trying to give Anton's argument as much chance of being correct as possible.

From my point of view, clarifying "Mathematica is no good because it is not general purpose" with "it doesn't have higher-order modules" stinks every bit as much as implying that C++ has type inference.

Cheers,
Jon.

He did no such thing, he

He did no such thing, he answered "Name something that you want to do in teaching computer science that you can't do in Mathematica?". If something stinks here, it's the rhetorical trickery.

Think of the students

Mathematica, Matlab, R, S-Plus, Maple, MathCAD, MuPad... All awesome compared to the state-of-the-art in the FPL world. All vastly better suited to beginners.

Here's a blog post about Teaching Mathematica as First Programming Language, by someone with some experience in that area. Although a bit of a rant, it also goes into some detail. I'm convinced. ;)

canonisation, motivation, infantilisation

I'm a little curious if anyone of the PL teachers here doesn't favour a paternalistic educational model? I avoided programming completely and found it not worth spending my time unless I wanted to solve some algorithmic ( or meta-algorithmic ) problems. Mathematica was quite adequate and accessible for solving them. The development environment was decent. So my primary motivation to learn programming had nothing to do with programming languages themselves. They were a means and a medium. At the time I started to use them I didn't care for learning languages for sake of learning languages. That would have felt like intellectual masturbation and I already had enough of it during my mathematical studies. I have no idea what could have seduced me to learn Scheme.

Teachers, as we know them today, are mostly the product of medieval canonisation of teaching material and the mass school of the industrial age that is dated back no further than the 19th century. The idea that students have to be motivated by all kinds of gimmicks and teachers ( but also parents ) have to be a paradoxal crossover of entertainers and supervisors is even more recent and I don't believe we find much of its propaganda before the 80's of the last century. This evolution indicates a crisis. When someone has to be activated / motivated the cause is already lost - not at least because people are basically active / alife and can't therefore be activated. Usually this kind of discourse ends up in one of compensation. Frank Furedo is also correct in talking about "infantilisation" here. But his elitist counter-ideal is also brittle and might end up in academic irrelevance and snobism. However being a snob might be at least a personal ideal and should therefore be considered seriously...

What lies beneath

This evolution indicates a crisis.

Indeed. Up until now, we've been able to mass-produce education in the subjects needed to run our societies, sufficient to meet our self-imposed needs. But the most important subjects have become too complicated and specialized to easily do this. Educating a large enough proportion of students to the level that is assumed to be required for continued progress-as-we-know-it is turning out to be a serious challenge. Hence the perceived need to motivate, via any and all means.

Underlying this is the dark fear that if we don't keep moving forward, we will suffocate, like a shark that stops swimming. Snapping at our heels[*] is the spectre of a descent into irrationality: widespread rejection of hard-won scientific achievements (evolution vs. "intelligent design"), or perhaps just a slow decline into the endless production and consumption of increasingly banal entertainment, ranging from TV reality shows to blog discussions about our imminent decline and fall.

It's almost enough to drive one to seek refuge in the comforting narrowness of a technical discipline, such as programming languages!
[*] so much for the shark metaphor[**].
[**] although one might question whether this thread has jumped one.

Incest

So my primary motivation to learn programming had nothing to do with programming languages themselves.

Yes. I think the incestuous nature of your typical