I'm a fairly experienced programmer and JS still drives me up the wall. The implicit casting and inconsistent operator overloads have led to many unhappy visits to Stack Overflow to see just WTF my browser is doing. I can't imagine the experience being any better for newbie programmers! Even simple things, like bitwise operators, are basically broken unless you take care to ensure that your variables are coerced to w…
John Resig: JavaScript as a First Language
131–140 of 228 posts
Re: John Resig: JavaScript as a First Language
#132Earlier quoted context omitted.
And made the mistake of making whitespace significant thereby driving off people in droves.
It's 2011. We love significant whitespace now, get on with the times...
Getting stuck and being frustrated hurts motivation a lot.
Now curly brackets and syntax may be seen by a person as an irritation or inconvenience compared to whitespace, but I'd say it's better to use a language with an inconvenience than one which is more likely to leave you stuck.
You, I and others used to programming with insignificant whitespace have developed and eye for detail and can rapidly spot a whitespace but. The general population with no programming experience can't consistently space most of the documents in their life, but they can typically place periods correctly.
Re: John Resig: JavaScript as a First Language
#133Earlier quoted context omitted.
Also, as stated by John, JSlint will be used. That by itself avoid the big majority of JS' gotchas. And IMO, C++ has way more gotchas than Javascript and that doesn't stop universities to teach it as first language. In fact, I think the first language is not just about giving a strong foundation but also give students the chance to find a good internship. So, with that logic, even though I enjoy hacking with Scheme,…
Well, I wanted to know what IDE JSLint was an expansion for, so I did some poking around... it's an online tool. Meh #1. Next up I thought I would take a snippet from the linked stackoverflow discussion and see what JSLint made of it: 127.0.0.1.toInt(); And... it complained So I did this: var = function() { 127.0.0.1.toInt(); } And it complained (yes, there's a typo) var foo = function() { 127.0.0.1.toInt(); } And...…
Re: John Resig: JavaScript as a First Language
#134For the interested (and with the caveat that I definitely would not suggest it for the Khan Academy's purposes), CoffeeScript does try to address all of the issues that John raises in his post. Type Coercion: There is no `==` in CoffeeScript. You usually write `if x is y` in order to be particularly clear, but if you're in the mode of most other scripting languages, and you write `if x == y`, it will compile to `if (…
Re: John Resig: JavaScript as a First Language
#135Earlier quoted context omitted.
Also, as stated by John, JSlint will be used. That by itself avoid the big majority of JS' gotchas. And IMO, C++ has way more gotchas than Javascript and that doesn't stop universities to teach it as first language. In fact, I think the first language is not just about giving a strong foundation but also give students the chance to find a good internship. So, with that logic, even though I enjoy hacking with Scheme,…
Well, I wanted to know what IDE JSLint was an expansion for, so I did some poking around... it's an online tool. Meh #1. Next up I thought I would take a snippet from the linked stackoverflow discussion and see what JSLint made of it: 127.0.0.1.toInt(); And... it complained So I did this: var = function() { 127.0.0.1.toInt(); } And it complained (yes, there's a typo) var foo = function() { 127.0.0.1.toInt(); } And...…
There is also the somewhat friendlier JSHint as a reasonable alternative: http://www.jshint.com/
Re: John Resig: JavaScript as a First Language
#136Javascript is an absolutely horrible language to use for such purposes. There are far too many gotchas. See the following for numerous examples: http://stackoverflow.com/questions/1995113/strangest-languag...
I suspect Mr. Resig is familiar with the potential gotchas, and maybe even has his reasons for still believing it's still worthwhile. For my own part, as someone who regularly taught high school seniors (and other non-programmers) various programming languages (Pascal, Perl, Prolog, JavaScript, and Java) over a good chunk of the 1990s, I have to say that JavaScript worked out pretty well, possibly even the best of th…
Re: John Resig: JavaScript as a First Language
#137For the interested (and with the caveat that I definitely would not suggest it for the Khan Academy's purposes), CoffeeScript does try to address all of the issues that John raises in his post. Type Coercion: There is no `==` in CoffeeScript. You usually write `if x is y` in order to be particularly clear, but if you're in the mode of most other scripting languages, and you write `if x == y`, it will compile to `if (…
I don't understand the (anti) hype about type coercion and the '==' operator. I get a faintly cargo-culty vibe from people when they talk about '===' vs '==', since the examples are usually very strange things that I never see in production. I'm not an expert in JavaScript but I've written a fair amount and a couple largish programs and I've never been bitten by a type-coercion bug involving '=='. The weird subtle bu…
But I think the main thing is that for people beginning programming it's better to have less flexibility. In most production system it might not matter that 5=="5" but it's important for beginners to understand how different types work. And it helps give a better insight into how if statements, and boolean logic in general, work.
Re: John Resig: JavaScript as a First Language
#138tl;dr - they picked JS due to its "ubiquity, desirability in the larger workforce, lack of prior installation requirements, and ability to create something that's easy to share with friends" I find that explanation disturbing. Why not start from a language that teaches the basics of the common programming paradigms, such as OOP (Java) or FP (Scheme)?
> Why not start from a language that teaches the basics of the common programming paradigms, such as OOP (Java) or FP (Scheme)? Because that stuff is boring and it drives away a bunch of people who might really get in to programming if there wasn't a huge gap between "just starting" and "doing anything remotely cool". I for one would not have become a developer if my first experience with programming was a typical "C…
The beauty of scheme is that it's turtles all the way down. If you want to see how something works, it's easier to explore.
Re: John Resig: JavaScript as a First Language
#139I'm a fairly experienced programmer and JS still drives me up the wall. The implicit casting and inconsistent operator overloads have led to many unhappy visits to Stack Overflow to see just WTF my browser is doing. I can't imagine the experience being any better for newbie programmers! Even simple things, like bitwise operators, are basically broken unless you take care to ensure that your variables are coerced to w…
Python seems to me like an infinitely better choice. Every language has its warts but bringing up a new generation on a language that even the author admits was a quick and dirty hack takes "worse is better" cynicism way too far.