Thursday, January 05, 2017

Profs: you should use JavaScript to teach Computer Science

Universities struggle with the canonical programming language they should teach students for Computer Science. Ideally, as they take computer science classes, all the homework assignments and examples will be in the same language. Today, that language is usually Java or Python. It should be JavaScript.

The reason for this is simple: whatever language you learn, you will also have to learn JavaScript, because it's the lingua franca of web browsers.

Python is a fundamentally broken language. Version 3 is incompatible with version 2, but after a decade, version 2 is still more popular. It's still unforgivably slow: other languages use JITs as a matter of course to get near native speed, while Python is still nearly always interpreted. Python isn't used in the real world, it's far down the list of languages programmers will use professionally. Python is primarily a middlware language, with neither apps nor services written in it.

Java is a fine language, but there's a problem with it: it's fundamentally controlled by a single company, Oracle, who is an evil company. Consumer versions of Java come with viruses. They sue those who try to come up with competing versions of Java. It's not an "open" system necessary for universities.

JavaScript has none of these problems. It's an open standard with many competing versions, two of which are completely open-source. New versions of the language are backwards compatible, but everyone stays closely up to date with the latest version anyway. It's extremely fast, as browsers vendors compete among themselves for the fastest JavaScript engine. It's used professionally everywhere, from writing phone apps to writing network services. And as mentioned above, everyone has to learn it eventually, because it's the language of web browsers.

It's a great "software engineering" language. Most IDEs support it, but especially Microsoft's "Visual Code", which provides the same IDE for Windows, Mac, and Linux for editing and debugging JavaScript. A cross-platform IDE that works the same for all students, regardless of desktop, is an enormous plus. All the other "software engineering" features work well with JavaScript as well, such as professional requirements of version control, bug tracking, and unit/regression testing.

It's an adequate "computer science" language. It supports all the major paradigms, like object-oriented and functional programming. It's perfect for teaching algorithms, data structures, complexity, boolean logic, number theory, Like most programming languages, it's got great library support for things like graphics, machine learning, robotics, cryptography, networking, databases, and so on.

One weakness is that it's not "multithreaded", but that's pretty much a weakness in every language except maybe Erlang. Even in C, people are taught to do it wrong (mutexes) instead of the right way (scalable).

JavaScript certainly has some quirks, but those are a feature for education, not a fault. Educators should go into a deep-dive with JavaScript explaining how it differs from other programming language. Explain how JavaScript pointers differ from C pointers, how object-oriented features differ from Java/C++, how functional features differ from LISP. A deep dive into things like AsmJS and JITs will teach you a lot about all languages.

It's not adequate to teach all computer science concepts, of course. If you are teaching scientific computing, then things like MATLAB and R will be better -- but those languages are impractical for other computer science topics.


In short, unlike any other language, everyone eventually has to learn JavaScript, in order to work within the browser. Given that, then we might as well use it as a pedagogical language. For most computer science topics, it's as least as good as any other language, like C, Java, or Python.

13 comments:

Dan said...

Not to start a flamewar, but what religion do you think is best?

Romilda Gareth said...

Thanks

fasfasd2 said...

Javascript is not a standard.

Ldom said...

As much as I agree about JS being a fine language for education, you don't know what you're talking about regarding Python, or even the other languages.

Marshal Mick said...

rtert43

David Yates said...

James Hague also argues for this in this post: http://prog21.dadgum.com/203.html He makes the additional point that JavaScript is a great language for people to actually easily get into developing the sorts of things they want to make and can easily share with others.

Robert Sander said...

I have studied computer science 16 years ago.

Let me tell you: You do not learn a specific language in computer science, you learn concepts like OOP or functional programming. Sometimes there are (academic) languages that are used for the practical tutorials, but that's it.

When you have grasped the concepts you can start implementing algorithms in nearly any language after a short while. But computer scientists do not program the whole day.

On the other side there are software engineers that do program and are specialized in the language they habe learned some day.

Yeezus said...

Lol no types

Troy Flores said...

Have you always had a secret hankering to hunch over PC peripherals while performing complex calculations to your heart's content? Do you yearn to discern how to convert complicated computations into solid solutions for concrete problems? See more computer science assignment help

Ignas Brašiškis said...

Into garbage it goes. This blog post that is.

Bcs Technology Limited said...

If colleges are going to properly teach would-be computer scientists, start them on assembly language. If one truly understands assembly language then they will understand all languages.

As for Javascript, calling that mess a language is an insult to real programming languages, such as FORTRAN and C.

Aris Adamantiadis said...

I still can't decide if this is a satirical blog or if you truly believe the shit you write.

Olivia Edrick said...
This comment has been removed by the author.