I was catching up with the team at Stuy the other day and they mentioned that they were periodically getting pushback on their choice of languages, particularly in the intro class. The pushback was mostly in the form of "why don't you start them with Javascript?"

Back in the day, when I created our intro class where we use Scheme, NetLogo and then later Python, I'd get similar pushback but then it was "why not Java?", "why not C?", or "whu not C++?"

We had a good discussion on this and I shared my thoughts as to why I don't like Javascript as a first language and I thought I'd share some of them here. I'll try to get around to the rationale behind Scheme and NetLogo in a later post.

To start, let me say that I Love Javascript - particularly when approaching it as a functional language. I also think every school and situation is different so there are likely times when Javascript is the right beginner language for the job.

Let's dive in.

Why are some of the pluses for Javascript as an intro language.

Ubiquity and availability:

If you have a browser, you have Javascript - it's also available through online IDEs and online lightweight sites like JSFiddle.

Interactivity:

You can tweak websites almost live, use the HTML5 canvas pretty interactively and mode

It's mainstream

It's quick to get up and running

This is all true, but there are also downsides.

One of my big problems with Javascript is the lack of simple solid educational tooling. I love to use tools like DrJava, DrPython, and Racket (formerly DrScheme) with beginners. All simple learning IDEs. True, you can use a simple online IDE but I haven't found them to have as strong a learning interface. They also, generally, keep you in an oversimplified programming sandbox. There's no clean transition from the sandbox to the real deal - particularly given the non-trivial state of js build tools and environments. These simple learning IDEs set the stage and then we can transition to more powerful development environments.

I also prefer, where possible, to have kids learn locally so that they can learn something about the underlying operating system even if only at a user level.

A problem relating to the lack of tooling is the fact that a JS program can fail to run and not give you any meaningful feedback at all - this is a problem for a beginner.

Javascript also has all sorts of wonkiness. We have = , and == which is pretty conventional, but then there's also === . We have potentially confusing scoping issues and also some other real weirdness:

For more, check out the this video. Start watching at about 1:20 - it's a riot.

All of this weirdness actually makes sense - just not to a beginner.

Javascript also gives plenty of freedom - there are many ways to do things. This can be great for the developer but not necessarily ideal for the learner. Loops, recursion, mapping functions - you name it, Javascript's got it. I like simpler languages for beginners because it's easier to get them thinking and problem solving in certain ways when there tool set is somewhat restricted (more on that when I write about Scheme).

Finally, the fact that Javascript's a mainstream language can be a minus. Given its popularity, a beginner class could have at least a few kid who've at least played with the language. This can lead them to think they know more than they do and more importantly, this can be intimidating to the real newbies who develop the impression that "everyone knows this but me." A less mainstream language puts everyone on a level playing field.

Let me say again that I love javascript as a language and before a student graduates Stuy they can learn all about Javascript, front end development, some functional programming, and more. It's just not the right language to start with - at least not at Stuy.