7 ms·
Stanford is moving from using Java to JavaScript for their intro CS course
- submeta 9y agoAlthough I use and like both Java and JS, I wonder why they did not move to Python.
- sgt101 9y agoMaybe Python (and Julia) are just... too .. MIT?
- lol768 9y agoI think universities should cover JavaScript at some point, but using it in an introductory course seems short-sighted and problematic. I think if I'd have started with JavaScript I'd have been intimidated by the ecosystem, I'd have learnt about an approach to inheritance I couldn't apply to languages like C# and Java - and I wouldn't have gained an appreciation for strong typing. When I first learnt about how integers can be stored using two's complement it was easy to see how this mapped to the "int" type in Java and I could experiment and see how this worked in practice. Everything is floating point in JavaScript, a lot of behaviour is inconsistent with type conversions etc. I get that it's popular and used on the web .. but it doesn't seem like a good first language.
- wildrhythms 9y agoWhat do you think is a good first language? I've seen a lot of people say that Python is a good first language, but I think Javascript is just as approachable as Python.
- SOLAR_FIELDS 9y agoFor however "forgiving" JavaScript syntax is, I still believe that the syntax is a bit intimidating for beginners (curly braces). Python has it's own magical syntax idioms, mostly in regards to array slicing and list comprehension, but even that seems a bit less intimidating than JS (I say this as someone who learned to code after being intimidated by it for several years)
- lol768 9y agoIt's a hard question to definitively answer. I think Python has a lot going for it. It doesn't do dumb things when testing for equality, it's predictable. At the same time, it's perhaps not as easy to write quick scripts if you don't know OOP (example: having to use the global keyword in helper functions). There's also the work required to get it set-up. I learnt with Java. It gave me an understanding of OOP but in it did not give me a good understanding of lower level details and unfortunately I've not properly learnt to write code in C at university. In hindsight I'd have been better off starting with C. It would've been more difficult for sure, but I'd have understood what actually going on.
- u801e 9y ago> At the same time, it's perhaps not as easy to write quick scripts if you don't know OOP (example: having to use the global keyword in helper function Your example has nothing to do with OOP. It's simply how python handles variable scope outside of a class.
- lacampbell 9y agoNot the person you asked, but I would say one of Scheme, Lua, or C. You want a small language with not a lot of extra bells and whistles. My first year CS classes were in C# using visual studio, and at the time I hated it. I had never coded before and I was drowning in complexity that had nothing to do with computer science fundamentals. It was only until I did some stuff with discrete maths that my thoughts turned to programming again - possibly because discrete maths was not taught in an "industry focused" way, and that freed up my mind to wander. Focusing on stuff that recruiters want is a cancer in computer science education.
- nobleach 9y agoActually, all three of those sound like a fantastic mix. I was taught Turbo Pascal at first, and then my college classes were in Java (mostly). So it was more concept based. But each of those languages that you've specified, highlight different facets. (Interpreted vs dynamic. Functional vs imperative - maybe toss in some C# for OOP) And I totally agree. CS grads should be DECIDING (not at first) what languages are to be used at their shiny jobs... Vocational schools are for teaching the languages that are "in demand".
- lolive 9y agoThe most important is to learn object composition & strong type systems. So I would say Java 8 (in an IDE, of course).
- goatlover 9y agoWhy should a beginning programming class have to include learning an IDE?
- lolive 9y agoSo you get a safe refactor feature for free. So you don't get afraid of refactoring. So you do refactor. So you get used to that exercise. And eventually you refactor in your head before typing. Plus you get types hints for free, and safe auto completion too.
- mrmondo 9y agoPython, then as a second move down to C.
- madhadron 9y agoI have yet to see anything superior to the TeachPack languages in PLT Racket, though a friend of mine is building a similar incremental system of instruction in Python.
- rakoo 9y agoAs a fan myself, I'd go with Go. It's been designed to have as little magic as possible, which is a good thing for huge teams working on huge codebases (its primary target) but also turns out to be a good point for learning a language. It's got all the niceties that make high-level programming easy and fun (GC, types, instantaneous compiler, integrated testing and benchmarking frameworks). Many Go developers could tell you about how coding small programs in python vs Go turns out to be similar from a developer experience point of view. I don't see any class-level task that can't be solved with the standard library, but if something else is needed, adding external dependencies is extremely easy. It's also going to teach students about the differences between concurrency and parallelism, notions that are desperately needed as the hardware has been multi-core for so long now but still hasn't been exploited as much as it should have. Of course not everything is perfect, I can see a few issues: * Go favors composition over inheritance to the point that the latter just can't be done. While I believe this to be the correct choice, it will hinder students' capacity to switch to other languages that favor inheritance, i.e most of them * Go remains a "backend" language. There is no easy way to do any fancy graphical stuff, let alone work in the browser. Those 2 domains both have very specific demands that I feel are worth learning early * There is no REPL for quick validations of intuitions or ideas. I do use play.golang.org for this, but it's far from being as smooth as running a python interpreter or dropping into the browser for a simple test
- bdcravens 9y agoI think there is something to say about approachability. Perhaps an interesting approach would be to teach TypeScript (though your point about ints vs. floating point is still true)
- neutronicus 9y agoI actually think it's a great first language. Not because of anything intrinsic to the language itself (which I loathe), but because it's hosted on the browser and has baked-in notions of "making the browser do things". The students get to start learning to program with a language that was created to automate an environment they are comfortable and familiar with. No longer do you need to haze them with ssh-ing into class servers to run a compiler to create executables that interact with the user via the console.
- lol768 9y agoIf WebAssembly becomes a viable compilation target for other languages (and browser support is there), would you support the teaching of those too for the same reasons? I think part of this is an issue with academia - the tooling that's recommended tends to be (in my experience as a student) outdated, difficult to use and completely out of touch with what's used in industry. Throughout the whole of my CS degree first year we were editing Java in gedit and compiling it with (an outdated version of) javac! Dependencies were downloaded as JARs and manually added to the classpath. There are so many better tools available, especially for use in teaching. For example, JetBrains have done some really great work on an educational IDE for Python (https://www.jetbrains.com/pycharm-edu/concepts/ https://www.jetbrains.com/pycharm-edu/concepts/). GitHub offer a whole suite of tools for the classroom. They just don't seem to be used as much as they should. I think Python (combined with some GUI/graphics library) could be really valuable and avoid the whole "console interaction" thing.
- neutronicus 9y agoI would, indeed.
- ams6110 9y agoThe point of real computer science programs is to teach computer science, not specific programming languages or IDEs.
- krapp 9y agoIf I were going to teach an introductory programming course in Javascript, I wouldn't bother with the ecosystem, it would just be plain vanilla JS. That's actually how the javascript class I took worked - attach a js file to an HTML file, zip it and upload it to moodle. Teacher unzips it, double clicks it, and if it doesn't run, you fail. Then he checks the actual code. I think many people here underestimate the level of knowledge needed for an introductory course. People can worry about the way integers work once they actually grasp what a variable is and how functions work, in a later class using a language where those things are more overt.
- staticassertion 9y ago> If I were going to teach an introductory programming course in Javascript, I wouldn't bother with the ecosystem, it would just be plain vanilla JS. I assume they're referring to self-teaching outside of class.
- lhnz 9y ago> I wouldn't have gained an appreciation for strong typing. TypeError: undefined is not a function On the other hand, JavaScript can make you appreciate strong typing, when you eventually encounter it. (Or at least I personally found that JavaScript made me care a lot more about static typing and correctness than Python ever did because it is so easy to make mistakes.)
- nobleach 9y agoMy first year Java textbook had nothing concerning how to set up Maven/Ant builds/SpringMVC/JSTL/Enterprise JavaBeans/etc. It was about data structures and algorithms. I seriously doubt Stanford is going to teach Webpack/React/Redux. I don't think a college should cover a language in particular. Leave that for the job-place. Obviously some language differences/features can be beneficial. (Garbage collection vs Reference counting for example). Overall, college is place to be taught how to think about solving problems. So, it's just fine as a teaching tool. Then again, I still believe everyone's first language should be Pascal (like mine) as it's a wonderful teaching language.
- lacampbell 9y agoi still think the old MIT approach of using scheme - and not even explicitly teaching it - seems like the best one. Start with a small simple language, and focus on just data and procedures. Hand-wringing about how useful a CS 101 language is in industry is putting the cart before the horse. People need to learn the ideas, and the less language they have in the way, the better.
- swiley 9y agoI really dislike the use of JavaScript as an intro language. It's easy to mess with so everyone thinks they understand it but it's not simple.
- elmerland 9y agoYou can say that about any language I think. Maybe JavaScript is a little special because of how it has grown over the years and it's general lack of a "rigid" structure or implementation.
- im_down_w_otp 9y agoI wish that CS curriculum followed similar trends to traditional science where it goes from generalized high-levels of abstraction/assumptions (e.g. spherical cows and frictionless surfaces) to more detailed and complex "truths" or realities. In terms of language-use progression I imagine that to look a lot like: Python-ish -> Java-ish -> Lisp-ish -> C-ish -> Asm-ish. So that a person can engage the simplified general problems in Computer Science and work their way toward the nuts and bolts that comprise the underlying system. That seems like it would boost appreciation for the prior convenience and abstraction while simultaneously boosting "mechanical sympathy" for the systems and lower layers that enable everything.
- lol768 9y agoThat's an interesting model. I completely agree it'd boost appreciation for the higher level languages, but I wonder if that'd be to the detriment of lower level languages. I guess you'd need to emphasise that there are times when you might want to use a lower-level language - something I didn't appreciate for a while ("Why would I want to use C and manage memory when I can just use Java?"). Maybe using an embedded system as part of the course would come in handy here.
- neutronicus 9y agoI remember having a conversation with the professor who ran the "intro to programming for engineers" at my undergrad, where they spent half a semester on C and half a semester on matlab, in that order. I remember saying that I thought they should do things in the other order (as you're suggesting here), and I remember him saying that they'd tried that, and being very emphatic that it did not work, that trying to teach C to students already used to matlab was a disaster.
- im_down_w_otp 9y agoThat might just be the choice of MATLAB as the alternate pole. Because that stands out to me as strange for several reasons... starting with it's not really general purpose at all and it is a relatively complex environment in and of itself which has nothing at all to do with programming or computer science. That method seems akin to expecting a bunch of students who learned Photoshop for web layouts to have an obvious progression to linear algebra or analog signal processing.
- clumsysmurf 9y agoAs mentioned in the comments, the Java version isn't going anywhere "javascript version is an experiment by Eric Roberts."
- solomatov 9y agoIt seems that's what the market wants. Even though, there're better languages.
- zenonu 9y agoOh Leland Stanford in heaven, please let it be Typescript instead. The var keyword is of the devil.
- narsil 9y agoI would expect it to be ES2017 or similar.
- deleted 9y ago[deleted]
- holografix 9y agoI don't think his will result in stronger CS graduates but given the pressure most unis are feeling from online education and coding bootcamps it's not surprising. Why study some archaic language (lisp and scheme like I did for my programming 101) when you could be studying something that is much more aligned with your number one goal for getting a degree: employment.
- goatlover 9y agoIt's way out of fashion now, but I thought Pascal did a really good job of being an intro programming class that wasn't too complicated, but forced one to learn the basics in a disciplined fashion. I took Pacal first semester and then C++ the next, and the Pascal course really helped. As I was graduating, Java replaced C++.
- Safety1stClyde 9y agoI searched in vain for a comment remarking on how computer programming is dominated by fads and fashions. So let me be the one. It's just a fashion. There is no theory or rationale or purpose behind the choice of any of these languages except "what is in fashion now".
- rs86 9y agoI think at some point students should be exposed to C, it is important to understand its memory model - allocation, deallocation, pointers
- tardo99 9y agoStanford used to teach C as its first programming language. I think that was the right choice, Java is suboptimal and JavaScript is a flat-out mistake. C is optimal because it sits at a nice fulcrum point between assembly language (the code the CPU actually executes) and human-readable structured programming. Java hides important things from the programmer, most notably how memory allocation works, the necessity of managing memory and freeing it at the right time. Java introduces higher-level abstractions such as classes which make programming more complex for a starting programmer without much benefit. Beginning programmers need to learn the simple process of conceptualizing and writing procedural code and adopting basic formalisms such as decomposing complex codepaths into functions for clarity and conciseness. JavaScript compounds these issues. It makes it essentially impossible to see the actual code running on the CPU to execute a given set of instructions. It introduces functional programming concepts which, while important, are really better used once a programmer has developed more intuition about how CPUs actually process instructions. Its syntax is so fluid that it's difficult for a beginning programmer to understand what is "right" and "wrong" in many cases, because so many different idioms "just work." I very commonly encounter programmers who have never used C and therefore have next-to-zero intuition about memory allocation and how CPUs actually process instructions. I'm not suggesting engineers should all learn x86 ASM coding, but I do think C provides the best basis for becoming a strong engineer later in life. As a general rule, the strongest engineers I know all have a significant background in C programming somewhere in their education or professional resume.
- feduzi 9y agoWhy not just teach JavaScript or C or Java in comparison with different languages. For example, when explaining (so evil) `var` explain that in JavaScript it works different from C or any language with block-scope variable declaration. Big picture is important. The problem is not the language, the problem is inferring that every new thing you pick up is somehow similar to "that thing I've used before".