Hacker News new | past | comments | ask | show | jobs | submit login

JavaScript "is the language of choice for introducing computer science concepts by prestigious universities"!? God help us all.

I see the link to the Stanford course, but I hope it's still in the minority. JS is not a language that I would want to teach to newbies, especially if those newbies are on a path towards a CS degree.




FWIW, CS 101 isn't a required (or popular) Stanford course, and isn't part of the CS major. The intro series is 106A/106B/107, which are taught in Java, C++, and C respectively.

There are plans to switch out Java for Python eventually but no major classes are taught in JavaScript--the closest it gets is a graduate Programming Languages class that spends a few weeks on JavaScript to illustrate closures and first-class functions.


There's no undergraduate class that illustrates closures and first-class functions (whether in javascript or otherwise)? That seems odd...


The undergrad core (and degree) is 90% Java, C, and algorithms.

To be fair, though, many undergrads take graduate classes and the department encourages it--the only difference is a 2XX course number instead of 1XX, and sometimes a bit more rigor.


I wasn't aware that JS was used in CS university courses, but I'm not so offended by it. The nasty parts of JS (type coercion WTFs, void, with, etc.) aren't very relevant to teaching basic CS principles, and it's got everything you need unless you consider "normal" object-orientation a basic CS principle. It's got all the flow control, loop constructs, obvious anonymous function syntax, etc. you would expect.


Additionally, it's one of the only popular prototype-oriented languages. I think having to teach some of the less-than-sane parts of javascript can be a distraction from whats important in a 100 level course, but for a higher level course that teaches different paradigms, it makes sense to teach Javascript.


It's not the language of choice for introducing CS to college students at all. The author should do some research first before making such a statement. No sensible CS departments would do something like this. For some reason, I see many "web" people think that web development is the center of Computer Science. It is not. Web dev is not even a required course for many CS undergrad programs.


And web development shouldn't be the center of a Computer Science curriculum. Web development happens to employ many of the concepts one learns about in a Computer Science curriculum such as data structures, algorithms, asynchronous and synchronous communication, and UI interactions.

But, like a machine learning course, or a data science course, which also touch on many concepts which are part of a core Computer Science curriculum, it is not a center because the center of a good Computer Science curriculum is the core concepts through which all other ideas flow (algorithms, data structures, message passing and communication, programming language design, compilers and interpreters, object oriented design, functional programming, etc).

Generally all the rest is (and should be) elective. And most curriculums presumably require electives so students can delve into areas they're interested in applying the aforementioned skills to.


Any particular reason? Considering its relation to C, fairly simple, highly available and super-widely used, seems like an OK choice to me.


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.


Javascript 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.


Immutability-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.


Scheme 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?


It'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.



Straight from the horse's mouth:

http://brendaneich.com/2008/04/popularity/

JS certainly does have other influences, notably Self and Java. But from that article:

"As I’ve often said, and as others at Netscape can confirm, I was recruited to Netscape with the promise of “doing Scheme” in the browser....I’m not proud, but I’m happy that I chose Scheme-ish first-class functions and Self-ish (albeit singular) prototypes as the main ingredients. The Java influences, especially y2k Date bugs but also the primitive vs. object distinction (e.g., string vs. String), were unfortunate."


Did 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.


Well, 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".


I 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.


Its a programming language for the web. Not only is running in browser a benefit, its a necessity.


There's 'console.log' which outputs to the debuggers output screen.


But 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.


One of the "benefits" is that learning Javascript (ignore the DOM for now, it's not necessary to touch this to learn Javascript) requires nothing more than a browser and notepad. Hell most browsers have debuggers already built in. I can see the appeal.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: