Live data from Hacker News

John Resig: JavaScript as a First Language

ejohn.org

81–90 of 228 posts

Re: John Resig: JavaScript as a First Language

#81
Before I even read the article, I was pretty sure that with a title like that there is going to be lots of debate from the CS people. They do raise some good points, but here's my 2 cents.

Besides a little bit of VB in highschool, JavaScript was my first language. I mainly learned through two books: "The Good Parts" which was a nice overview, and "Object-Oriented JavaScript" a really underrated book that covered every little piece of the language, even those weird parts like block scoping and falsy types.

Having never learned anything about classes or inheritance, prototypal inheritance was kinda hard to grasp, but I eventually found it pretty amazing. I think a loosely typed language is much better to learn on too. That way you can learn the big pieces of the language then later get into the little things like typing. That's just my experience, but I'm really glad JS was my first language.

Re: John Resig: JavaScript as a First Language

#82

Earlier quoted context omitted.

One might say the same about the English language, yet it is taught in classrooms all across the United States, despite the fact that the U.S. has no codified national language. English is the de facto national language, but nothing more. So why Javascript as a first language? Probably the best argument is that it has the widest reach of any programming language in use today because Javascript will run in any web bro…

If widest reach is your criteria, Java and C would also be equally good choices. Unless the web browser is special in some particular way that makes it 'more worthy' than other execution environments?

Java is an extremely confusing language for newcomers. While it's "simple" in comparison to languages like C++ and Haskell, the perceived inconsistencies (do I use == or equals()? length, length(), or size()?) really drive newcomers--and some veterans--up a wall. Throw that in with the insanity of generics, the "everything must be within a class" concept, the mess between objects and primitive types (ints AREN'T Integers!), the verbosity (and inconsistency in naming things), and the lazy-ass exceptions that only vaguely sometimes give you a general idea of where things go wrong, and it's horrible for new programmers.

Javascript is relatively strange, but it's much easier for me to teach JS to somebody than Java. I find it much more easy to explain how and why things work in javascript, whereas when someone asks me why something in Java works this way, I respond with an "I have no clue--they just decided it'd be a good idea and I think it's terrible."

Re: John Resig: JavaScript as a First Language

#83

I once considered teaching JavaScript as a first language, but the absence of synchronous user input made me reconsider. For example, there is no way to do this in JavaScript, > var line = read_line(); Of course you could use the prompt() function, but that only works in the browser, and it's an ugly hack.

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.

Re: John Resig: JavaScript as a First Language

#84

Earlier quoted context omitted.

> Mobile web browsers don't include any development or debugging tools. LOL. Great point. /sarcasm > The cost of installing Visual Studio or Eclipse is pretty small considering that you only have to do it once. Boom. That's all it takes to create a barrier of entry. Not everyone has permissions to install whatever they want on the computer they're using. Then you get into issues with multiple operating systems. Windo…

Boom. That's all it takes to create a barrier of entry. Not everyone has permissions to install whatever they want on the computer they're using. Then you get into issues with multiple operating systems. Windows does it one way and Linux and OSX does it another way. Also, the tools you've mentioned are always changing. Will it be the same in a year or two? But won't they need to install an editor anyways? Or are they…

I'm all for vim, but you're mad if you think first-time coders should pick that up before even writing their first piece of code. Talk about barriers to entry and unintuitive behaviors...

I think the most viable environments for absolute beginners will be online ones that include an REPL and editor, using either JS or something that compiles to JS or to anything else on the backend, so even browser choice is irrelevant. Then you don't have to teach how to load a JS file into a document and so on.

Re: John Resig: JavaScript as a First Language

#85

I have argued JS as an intro language for years. My main argument has been not based on language features which I feel are unimportant in forming a young programmers mind but rather in the complete lack of barriers to getting started. Take for instance python( my personal language). At a minimum you need python installed on the computer. Then you need to deal with issues such as the PATH and PYTHON_PATH. Also you hav…

In the particular case of python, I see none of the problems you mention. In pretty much all Linux distros, it already comes installed and ready to use (i.e., just execute it, no need to know paths or anything).

The same happens on Windows, once you run the installer; there you can, too, just edit and double click it. All you need is a .py file on the desktop.

Re: John Resig: JavaScript as a First Language

#86
I support using JavaScript as a first language. If for nothing else there are millions of code snippets just a short "right click -> view source" away. Granted these may not be the most ideal examples, but it enables tinkering. One thing that always frustrated me about the "easy" languages to learn (Python, Ruby, etc) is you still have to figure out how to download something and then the first programs just write out text to a console window. It's hard to see at first how learning one of the "easy" languages translates into building cool stuff.

Having access to such a vast array of samples, plus something like Khan Acadamy teaching the "right way" is just awesome to me.

Re: John Resig: JavaScript as a First Language

#87
Reading this I reminded of the saying "when you have a hammer everything looks like a nail". It's not surprising to see John Resig leaning towards using Javascript. There is a lot of research into teaching introductory programming. It would be nice to see some of that referenced in making the decision. You know, base it at least in part on science rather than just opinion.

Re: John Resig: JavaScript as a First Language

#88

Earlier quoted context omitted.

Strict Equals Operator (===) does exactly what I expect and that is no funny coercion or guessing, two objects I'm evaluating have a 1 for 1 likeness, no more no less. How is that confusing?

NaN !== NaN Apart from that, I agree.

That is the reason for the existence of the function isNaN.

Plus, NaN returns a generated object, so that result is expected

({}) !== ({})

Re: John Resig: JavaScript as a First Language

#89

Earlier quoted context omitted.

I struggle with this mindset. It probably makes sense for Khan Academy, but this industry (software development) needs fewer people who refuse to learn anything unless all obstacles are removed and the information is spoon fed.

Well, I grew up in a day when it was even easier. * Buy home computer (ZX81) * Turn on * 10 Print "Hello world" * run I don't think the instant gratification and ease of use did me any harm.

Of course, the "buy home computer" step was a lot harder back in those days.

Re: John Resig: JavaScript as a First Language

#90
post #82

Earlier quoted context omitted.

If widest reach is your criteria, Java and C would also be equally good choices. Unless the web browser is special in some particular way that makes it 'more worthy' than other execution environments?

Java is an extremely confusing language for newcomers. While it's "simple" in comparison to languages like C++ and Haskell, the perceived inconsistencies (do I use == or equals()? length, length(), or size()?) really drive newcomers--and some veterans--up a wall. Throw that in with the insanity of generics, the "everything must be within a class" concept, the mess between objects and primitive types (ints AREN'T Inte…

Java isn't really simple in comparison to Haskell--Java is full of warts and inconsistencies while Haskell is simple, consistent and elegant. The reason Haskell is viewed as hard is that it takes basically nothing from languages you already know. If you don't know any languages, it's actually a great starting point.
Post reply on HN