Live data from Hacker News

John Resig: JavaScript as a First Language

ejohn.org

141–150 of 228 posts

Re: John Resig: JavaScript as a First Language

#141

Earlier quoted context omitted.

It's 2011. We love significant whitespace now, get on with the times...

Assume you've never programmed before. Would you want to debug a program that has a significant whitespace bug? It's much easier for the average person to spot an unbalanced parenthesis that an incorrectly sized whitespace. 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 t…

"""Assume you've never programmed before. Would you want to debug a program that has a significant whitespace bug? It's much easier for the average person to spot an unbalanced parenthesis that an incorrectly sized whitespace."""

I'd argue that for a beginner it's equally difficult.

And how about this equally difficult to spot classic bug:

if (f==x)

  do_something()

  and_also_do_this() //oops!
a language with significant whitespace does not permit it. It gets people using the correct indentation levels from the start, whay they should have used anyway in any language, even one where whitespace doesn't matter.

I propose we don't talk about languages with "significant whitespace", but instead about "languages with proper indentation enforced".

Re: John Resig: JavaScript as a First Language

#142

Anyone else taught Karel++? In high school they taught us: Pascal -> Karel++ -> C++ Then the new AP tests came in and the switched to C++ -> Java, which seemed very silly to me (C++ as a first language???)

My intro CS class in college started with a week of Karel. It was incredibly fun for me, but I can't vouch for it as a first language, since I had already learned Basic and Pascal in high school. (Yep, I'm old). Karel variants are actually very challenging in a way--the syntax is dead simple, but its lack of constructs forces you to be fairly clever.

Re: John Resig: JavaScript as a First Language

#144

Earlier quoted context omitted.

Why is prompt() ugly? On the contrary, I think that for kids who grew up in GUIs, it is much more familiar and less intimidating than a prompt.

With a standard prompt, you can see the previous output from the program and user input. But a popup window has no context, no history. Of course that's just my opinion. If it could help teach kids good programming skills then it should be used used.

Chrome, Firefox and Safari all have built in REPLs

Re: John Resig: JavaScript as a First Language

#145

I am so looking forward to a huge army of newly-trained programmers who view prototype-based inheritance as the default and classical inheritance as weird. Similarly, I look forward to a whole set of various modules and libraries to graft prototype-based inheritance onto existing languages like Ruby... cackle

Unfortunately I think that class-based inheritence is more general in concept. That is, people who understand class-based inheritence have a very small leap to get prototypal inheritence. You can pretty much just say, "Inheritence works on the instances/objects, not on the class." Explaining class based inheritence to people who only know prototypal seems trickier. You have to explain the concept of classes and then…

In Io you can add as many objects as you like to the protos list of an object: http://www.iolanguage.com/scm/io/docs/IoGuide.html#Objects-I...

Re: John Resig: JavaScript as a First Language

#146

Earlier quoted context omitted.

It's 2011. We love significant whitespace now, get on with the times...

No, we don't. Kids who don't know better might think it's cool; it isn't.

Yeah. Because only kids use and love Python and like the significant whitespace, right? And Haskell with it's significant whitespace --yeah, that's another language for "kids who don't know better"...

Anyway --you're a Smalltalk guy. How do you get to talk about weird syntax people don't like? Do many people like interleaving-argument selectors?

Re: John Resig: JavaScript as a First Language

#147

For 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 (…

What, no disclaimer that you are actually the creator of coffeescript?? Your comment seems a bit biased to me. But I'd expect nothing less from a coffeescripter. So you think it's better for someone who has no experience coding to have to understand why they would write some code one way, then have to "transpile" to something else to get it to run? Then if something goes wrong they have to figure out how to fix it in…

Probably the reason he said:

"...I definitely would not suggest it for the Khan Academy's purposes"

Re: John Resig: JavaScript as a First Language

#148

Earlier quoted context omitted.

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…

I spent a lot of time trying to track down bug in a system once (in php) that was caused by this. I don't remember the exact problem but basically it did something like "if(x == 5)" which is true for both 5 and "5" - but later in the code it was important that the value was actually 5 and not "5". But I think the main thing is that for people beginning programming it's better to have less flexibility. In most product…

> but later in the code it was important that the value was actually 5 and not "5".

The bug was in that part and not in previous if(5=="5") part. Issues like these appear when Java programmers start to code PHP as if it's Java.

Re: John Resig: JavaScript as a First Language

#149

For 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 (…

What, no disclaimer that you are actually the creator of coffeescript?? Your comment seems a bit biased to me. But I'd expect nothing less from a coffeescripter. So you think it's better for someone who has no experience coding to have to understand why they would write some code one way, then have to "transpile" to something else to get it to run? Then if something goes wrong they have to figure out how to fix it in…

No, he specifically said at the start that he doesn't recommend it to Khan Academy.

To me, it reads as if he is simply supporting John Resig's decisions about what parts of JavaScript to teach -- by virtue of having made those same decisions in designing CoffeeScript.

Re: John Resig: JavaScript as a First Language

#150

For 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 (…

And made the mistake of making whitespace significant thereby driving off people in droves.

Yeah, because it totally didn't work for Python... :3
Post reply on HN