Stanford is moving from using Java to JavaScript for their intro CS course
computinged.wordpress.com
computinged.wordpress.com
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.
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.
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)
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.
Your example has nothing to do with OOP. It's simply how python handles variable scope outside of a class.
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.
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".
Plus you get types hints for free, and safe auto completion too.
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
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.
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/). 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.
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.
I assume they're referring to self-teaching outside of class.
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.)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.
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.
You just can't make it through modern engineering if you can't use _matlab_, and it's easy if you've already finished C.
Old YTMND jokes aside, I did it this way too, and didn't learn to enjoy computing for a long time after that.
To use your example, someone used to Python and its "infinite precision" bignums may become confused and frustrated by the fact that lower-level languages actually have limits on how big their integer types can be (and the behaviour that occurs when they overflow), while someone starting from the other end will, understanding how data is represented, find it a natural consequence of the fact that bits, register sizes, and memory are finite. They will also understand that, for the vast majority of calculations, this is perfectly fine; and when it isn't, to switch to bignums and understand the associated overhead.
CS is not like traditional science in that the majority of the time people are focused on building new systems instead of analysing existing ones (although I'm not saying that RE/analysis is not important --- in fact, quite the opposite.) Thus I think a bottom-up approach will be superior.
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.
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.
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".
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.
I took Pacal first semester and then C++ the next, and the Pascal course really helped. As I was graduating, Java replaced C++.