4 ms·
I'm not even a JavaScript hater, but: its relation to C is merely syntactic, and is to its detriment, frankly. And, simple? Assuming a hypothetical comprehensiv
by mrbrowning 12y ago
I'm not even a JavaScript hater, but: its relation to C is merely syntactic, and is to its detriment, frankly. And, simple? Assuming a hypothetical comprehensive encoding of programming language semantics, I can't imagine that JS would be anywhere near the top of the list for shortest complete descriptions of same. That and the constant churn of libraries du jour in the JS world makes me think that it is far from an optimal language for the beginning programmer.
- wavefunction 12y agoDid you have tons of C/C++ libraries thrown at you in 100 level courses? Probably not, I'm guessing. JavaScript is great because it runs in a browser, provides immediate feedback without having to compile/recompile and allows for all the simple flow control concepts mentioned by other posters.
- mrbrowning 12y agoI don't see running in the browser as a benefit. It means that a required step for a neophyte in producing meaningful output is getting a handle on the utterly brain-dead DOM API.
- creatio 12y agoThere's 'console.log' which outputs to the debuggers output screen.
- mrbrowning 12y agoBut then the mere fact that a computer comes with a browser already installed is not a notable advantage. I can get a Python REPL running on a computer with an amount of effort and know-how comparable to that necessary to install Chrome.
- deleted 12y ago[deleted]
- pavs 12y agoIts a programming language for the web. Not only is running in browser a benefit, its a necessity.
- rimantas 12y agoWell, I assume OS X is quite popular among students. I'd say opening terminal and typing "python" or "irb" beats the hell out of "running in browser".
- nostrademons 12y agoJavascript is probably semantically closest to Scheme - it's a language built around closures and one universal data type (lists in Scheme, objects/dicts in JS). Scheme is a pretty good choice for intro CS courses, because of its simplicity and the need to re-implement many common language constructs from first principles. JS shares this property, but also gains the benefits of being widely used in industry and available in every web browser, with a good debugger in Firefox and Chrome. I'd never really considered it as a teaching language, but I think it'd be a great choice.
- mrbrowning 12y agoImmutability-by-default is a necessary, if not sufficient component of the semantics of Scheme that is lacking in JavaScript, and it's that same lack that leads me to think that any comparison between the two languages is basically spurious.
- nostrademons 12y agoScheme certainly has mutability, through set!, set-car!, set-cdr!, and procedures based upon them. It's not the default - you always know when you're mutating something - but then, there's a pretty direct syntactic translation into Javascript, where = without a var always means you're mutating something. Why is this important for students, anyway? Shouldn't they be exposed to mutability fairly early on?
- mrbrowning 12y agoIt's not important for students, I just dispute the notion that JavaScript has any special affinity with Scheme beyond that of any other language with first-class functions. Anyway, the major advantage of immutability by default is that it enables under-the-hood optimizations like structural sharing that make FP the paradigm of least resistance. To the extent that JavaScript doesn't do that, it doesn't really deserve to be called a functional language any more than e.g. Ruby.
- discreteevent 12y ago