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."
Big Improvement! (Score:2, Funny)
When I was in school we had to use ECMAScript!
Re: (Score:2)
Re: (Score:2)
Baah. When I was a kid, all we had was BASIC, and we liked it. And when I went on to write missile system control code, I continued to use BASIC, and it worked well and reliably, most of the time. It wasn't my fault we blew up New Jersey by accident. It's a good language and all anyone reasonably needs. You and your fancy object-oriented code and your multi-threading and your complexity. Phooey. All I need is PEEKS and POKES and a 1MHz 6502 and by god I can do nearly anything. I was using Agile methods to
Ideal IDE (Score:4, 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.
Re: (Score:3)
Re: (Score:2)
Got me to learn about user created functions much quicker than the artificial limits imposed by goto w/ line number.
Re: (Score:2)
Re: (Score:2)
Me neither; but goto still has it's place. I'm digging into writing a forth-like scripting language interpreter/compiler, and I may end up having a huge central loop that relies on dozens if not hundreds of gotos. For this particular problem, that looks to be the clearest and cleanest solution... better than function vector arrays, or other ways of solving it.
I had to look up the syntax for g
Re: (Score:2)
Re: (Score:2)
We use goto's all the time in C code. There's nothing wrong with their use. We often use them in a similar way to "try/catch" scenarios.
For instance, we have macros like such::
#define MEMORY_CHECK_GOTO_DONE(x) if(x == NULL) { err = REPORT_ERROR("Allocation failed", ERROR_ALLOCATION); goto DONE }
Works nicely and far fewer typos - which is what you need when you're writing a lot of code.
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
Re: (Score:2)
Re: (Score:2)
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.
Re: (Score:2)
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
Re: (Score:2)
"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.
Re: (Score:2)
I think he actually meant functional -- Javascript has a lot of features that would be called as such.
Re: (Score:2)
Re: (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)
Re: (Score:2)
Re: (Score:3)
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.
Re: (Score:2)
What GP said about JavaScript OO: "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."
That works better for C++ (with "functional" replaced with "procedural") than it does for JavaScript in its original form.
(Yes, yes, for lots of people "object
Re: (Score:2)
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
Re: (Score:2)
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
Re: (Score:2)
They should have chosen Perl.
Re: (Score:2)
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.
Re: (Score:2)
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
Re: (Score:2)
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
Re: (Score:2)
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)
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,
Re:Ideal IDE (Score:4, 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.
Re: (Score:2)
Well, the same is true of javascript. Stanford can use it to teach coding fundementals and still allow the kiddies a much easier transfer to say java, C++, and C.
Re: (Score:2)
And like McDonalds, it works great for the little ones. Sadly, my kids love it because of the playground and toys. Other than not being healthy and employing loads of illegals, it is not that bad.
Well, the same is true of javascript. Stanford can use it to teach coding fundementals and still allow the kiddies a much easier transfer to say java, C++, and C.
Javascript employs loads of illegals?
Re: (Score:2)
Re: (Score:2)
Just like a generation learned computer programming from their C64, I think there's a lot of kids learning programming now from making flash animations, and digging into actionscript to get a few extra functions. Then, hopefully, they move to full programs in actionscript, then start studying other languages.
Re:Ideal IDE (Score:4, 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."
Re:Ideal IDE (Score:4, 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.
Re: (Score:2)
Javascript arrays have push(), pop(), shift(), and unshift() methods. If they fail to teach FIFO and LIFO, they can't blame it on Javascript.
They shouldn't be able to blame it on JavaScript, anyway. I went to a college that had nowhere near the prestige of Stanford, but in my CS101 and CS201 courses, we were programming push() and pop() functions ourselves.
The difference between a master of some art and a mere practitioner of the same art is that, if the master doesn't have the tool he needs to accomplish a specific task, he'll build it, whereas the practitioner will grouse that he doesn't have the tools he needs to do the job properly and e
Re: (Score:2)
Mine was IBM/360 assembler, actually. I guess that makes me really old. :-)
Re: (Score:2)
MIT did that back in the early '90's. Maybe that was the inspiration?
First programming course? At Stanford?? (Score:3)
Re: (Score:2)
George Bush got into Yale. Anything is possible.
Re: (Score:2)
> 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
Re: (Score:2)
Re:First programming course? At Stanford?? (Score:5, 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).
Re: (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. ;)
Re: (Score:2)
Wow, sounds like CS107 has changed a lot. I think it used to be called something like "Programming Paradigms" - it was basically "a language a week", going through C, C++, FORTRAN, LISP, Prolog, etc (and taught by Parlante at the time, actually). Then again, that was a while ago - CS106 was still taught in Pascal ;)
Re: (Score:2)
Re: (Score:3)
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
Re: (Score:2)
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
Re: (Score:2)
Re: (Score:2)
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
Re: (Score:2)
Good idea... (Score:3)
Re: (Score:2)
Java is not "most of the alternatives" to JavaScript as a learning language.
No compiler? (Score:3)
cs101 without even seeing a compiler? Tragic :)
Re: (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 muc
Re: (Score:3)
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.
Re: (Score:2)
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
Re: (Score:2)
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
Re: (Score:2)
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
Re: (Score:2)
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.
Re: (Score:2)
I thought most popular javascript implementations do have a JIT compiler inside.
Might be a good thing (Score:2)
Douglas Crockford explains... (Score:2)
Re: (Score:2)
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
whither MIX? (Score:3)
[curvy bend] Task 4.2.31: Write a LALR parser for MIX in Javascript
Re: (Score:2)
Probably they don't want to scare off the freshmen by diving right into assembly.
Re:whither MIX? (Score:4, 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.)
Re: (Score:3)
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!
Re: (Score:2)
Has Professor Knuth no longer any proper influence over those at Standford?
Probably not. He's been Emeritus for a while now.
A long way from SICP (Score:2)
Re: (Score:3)
Scheme? Nope. (Score:2)
Repeat after me: " JavaScript is Scheme in C's Clothing [crockford.com]."
Ok, let's test this claim:
Score: 1/4. I call this a failing grade.
The things they will NOT learn are interesting (Score:3)
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.
Re: (Score:3)
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.
Re: (Score:2)
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.
Re: (Score:2)
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
Re: (Score:2)
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
Re: (Score:2)
Re: (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.)
Re: (Score:2)
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.
Re: (Score:2)
Linked lists. Recursion. .
What???? Are you saying that you can't write a linked list or do recursion in javascript?
Re: (Score:2)
Exactly. At my college, a CS 101 class was for interdisciplinary programs, anyway (and was taught in VB). My CS degree started with 201, where we dove right into C++; classes, pointers and all.
Re: (Score:2)
Re: (Score:2)
I disagree. Most of that stuff is peripheral to the important skills in programming. (Though they are important skills to coding in certainl languages.) The later you get people to focus on those kinds of low-level details, the better, more flexible programmers they will end up being.
Minimize those kind of incantantions, and students can focus on problem analysis, logical design of the solution, and implementation of the so
Re: (Score:2)
Re: (Score:2)
Hxadecimal numbers, 2s complement and so on were covered in a separate class here, translated it would be called "theoretical CS". And IMO that's where thy belong, they have nothing direct to do with algorithm development.
Re: (Score:3)
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.
Re: (Score:2)
You can do linked lists in JS. You can also deliver a metric ton of flour with your Austin Mini. Neither is very sensible, though.
Javascript on the James Webb Space Telescope (Score:4, Insightful)
Looks like a solid class (Score:2)
I guess I'm old (Score:2)
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
What's wrong with JavaScript for CS? (Score:3)
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.
Important: This is NOT their "Intro to CS" class (Score:5, Informative)
Does the specific language really matter much? (Score:2)
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.
Not really Javascript (Score:2)
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.
Re: (Score:2)
PL/1? That was my intro lang in 79 @nyu. I had no prob with the lang it was great to
learn on, the real snag was punch cards and only getting 2 - 3 runs in in a 12hr day at the
data center.
Re: (Score:2)
Re: (Score:3)
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.
Re: (Score:2)
Straight C would be best, imo. Less noise and clutter getting in the way. I think getting people writing simple programs as fast as possible is important, so that they can keep their interest, so that they can play. If you start trying to teach programming by first trying to force people to use more abstract concepts, such as OO, many of them will just hit a brick wall.