Stanford's CS 101 course uses Javascript
stanford.edu
stanford.edu
The full CS course listings are here:
http://explorecourses.stanford.edu/CourseSearch/search;jsess...
Yes, MIT shifted to Python for intro level CS classes. CMU is doing that following this fall.
I'm not sure I agree with you that language is irrelevant to material. I definitely notice the influence of scheme on my thought-processes when programming.
106A is taught it Java. (It was taught in C until 2004. It's nice to be able to teach for-loops without also having to explain pointers.)
106B is taught in C++.
107 is now the first introduction CS students get to C and Unix. While 106B focuses on basic algorithms and learning to use abstractions, 107 goes into the guts of low-level C.
108 is on OOP and is taught in Java.
Higher level classes are either in C++ (all the systems classes) or Java (e.g., Natural Langauge Processing).
CS 101M was half java and half matlab
CS 101J was mostly java with a week or two of matlab (recommended for CS majors)
After this class (or the AP test) our next two classes to qualify for the major were in Java and SMLNJ.
Interestingly, our algorithms class (considered upper level but required) was purely theoretical (no programming at all).
That was 1997, I have no idea what's done there now.
Generally the more mathematical based courses like Digital Signal Processing use MATLAB, Operating Systems and Algorithms in C, Graphics (Computer Graphics, Animation, etc) in C++, Object Orientated Programming in C++, and Principles of Programming Languages (Compiler Design, Grammars, Scoping etc..) in Scheme and C/C++.
All other courses give the student free reign on what language they choose. It's interesting to note that atleast from my year there seems to be a uniform distribution of C#,C++,Java,Python, and Perl used in these courses. They tend to be the more project based such as Information Retrieval, Network Computing, Software Engineering etc.
However, a large amount of the faculty no longer supports Java as the language that is taught in first year computer science (Java and C are the only languages that are taught in class at all) and moving towards Python after they have had great success in the last several years with intro courses for non-cs majors.
One comment: Maybe, I'm the only person in the world so tired and stupid. But at first I got the impression that it didn't execute in chrome or was so slow that it takes forever. So I fired up Firefox to test it there. Only then, did I realize, that the new computed picture would show up to the right of the code. I had zoomed in too much in chrome. I guess the average Stanford student is smarter, but if you would force the picture to be below the code you might have one source of confusion less.
>I need to add the ability to use any image you want, not just the canned ones I have. This is not some feature I just left out. It turns out that the browser/javascript system deliberately screens out access to images coming from other domains
i solved this here http://www.barbafan.de/farbzauber/w but yeah, u need some server side code that takes an url and returns the image data as a base64 string, i havent found another workaround yet and i doubt that there is one.
for (var x = 0; x < im.getWidth(); x++) {
for (var y = 0; y < im.getHeight(); y++) {
That would repeatedly call the get*() methods, and for a 1000x1000px image, that is a lot of calls. Better call them once and then use variables for the loop boundaries. var w = im.getWidth()
var h = im.getHeight()
for (var x = 0; x < w; x++) {
for (var y = 0; y < h; y++) {y = x + x + x
instead of
y = x * 3
The real author the assignment clearly knew that for the particular machine it was executing on that 3 addition ops were faster than a multiply and couldn't help themselves.
When questioned as to why this was, the student couldn't explain the meaning of the expression and the jig was up
For JavaScript, you get all sorts of additional complications depending on how good your JIT is. For example, you have to check both integer addition and integer multiplication for overflow (at which point you have to recompile as doubles) unless your interval analysis is good enough. So the cost is more than just the cost of the machine add in some cases.
In practice, I'd be suprised if current JS JITs do strength-reduction in this case. They might get there sometime in the next few years, but there's lower-hanging fruit to be had so far.
If you're trying to make sure that your compile times are also short, it might not be worth it.... yet.
but yes, i agree with you that for an intro class, students should focus on writing clear code and then optimizing for performance later.
Two more lines worth it.
Since storing it will require width-1 less calls to im.getWidth() it is much more efficient no matter how you slice it.
The only advantage over teaching Python was that they planned to teach us Java later, and the syntax is more similar.