6 ms·
It's unfortunate how despised JavaScript is on Hacker News, because JavaScript is objectively the best language suited for teaching people to program. Want to
by ralusek 9y ago
It's unfortunate how despised JavaScript is on Hacker News, because JavaScript is objectively the best language suited for teaching people to program.
Want to work with data from any API? Well JSON, industry standard data protocol, happens to already use exactly the syntax you're familiar with!
Want to give them a sandbox to mess around in...take your pick between jsfiddle, plnkr, codesandbox, etc. Many of these let you collaborate realtime with people to help them work through problems directly. Most people learning to program have 0 familiarity with using a terminal, and having to go through the process of getting an environment set up correctly ALONE is enough to turn off the vast majority of people to programming.
As the author already mentioned, rendering a UI in JS is going to happen on the most ubiquitous platform on the planet: the web browser. If a programmer starting today goes into UI work, the odds are that they'll be building UIs for a web browser is astronomically high, the odds that they'll be using a one-off python toy library is highly unlikely.
And last but not least, the syntax of JavaScript is very much like the syntax for Java and C. Learning JavaScript first makes it very easy to read code from other mainstream languages and have a good idea of what's going on. Particularly with ES6, there is very little to complain about in the syntax of JavaScript.
- minimaxir 9y agoThere’s a difference between “teaching people to program” and “teaching people to program apps.” Sure, JS is the hip language for making SPAs, but not the best way to show what boolean logic is and the difference between for and while loops.
- spraak 9y agoWhy can't you reach someone those things in JS? JS has all of what you mention...
- catnaroek 9y agoUsing JavaScript to teach the design of appropriate data structures and algorithms for a computational problem is bound to be an uphill battle. And anyone who seriously considers teaching a first language that students can't use in a data structures and algorithms course (without having to learn a second language) isn't worth paying much attention to.
- iovrthoughtthis 9y agoWhy can't you use javascript in a data structure and algorithms course?
- catnaroek 9y agoYou can, but it won't be as pleasant as using something more appropriate. Proofs are a big part of any decent data structures and algorithms course. So you want a language that makes it possible for students to prove things about programs written in it, without hand-waving away large parts of its semantics.
- iovrthoughtthis 9y agoWhat makes one language or another "more appropriate"?
- catnaroek 9y agoSorry, I edited my previous comment to clarify what I mean by “more appropriate”.
- iovrthoughtthis 9y ago> Proofs are a big part of any decent data structures and algorithms course. There is no need for anything more than a loosely agreed upon pseudo code for for the proofs though, actually many proofs can be made without any code. > So you want a language that makes it possible for students to prove things about programs written in it, without hand-waving away large parts of its semantics You can write proofs in any language. I'm not convinced that using a language that is easy to automatically prove correctness of is useful for learning proofs. If anything it's the perfect opportunity for syntax and semantics to blind the student to the fundamental assumptions and arguments that allow them to understand and write proofs.
- catnaroek 9y ago
- arnarbi 9y ago> [JS is] not the best way to show what boolean logic is and the difference between for and while loops. It's really no worse for that than any commonly used language. Perhaps you meant something else?
- ralusek 9y agoJavaScript the language doesn't have to be used for SPAs, or UIs at all. It...has for and while loops (which btw share syntax with all major programming languages), it has boolean logic and bitwise operators. And I see data structures and algorithms mentioned below...I'm not exactly sure which data structure or algorithm it is that you suspect cannot be expressed in JavaScript?
- valuearb 9y agoThe lack of types is just one thing that disqualifies JavaScript from teaching serious computer science concepts.
- deleted 9y ago[deleted]
- iovrthoughtthis 9y agoJavascript still has types, they just aren't enforced. Why is strict typin required for "serious computer science concepts"?
- hajile 9y agoYou don't hear people say C isn't a serious CS language, but it is about as typed as JS. C is weakly typed and has implicit conversion. JS is weakly typed and has implicit conversion. You most certainly mean static types, but even there we have issues with C because passing void pointers is a thing for generic ADTs. This is even weaker typing than JS offers (and that's without talking about the interactions with function pointers). An even stronger argument against your position on static types is SICP. It's written in scheme, but I have yet to find an introductory book more packed with CS fundamentals. You can read it multiple times and learn new things (very rare for a book to speak to both the experienced and the novice). If static types were really important, Java, all the C's, and most common be CS language would never be used and Standard ML would reign supreme (perhaps it should anyway). Types are simply one weapon in the war between elitism and pragmatism.
- doug1001 9y agoseems Khan Academy agrees with you, and has for some time (~ five years, perhaps more)
- charlysl 9y agoJs quite limited for teaching, no concurrency for instance
- catnaroek 9y agoI'm guessing you mean “no parallelism”, right? Because JavaScript has (admittedly horrible) concurrency support. Otherwise what's this “callback hell” some people complain about?
- falafel 9y agoCallback hell? What is this 2010? Callback hell is a non-issue in modern JS code with promises, and async/await.
- catnaroek 9y agoPromises don't eliminate callback hell any more than objects eliminate their underlying data structures.
- charlysl 9y agoBy concurrency I mean expressing in the language that a computation or operation is independent, for instance by putting it in a thread or making it lazy, and all the programming techniques that this enables: active objects, order finding (which plays very well with paralellism btw), etc. Parallelism I see as a hardware feature that can make programs faster. I thought about the "callback hell", this is a bit more like coroutines, a quite limited form of concurrency (like non-preemptive threads). In this sense Js is very limited in what programming techniques can be taught.
- iovrthoughtthis 9y agosetTimeout and non-blocking io produce out of order execution. What more concurrency are you looking for?
- charlysl 9y ago
- quotemstr 9y agoAm I the only one bothered by the growing use of the word "objectively" as a general-purpose intensifier? That's not what it means.