Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×
Education Programming News

Stanford CS101 Adopts JavaScript 255

mikejuk writes "In case further proof were needed that JavaScript shall indeed inherit the earth, we have the news that Stanford has adopted JavaScript to teach CS101 — Introduction to Computing Principles: 'The essential ideas of computing via little phrases of JavaScript code.' You can even try it out for yourself at Stanford's course page."
This discussion has been archived. No new comments can be posted.

Stanford CS101 Adopts JavaScript

Comments Filter:
  • by Anonymous Coward

    When I was in school we had to use ECMAScript!

  • Ideal IDE (Score:4, Interesting)

    by vlm ( 69642 ) on Monday July 11, 2011 @02:44PM (#36724416)

    For utter newbs not going into CS, JS is a good choice, because any machine with a web browser is a dev box, but for actual CS students, a debian boot disk is probably more appropriate.

    You should have heard the screams of pain in my cobol class many years ago. What, you mean a "dos" application? And the alternative is a AS/400 that doesn't even support telnet? Someone who suffered thru that kind of experience probably went to the other extreme in selecting JS.

    JS isn't even all that bad of a language for newbies to learn the basic concepts.

    • That is true. Any full language (ones that support functions and data structures) would be a good one to learn when first starting since the point isn't to learn the language (a side benefit) but to learn how to program in a structured language. If you initially worked with basic (I learned apple soft basic when I was in elementary school) going to a structured language like c, java, pascal, fortran, c++, was really difficult as you always wanted to used goto. I don't know if logo supported functions or not
      • Got me to learn about user created functions much quicker than the artificial limits imposed by goto w/ line number.

    • Re: (Score:3, Insightful)

      oh god no.

      JS is a HORRIBLE language to teach newbies.

      From my point of view, JS is a horrible kludge of compromises and should be left up to coders who have a more firm grasp of object orientation, types(Yes, it's loosely typed, but beginning CS should really enforce both the ideas that data, whether it's strings, ints, etc, is just a pile of number values, but also how important it is to abstract that out) and algorithms. That being said, JS isn't a bad *language* per-se in reality, once you understand the

      • Quit thinking of JS as object-oriented. Just stop. Yes, it has some OO cludges, and it can kinda-sorta-not-really do objects, but it's much closer to a functional language.
        • But that's my point.

          Teaching kids JS first then real OO languages later will confuse the crap out of them.

          Having experience with a real OO language, or something close to it, will help students cope with general JavaScript wackiness.

          • JavaScript is indeed a terrible language for learning. I would give a total noob the old line-number BASIC before I would give them JavaScript.

            But even better would be a later version of QuickBASIC. It was ANSI-standards compliant, compiled (with an interpreter also for development), and supported line numbers so you could teach that as an absolute rock-bottom start if you wanted. But it was also fully procedural, in that you could define your own procedures and functions and call them, with no need for
        • "Quit thinking of JS as object-oriented. Just stop. Yes, it has some OO cludges, and it can kinda-sorta-not-really do objects, but it's much closer to a functional language."

          I mostly agree, except I think you mean "procedural" language. These days, "functional" language means something else.

        • JavaScript is not any more functional than C#.

          I mean, sure, technically it is - if you use the pedantic definition of "functional" which is "has functions as first-class values". A more pragmatic definition revolves around things like immutability, rich type systems (ADTs etc) and related features (like pattern matching) and various other bits. By that criteria, no, JS is not a Functional language.

      • JS is a horrible language, but the principles it is made from are the same across all languages.

        It has foreach loops, it has while loops, it has if statements, it has user input and output....

        I'm doing a BSc in Computing and Mathematical Sciences at the moment with the Open University (a renowned UK distance learning university), and the first computing module (which, even tho I have a decade of experience in computing I cannot skip) uses JS to introduce the basics of programming. I don't see anything wron

      • by vlm ( 69642 )

        I was thinking more along the lines of newbies who are still learning the concept of sequential execution, the concept of breaking down a big problem into little tasks, the concept of a flowchart and what it represents, or even the general idea that variable assignment, control flow statements, and recursion exist. What is a picket fence mistake? That type of basic learning.

        Data structures and algorithm design and big O notation is pretty far beyond really newbie stuff like "how can a computer be told to

      • by Inda ( 580031 )
        So true.

        They should have chosen Perl. ;p
      • by drolli ( 522659 )

        No, with the new nonrelational database you dont need to think about types, so i heard. Just spill whatever you have and use whatever keys you have. No need to prove it works.

      • I'm thinking along the lines that now that you experienced an unsophisticated language to whet your appetite, you'll fully appreciate the much better suited languages later in the CS curriculum.

        It's CS101. I don't even remember what rudimentary language I had to learn for that *intro* class. It's not like Stanford is dictating that javascript will be taught in all classes.

        You have to admit that if you run a CS degree program and you want to look "hip", "current", "bleeding edge", or "relevant" what is be

      • oh god no.

        JS is a HORRIBLE language to teach newbies.

        From my point of view, JS is a horrible kludge of compromises

        You either don't know enough about javascript or aren't familiar with language design. Javascript itself is actually a very nice weakly typed [wikipedia.org] prototype based [wikipedia.org] object oriented [wikipedia.org] functional [wikipedia.org] language. Forget browsers and the DOM and all that stuff. That's not javascript. That's a very specific (and shitty) javascript runtime. Pure javascript aka ECMAScript is a nice little language with first class functions and closures. You can write in very elegant functional style that is immediately comfortable to Comm

    • by gl4ss ( 559668 )

      basic inside a c64 emu they ran inside an emulator that ran in js would have done the job. it doesn't hurt. and it's stanford ffs, not 9th grade, doesn't matter if they there to learn chemistry they still should learn the tools of the trade, the tools of information handling and that's computers.

      nothing you do with js is mature. and what ideal IDE are you speaking of? seriously. what's an ideal actual ide for js and what's an ideal way to deploy something written in js as deployable, "stand alone" program?

    • Re: (Score:3, Informative)

      by Anonymous Coward

      JS is indeed a bad language if you care at all about syntax or sanity.
      Here's a couple from Stackoverflow [stackoverflow.com].

      In JavaScript:
      '5' + 3 gives '53'

      Whereas
      '5' - 3 gives 2

      the following construct
      return
      {
      id : 1234,
      title : 'Tony the Pony'
      };

      is a syntax error due to the sneaky implicit semicolon insertion on the newline after return. The following works as you would expect though:
      return {
      id : 1234,

  • by sunderland56 ( 621843 ) on Monday July 11, 2011 @02:47PM (#36724458)
    Does anyone really get admitted into Stanford without being able to program already??
    • George Bush got into Yale. Anything is possible.

      • by jmorris42 ( 1458 ) *

        > George Bush got into Yale. Anything is possible.

        One can argue he got into Yale as a legacy because of Bush Sr., however that doesn't explain also getting a degree from Harvard and having grades on par with "super smart" Al Gore or Kerry. Btw, when are we going to actually see the grades of the 'smartest man to ever sit in the Oval Office?' Time to face up to reality, W isn't stupid and making fun of a minor speech impediment on anyone else would get you sent to the reeducation camp because making jok

    • by ccguy ( 1116865 )
      I'm sure lots of people gets admitted thinking they are able to program.
    • by Dahamma ( 304068 ) on Monday July 11, 2011 @03:14PM (#36724992)

      The summary is awful.

      First, this isn't even recent news, it was added *last* year.

      Second, this isn't an intro course for CS majors (or even any engineering major, or hell, even a non-engineering major interested in programming). It's basically a really high level intro to computers and "programming principles" for "fuzzies" with an irrational fear of computers (which as you say, is definitely a small group at Stanford).

      Though the lecturer (Nick Parlante) is awesome, so it's probably a fun class, and might even get some people interested in taking the real intro to programming class (CS106A).

      • by dweinst ( 218284 )

        Javascript coding was a key part of Stanford's CS105 (Intro to CS for non-majors) 10 years ago when I TAd it... same reason - the goal was to show fuzzies as much as possible and hopefuly spark an interest or at least rudimentary appreciation of the topic. Parlante is indeed a fantastic lecturer, but I'll never forgive him for pre-Java BunnyWorld. ;)

    • Yeah, like non-CS majors.
    • As someone who has taught classes at top universities (although not Stanford), I just have to say that the answer to this question is a resounding *yes*! In the time since computers because a thing that "everyone can do" (and not just geeks), users have become significantly less geeky. I'm a scientists and I was shocked at the number of incoming *PhD* students who have close to zero programming experience. I'm a crap programmer, but have the basic skills to hack together what I need. A lot of the students I

      • I'm a scientists and I was shocked at the number of incoming *PhD* students who have close to zero programming experience.

        PhD students in what fields? Most of the PhD types I've worked with were environmental/meteorological types, and that scientific endeavor has a long-standing and time-honored tradition of writing your own code, or maintaining your PhD advisor's. Badly. In undocumented FORTRAN. But it's programming. Even patching circa-1969 FORTRAN IV only recently transcribed from punched cards counts

    • by Meddel ( 152734 )

      I did, as did many of my classmates in the CS department. The important bit is that Stanford does their admissions for the school as a whole. Not the School of Engineering, and certainly not individual departments. Everyone shows up undeclared and has to figure out where they want to be.

      Predictably, many people know right away or after freshman year. But there isn't actually a requirement to declare a major until it's time to get a degree. Personally, I was taking classes like an Econ major for two years, a

    • by jpapon ( 1877296 )
      Right. I'm pretty sure this course is for non-cs majors. I went to Stanford, and I promise that no serious CS major is taking this course anyways. They will already have had 2-3 years of programming in HS.
  • by wsxyz ( 543068 ) on Monday July 11, 2011 @02:47PM (#36724462)
    Why wouldn't they use javascript? I think it's a much better learning language than most of the alternatives (java) because not drowning in crufty committee-designed latest-fashion constructs. It's got all of the iterative basics, but it's also got it's lispy functional side. And it's simple.
    • Why wouldn't they use javascript? I think it's a much better learning language than most of the alternatives (java)

      Java is not "most of the alternatives" to JavaScript as a learning language.

  • by Mia'cova ( 691309 ) on Monday July 11, 2011 @02:47PM (#36724468)

    cs101 without even seeing a compiler? Tragic :)

    • cs101 without even seeing a compiler? Tragic :)

      MIT's CS 101 course used to use a book called "Structures and Interpretation of Compter Programming" and was based on a LISP-variant called MIT Scheme. No compiler. Now, I think they use Python. Still no compiler.

      Javascript isn't half bad of a language to use for an intro course, although I think it is far from ideal. Javascript as implemented in a browser, with the DOM and all is kind of a mess. Having examples to run in a browser is a nice perk though. You get to mess with a GUI without knowing muc

      • by vlm ( 69642 )

        Having examples to run in a browser is a nice perk though. You get to mess with a GUI without knowing much more than HTML.

        In the 80s there was an absolute fixation on teaching kids control flow etc by making them write little animated graphics on apple2s and C64s using basic. We mostly turned out OK anyway. This is pretty much the 10s version of the same concept, kids like looking at things.

        • by Trepidity ( 597 )

          I think it highlights some of the angles of CS that are actually important as well. It's not just about learning a set of tools, but about a sort of meta-skill of computational thinking: conceiving of ways that you can code procedures to do things, and understanding how changing code will result in changed doing-of-things. For an intro class, quick visual feedback so you can see that changing your code made different stuff happen on screen is a nice way of highlighting that, as well as hopefully building st

      • Certain versions of Scheme are compiled. My Intro to CS course was taught in Chez Scheme and it's interpreted variant Petite Chez Scheme by the man who actually wrote the compiler. A compiler does not make a better programming language, it just makes a faster one. It's not like these kids are going to be writing anything that's going to perform that much slower in an interpreted vs. a compiled language.

        However, JavaScript is not a good beginner language because of its inherent workarounds. The biggest i

      • Let me be more specific. A c-style language that isn't type-safe can be a royal pain in the ass to debug if you don't know what to look for. While compilers can often give "cryptic error messages," students aren't going to have too much more fun when their scripts aren't working. Maybe the fun/power of the browser will make up for some of it and keep people interested. And these days, learning the structure of the web is fairly important and fundamental. Still, it sounds more like an "introduction to web pr

    • A little bit of reading shows that CS101 is for people who essentially have no computer experience. I don't think its part of a CS major as much as it is a class other majors can take to meet a computer requirement.

    • I thought most popular javascript implementations do have a JIT compiler inside.

  • This might be a good thing. We might actually have some people learn how to develop proper java script instead of most of the junk that is churned out now. My first real language was pascal (I knew the old apple soft basic but that was a kludge at best), granted it wasn't the easiest to learn but you did get a feel for structure using it.
  • Douglas Crockford explains why you think JavaScript is a bad programming language: http://www.crockford.com/javascript/javascript.html [crockford.com]
    • by Tablizer ( 95088 )

      Replies by topic:

      The Name - Perhaps confusing, but if you let the OSS community name it, it would be something like "Sniffdrivel" or "Gorf".

      Lisp in C's Clothing - This is not necessarily a bad thing unless you are complaining it's not Lisp itself.

      Typecasting - Everybody has their favorite type management techniques, and nobody will ever agree on which is the best. Some do argue that strong or strict typing is better for making general-purpose software tools, and loose or non-typing is better for custom end

  • by smoothnorman ( 1670542 ) on Monday July 11, 2011 @02:52PM (#36724572)
    Has Professor Knuth no longer any proper influence over those at Standford? http://en.wikipedia.org/wiki/MIX [wikipedia.org]

    [curvy bend] Task 4.2.31: Write a LALR parser for MIX in Javascript

    • by Nimey ( 114278 )

      Probably they don't want to scare off the freshmen by diving right into assembly.

      • Re:whither MIX? (Score:4, Insightful)

        by idontgno ( 624372 ) on Monday July 11, 2011 @03:41PM (#36725356) Journal

        You have to separate the Real Programmers from the whiny trembling wannabees. Assembler is the equivalent of using blanks during "live-fire" training. Any high-order language is like a bunch of guys shouting "POW! POW! BANG! RATATATATAT!" at the trainees while they lackadaisically low-crawl through the not-very-muddy mud.

        If you want programmers that won't flinch when the loading ramp on the assault boat drops, you need to start them on machine code. Maybe a rational and internally-consistent architecture, like VAX; after all, this isn't special forces training. (For that, we should use architectures like Intel 80286.)

        • If you want programmers that won't flinch when the loading ramp on the assault boat drops, you need to start them on machine code.

          MOV, MOV, MOV!

    • Has Professor Knuth no longer any proper influence over those at Standford?

      Probably not. He's been Emeritus for a while now.

  • While MIT used Scheme as an introductory programming language, as seen in the legendary Wizard Book [mit.edu], in 2011 Stanford have dumbed down CS introductory classes to ... what? JavaScript? Sad, just sad.
  • Linked lists. Recursion. Calling by reference. Strong typing. Explicit declaration (or at least the need of it). There are some ways around those, but these hacks are even going to warp their minds worse than not learning those things would.

    Of all the languages out there, why JS? Aside of VB there's no worse choice to learn programming. Sure, it offers quick satisfaction, but when you hit the wall (and you do soon in JS), you hit it hard because what you learned will not translate well into a more powerful and flexible language.

    • by wsxyz ( 543068 )
      Hmmm....

      cons = function(a,b) { o=new Object(); o.car = a; o.cdr = b; return o; }
      car = function(o) { return o.car; }
      cdr = function(o) { return o.cdr; }
      find = function(o,t) { if (o == null || car(o) == t) return o; else return find(cdr(o),t); }
      p = cons(1,cons(2,cons(3,cons(4,null))));

      > find(p,2)
      Object
      > find(p,5)
      null

      Ok, you're right. It sucks.
    • When I was in jr. high we studied logo. It was useful in that it separated those with interest from those without, and quickly. Same here.

    • Linked lists. Recursion. Calling by reference. Strong typing. Explicit declaration (or at least the need of it). There are some ways around those, but these hacks are even going to warp their minds worse than not learning those things would.

      None of which are important to the process of problem analysis and programming, though obviously those are important tools for implementing programs in some common languages, which are sometimes used for good reasons. They are certainly things that are important to learn

    • by IICV ( 652597 )

      Linked lists. Recursion. Calling by reference. Strong typing. Explicit declaration (or at least the need of it). There are some ways around those, but these hacks are even going to warp their minds worse than not learning those things would.

      Umm just so you know (since you seem to be having such a good time bitching about it), the normal Stanford undergraduate computer science curriculum does not include CS 101. The first programming class CS majors will take is one of the versions of [stanford.edu] CS 106, and they'll go

    • Because they are not learning CS with this class but how a computer works. This class is meant for humanities students who never took a "computer" class and looks very good for that purpose. Did you really think that the Stanford CS curriculum will stop teaching recursion...?
    • Linked lists. Recursion. Calling by reference. Strong typing. Explicit declaration (or at least the need of it). There are some ways around those, but these hacks are even going to warp their minds worse than not learning those things would.

      What on earth makes you think you can't write a linked list, use recursion or call by reference in Javascript? You can even use strong typing and explicit declaration through programming practice (though if you omit them, it won't complain, so you can't enforce their use.)

    • by Panaflex ( 13191 )

      Uh, maybe because this course is for those seeking their 1 credit hour of computer science required to graduate - and likely the only language most of these folks will *ever* see or use is Javascript.

      I think it's a fantastic idea actually. Yes, JS is convoluted and a bit strange. But, perhaps they will learn a thing or two as they go on to manage their fellow compsci graduates in the future.

    • Linked lists. Recursion. .

      What???? Are you saying that you can't write a linked list or do recursion in javascript?

  • by ToSeek ( 529348 ) on Monday July 11, 2011 @03:04PM (#36724810)
    The James Webb Space Telescope - if it's ever actually launched - will run its onboard science operations using scripts written in a tailored version of JavaScript.
  • for non cs majors. But there's a big gap between javascript and languages like C++, Java, etc, and it seems like you'll just waste time in future CS courses having to make up for that.
  • I was trying to remember what my CS101 equivalent was 30 years ago.

    Turns out, I didn't have one. I got to skip it because the programming and math curriculum in my high school was strong enough that the university credited me.

    So, then question became, "WTF do they teach in a CS101 class?"

    Turns out, a whole bunch of miscellany. Rudiments, elements, cats, dogs, little green ponies. Stuff I though people picked up by osmosis nowadays.

    So, if they're not trying to teach Architecture and Organization (mainframe a

  • by Animats ( 122034 ) on Monday July 11, 2011 @03:43PM (#36725386) Homepage

    It's a reasonable language in its modern form. It has a reasonable, if not great, syntax. (Compare Perl.) Someone wrote that it doesn't support recursion. Yes, it does. It even supports closures. The object model is adequate, if not inspired. It's a memory-safe language. About the only thing it doesn't support is concurrency.

    The current generation of JIT compilers do a reasonably good job on performance. Free implementations are easily available. So there's no problem running it.

    The problem with Javascript is mostly that the code quality seen on many web pages is appallingly bad. (Or, alternatively, the source code has been run through some obfusicator/compressor.) That's not the fault of the language. Javascript's interface to browsers is also rather clunky; the primitives for manipulating the DOM were ill-chosen. But, again, that's not a language problem.

  • by comp.sci ( 557773 ) on Monday July 11, 2011 @04:04PM (#36725698)
    To clarify, this class is a cursory overview of how computers work, a few basics on whats makes them tick and how to make them do fun things. This class is meant as a general education "learn about computers" effort, this is NOT their intro to CS class. Look at CS106X for programming, CS103X for discrete math, ... To repeat: Stanford is NOT teaching CS majors javascript, they are showing off what computer can do for humanities students with CS101. On a side note: I can see why most commenters would not catch this but how did the editors miss this obvious fact? Do a tiny bit of background research (aka click their link) and you will see how this summary is entirely misleading.
  • It's a first semester course, introducing elementary concepts in programming such as variables, data types, control structures, and input and output. Any programming language which has those standard features and isn't too far from the mainstream of programming languages really ought to fit the bill, and the simpler, the better.

    The introductory course in programming I took used C++, but really, most of the material was in pseudocode; the idiosyncracies of C++ were a distraction, for the most part.

  • The first few examples do not appear to be Javascript. It's implemented in Javascript, yes, but Javascript does not have the BASIC-like functionality that is used in the examples.

"If it ain't broke, don't fix it." - Bert Lantz

Working...