Slashdot Mirror


Stanford CS101 Adopts JavaScript

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

31 of 255 comments (clear)

  1. Big Improvement! by Anonymous Coward · · Score: 2, Funny

    When I was in school we had to use ECMAScript!

  2. Ideal IDE by vlm · · Score: 3, Interesting

    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.

    --
    "Science flies us to the moon. Religion flies us into buildings." - Victor Stenger
    1. Re:Ideal IDE by djdanlib · · Score: 3, Funny

      JavaScript is analogous to McDonald's. Sure, it's cheap, they have plenty of options and they are everywhere, but there's much better stuff out there.

    2. Re:Ideal IDE by Bob+the+Super+Hamste · · Score: 2

      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 but I never used them when in school.

      --
      Time to offend someone
    3. Re:Ideal IDE by RyuuzakiTetsuya · · Score: 2, 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 limitations it presents, and as well, how to best wring out functionality out of it's flexibility.

      --
      Non impediti ratione cogitationus.
    4. Re:Ideal IDE by memyselfandeye · · Score: 3, Insightful

      It's Ok. Next year they'll be teaching Rails.

      Q) Can you tell me the difference between FIFO and LIFO?
      A) Nope, but I can open a new window on a browser using BOTH client side and server side scripting. That's because I went to Stanford. It's a totally cutting edge difficult school!

      Seriously though, I think this has to be a very introductory course for CS students with zero programming experience or a light course for non CS students. By the start of their second year, Stanford CS students will be doing Operating System Designs in C, I checked their curriculum. It's exactly the same as mine 10 years ago. Our intro was parsing text and learning loops in C, and most kids needed a crap load of help to get Borland going on their computer. I can totally understand using a scripting language that just needs a browser. It probably could have been harder for me and these guys, but most of us were/will be struggling enough in chemistry and electronics 101 to give a fart. By year 2 they'll be writing buffer outputs in ASM and building disk caches in C. Should they go on to graduate school, they'll be writing in languages their advisor has developed that many 3 other people on the planet have any familiarity with.

      I remember my first job interview. "Give me a book and a couple weeks" was the answer to "We think you'll be a good fit, but what other languages can you program in."

    5. Re:Ideal IDE by _0xd0ad · · Score: 3, Informative

      Q) Can you tell me the difference between FIFO and LIFO?

      Javascript arrays have push(), pop(), shift(), and unshift() methods. If they fail to teach FIFO and LIFO, they can't blame it on Javascript.

    6. Re:Ideal IDE by Anonymous Coward · · Score: 3, Informative

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

      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,
              title : 'Tony the Pony'
      };

    7. Re:Ideal IDE by matthewv789 · · Score: 2

      No, I think he means "functional". Haven't you heard Douglas Crockford's quote that Javascript is "Lisp in C's Clothing"?

      (http://www.crockford.com/javascript/javascript.html)

    8. Re:Ideal IDE by shutdown+-p+now · · Score: 2

      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.

  3. First programming course? At Stanford?? by sunderland56 · · Score: 2

    Does anyone really get admitted into Stanford without being able to program already??

    1. Re:First programming course? At Stanford?? by Dahamma · · Score: 4, Informative

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

    2. Re:First programming course? At Stanford?? by Betelgeuse · · Score: 2

      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've taught (as well as grad students who were slightly-younger contemporaries of me) had shockingly little (sometimes no) programming experience.

      --
      I couldn't tell if you were experimenting with poor-man's cryogenics or looking for the orange sherbet.
    3. Re:First programming course? At Stanford?? by dweinst · · Score: 2

      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. ;)

  4. Good idea... by wsxyz · · Score: 2

    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.

  5. No compiler? by Mia'cova · · Score: 2

    cs101 without even seeing a compiler? Tragic :)

    1. Re:No compiler? by Fantom42 · · Score: 2

      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 much more than HTML.

    2. Re:No compiler? by vlm · · Score: 2

      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.

      --
      "Science flies us to the moon. Religion flies us into buildings." - Victor Stenger
  6. whither MIX? by smoothnorman · · Score: 2
    Has Professor Knuth no longer any proper influence over those at Standford? http://en.wikipedia.org/wiki/MIX

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

    1. Re:whither MIX? by idontgno · · Score: 3, Insightful

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

      --
      Welcome to the Panopticon. Used to be a prison, now it's your home.
    2. Re:whither MIX? by shutdown+-p+now · · Score: 2

      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!

  7. The things they will NOT learn are interesting by Opportunist · · Score: 2

    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.

    --
    We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
    1. Re:The things they will NOT learn are interesting by wsxyz · · Score: 2

      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.

    2. Re:The things they will NOT learn are interesting by matthewv789 · · Score: 2

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

    3. Re:The things they will NOT learn are interesting by StripedCow · · Score: 2

      Linked lists. Recursion. Calling by reference.

      It is not difficult to program linked lists in javascript. Recursion is also possible, and in fact quite natural to use. Objects are passed by reference by default, so no problem there either.

      Strong typing.

      This becomes an issue only when the system you're building becomes large and complex. In a CS101 class, this will not be the case. So I think it is reasonable to leave type-checking for a more advanced course.

      --
      If Pandora's box is destined to be opened, *I* want to be the one to open it.
  8. Javascript on the James Webb Space Telescope by ToSeek · · Score: 3, Insightful

    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.

  9. Re:A long way from SICP by Samantha+Wright · · Score: 2
    --
    Bio questions? Ask me to start a Q&A journal. Computer analogies available for most topics!
  10. What's wrong with JavaScript for CS? by Animats · · Score: 2

    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.

  11. Re:Why not PL/1? by Dast · · Score: 2

    Oh good glub that brought back some horrible memories.

    If I could think of a language with a syntax worse than JS, it would be PL/1. I just LOVE letting programmers use keywords as variable names, throwing up my hands and saying, "let the compiler figure this isht out!"

    Excuse me while I go kill myself.

    --

    This sig is false.

  12. Important: This is NOT their "Intro to CS" class by comp.sci · · Score: 4, Informative

    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.

  13. Scheme? Nope. by Estanislao+Mart�nez · · Score: 2

    Repeat after me: "JavaScript is Scheme in C's Clothing."

    Ok, let's test this claim:

    1. Does Javascript have anonymous lexically scoped closures? Yes.
    2. Does Javascript have tail call optimization as an implementation requirement? No.
    3. Does Javascript have first-class continuations with unlimited extent as an implementation requirement? No.
    4. Does Javascript have hygienic macros? No.

    Score: 1/4. I call this a failing grade.