JavaScript is a language that misses a lot of important CS and the most important of all is language build in modules.
Apart from that you should start with either a fully functional language or a fully imperative OO language. These are theoratical distinct language classes. And JavaScript is in the middle, you will confuse people.
At my university they started with Java.. also not the best choice. However OOP is very important and just neglecting that initially is not a good idea.
From a theoretical point of view, javascript is not the best language to start with. In fact as a language, its quite inferior to other function-imperative language such as Python.
If your argument is that Javascript isn't object oriented, you don't know Javascript. It is very much object oriented, it just uses prototypical rather than classical inheritance.
If your argument is that a choice should be made between teaching objects and teaching functional programming, I disagree completely. They are complimentary models of programming that are not in conflict. See the paper "Open, extensible object models" [1] for an example of how the object/lambda combination can be extremely powerful. Considering that, JS lambdas are far more powerful than those in Python (they can have multiple lines, for one).
Javascript certainly has design flaws, but it seems like a great fit for teaching programming, in that it is a small language that covers a large number of important programming language concepts.
JavaScript has prototypical inheritance yes. But if you want to start OO with a prototypical implementation you make it even more difficult for students. Doing proper inheritance, interfaces is more difficult with prototypical inheritance than with "normal" OO. I have too agree some libs make it easier. But that fact that JS needs these libs in the first place is a proof of the fact that prototypical inheritance is not easy to work with.
I was talking about functional vs imperative programming. They are not in conflict. But there is a theoretical difference between both of them. And CS is initially about theory in my opinion. Learning turing-completeness, lambada-calculus and logic is more important. Thats why pure language are better at university.
About JS lambdas and python... thats just plainly not true. and btw: JS doesnt even have list comprehension!
Your last point: JS has a lot of concepts. And that is the main reason NOT to use it, as it will confuse students. But i agree, this point is debatable. It just doesnt feel right.
I would disagree in this case. The mere fact that a JS engine is present in any browser alone makes it compelling for those that have never programmed before. There really is no setup, and the OS becomes (to a degree) irrelevant. Further, javascript is an easy language to prototype in, and, at the basic level, easy enough to teach and write.
Except for creating an HTML-file and understanding how all that works.
> and the OS becomes (to a degree) irrelevant.
This is pretty much true for any language as long as you don't use platform-specific features (fork).
> Further, javascript is an easy language to prototype in, and, at the basic level, easy enough to teach and write.
"Easy language to prototype in"? Both Python and Ruby are equally "easy", but comes with even more batteries included. They also have a consistent object model, as opposed to JavaScript's prototype-inheritance-is-cool-but-let's-mix-in-constructors-from-classical-OOP. There's pretty much nothing like JavaScript's prototypes in any other languages (Self/Io works quite differently), and I don't really see any gain in teaching that to students early on.
My comparison on setup was mostly in comparison to the effort in setting up a toolchain or an interpreter, in a situation like this where you have to support users on different OSes/hardware without spending valuable teaching time on it.
I do have to agree with you about the ugly mix of inheritance models, but for the initial teaching phase, you could largely ignore that before moving on to a different language to teach either true OOP or functional programming.
>Except for creating an HTML-file and understanding how all that works.
Using chrome? Hit [ctrl+shift+j|cmd+option+j] and you can write JavaScript without any HTML necessary. Other browsers have similar consoles that need no HTML to write JavaScript.
Completely disagree - I write most of my production code in a REPL (either JavaScript or Python), and only save it to a file once I know it's going to work.
I'm not against using REPL, but it's not viable to solely write in REPLs, therefore we need to teach "how to run things in files" and then we're back at crappy HTML-files.
I don't see anybody saying one need to use REPLs only. What's nice with JS is you have the option to open browser's JS console and try stuff there. You don't need to. But you can.
All modern browsers has JS console. That's dev environment setup freely for you. And if you use FF, enhancing that env with Firebug is just a few clicks away. WIth the rise of web apps nowadays, this is actually a very good move.
I disagree. The obvious benefits of Javascript in the browser are that it is distributed universally, can be deployed to others easily, and has a reasonably powerful API (but not powerful enough to shoot your foot). I think the ease of applying the code to real projects can provide an extra amount of motivation to a lot of people who may have no interest in learning either some toy playground or the console.
Remember, the introductory programming class is all about teaching students to talk to their computers in a methoidcal, step-by-step fashion. It's not about the finer points of language design.
> The obvious benefits of Javascript in the browser are that it is distributed universally
Pretty much any open-source language is available on all platforms. Besides, you still need to setup an editor, so it's not like you can skip the whole "install software"-step.
> can be deployed to others easily
In the beginning this doesn't actually matter too much. Beginners are usually aware that they're not creating something that all their friends are going to use, and it's often better to show it to them face-to-face so you can explain things. Sharing code with other students on the other hand is very useful, but JavaScript isn't any different here ("look at my .html" vs "look at my .py").
> a reasonably powerful API (but not powerful enough to shoot your foot)
JavaScript has few built-in libraries, and the DOM API is very HTML-specific and a horrible mess. I don't quite see how these APIs make the students become better programmers; just understand the quirks of HTML more detailed.
1. I'm a little confused why you would object to JavaScript as a first language. You're using it to teach very basic concepts like variables and conditionals. Who cares about polymorphism at that stage?
2. Creating a Web App to follow programming concepts is something John Resig knows how to do. Check out his Advanced JavaScript page for examples:
3. No installation needed. No one has to have permissions to install or modify software or the OS. That's a huge hurdle. If you're at a public library or borrowing your brother's computer, you don't have to worry about permissions, settings, downloads, etc. You're already setup to start with just learning.
Obviously, to become a better programmer you have to learn some more languages, but JavaScript is not going anywhere anytime soon. In fact, there is a higher demand for JavaScript programmers than ever. Why not learn it?
From a theoretical point of view what matters is engaged students and inspiring teachers. I would absolutely love to have a talented and passionate teacher, working with a energetic students who love exploring what is possible.
Another thing that is important is that it is simple to get quick feedback without time wasting compilation and re-running.
You can do amazing things with JavaScript, and some of them you won't do in Python.
I agree that modules are important.
They are so important I don't think that entirely built in module systems are good enough.
You need to be able to bind to private modules, and load and unload modules like OSGI. You need to be able to configure and have multiple instances of modules, like with Spring.
It is remarkably natural and simple to create really powerful module constructs in JavaScript.
It is really easy to implement a good OO design in JavaScript.
I find Python really nice too. Haskell is interesting.
I am sure Java is worse than C# in many ways, and better in very few, but even Java has some things I miss.
I think the opposite is true--you should start out with as multi-paradigm language as possible, to cover the paradigms in one setting. (If I didn't think this, I would suggest Haskell!)
This is why I think Scheme is a great language to start with: it is both a good imperative and a good functional programming language (and it's easy to reuse the syntax for a logical programming language too!). On top of this, it is much simpler than JavaScript or Python--you can learn the syntax in one or two sessions.
Coincidentally, Python may be a fine imperative language, but its support for functional programming is pretty pathetic.
As someone with a traditional CS background who's learning JavaScript & HTML5 right now, I have to agree that learning JS in the context of a web browser feels like a poor choice for beginners. There are way too many gotchas, hangups, incompatibilities, etc. with browsers and a big domain of knowledge to learn with the DOM.
That said, I think if you teach JS in the context of Node.js with liberal use of quality npm packages like mocha for unit testing, etc. it could be a fantastic environment for beginners and ease a lot of frustration. Just having a REPL is reason enough to use Node for beginners.
JavaScript is a language that misses a lot of important CS and the most important of all is language build in modules.
Apart from that you should start with either a fully functional language or a fully imperative OO language. These are theoratical distinct language classes. And JavaScript is in the middle, you will confuse people.
At my university they started with Java.. also not the best choice. However OOP is very important and just neglecting that initially is not a good idea.
From a theoretical point of view, javascript is not the best language to start with. In fact as a language, its quite inferior to other function-imperative language such as Python.