I'm struggling with figuring out which programming language to teach students would provide the most effective learning experience.
It's easy to find tons of statistics showing how Java is the most popular language with tons of community and books, etc. That, however, doesn't say very much about the learning experience of the student at all, or what the students will come away with.
I found the following from a respected hacker in the community, for example:
"For example, if your company wants to write some software, it might seem a prudent choice to write it in Java. But when you choose a language, you're also choosing a community. The programmers you'll be able to hire to work on a Java project won't be as smart as the ones you could get to work on a project written in Python. And the quality of your hackers probably matters more than the language you choose. Though, frankly, the fact that good hackers prefer Python to Java should tell you something about the relative merits of those languages.
"Business types prefer the most popular languages because they view languages as standards. They don't want to bet the company on Betamax. The thing about languages, though, is that they're not just standards. If you have to move bits over a network, by all means use TCP/IP. But a programming language isn't just a format. A programming language is a medium of expression.
"I've read that Java has just overtaken Cobol as the most popular language. As a standard, you couldn't wish for more. But as a medium of expression, you could do a lot better. Of all the great programmers I can think of, I know of only one who would voluntarily program in Java. And of all the great programmers I can think of who don't work for Sun, on Java, I know of zero." (Great Hackers, Paul Graham, 2004)
So essentially, the idea here is that if you choose a language based on whether it's the popular "standard", you've lost sight of the fact that programming is very much an art, and the language is a medium of expression — why would anyone wish upon students the torture of a lesser blub language?
The better language is Python, according to the best hackers in the community known to Graham (and he knows plenty, given what he does as his "day job" now).
Consider this, also from a respected hacker in the community:
Here the essential idea, I think, is that Java can help you build stuff, but it doesn't help you very much in learning to think and express your thoughts programmatically. Being good at putting together code in Java that uses what other people have written doesn't help you solve problems better in a hacking or engineering kind of way."If you don't know any computer languages, I recommend starting with Python. It is cleanly designed, well documented, and relatively kind to beginners. Despite being a good first language, it is not just a toy; it is very powerful and flexible and well suited for large projects."I used to recommend Java as a good language to learn early, but this critique has changed my mind (search for “The Pitfalls of Java as a First Programming Language” within it). A hacker cannot, as they devastatingly put it “approach problem-solving like a plumber in a hardware store”; you have to know what the components actually do." (How To Become A Hacker, Eric S. Raymond, 2008)
It gets worse for Java according to this critique, as ESR mentioned in the quote above, which details failings of teaching Java at the University undergrad level.
But I am interested in this question in terms of high school students. The difference for high schools is that they may offer an AP or IB program, which may mandate the use of Java for their exams. In that case, of course for the sake of writing an exam, Java must be taught.
Looking longer term, however, teaching Java as a first language in high school raises lots of questions (some already answered above).
When you teach a grade 10 student, remember that this student is only about 14 or 15 years old. Three years of high school and four years of undergrad later, the student might be entering the job market seven years after learning their first programming language. That's seven years! Who knows what the world will become by then in the computing industry.
All we can say is what we can see in front of us:
- Native programs on Windows will increasingly be written in C# and C++/CLR.
- Native programs on Mac OS X will continue to be written in Objective-C
- Native Apps on iOS for iPads, iPods, and iPhones, will continue to be written in Objective-C.
- Java is popular in the so-called "enterprise" space, and also for Android OS for tablets and smart phones. But note that Android is a Linux OS (it's not GNU/Linux, but it is using the Linux kernel), so the kernel is programmed in C/C++, and you can program Apps for Android in most languages now, including: C/C++, Python, and Ruby. In fact, Android technically doesn't even run a Java VM, as Java is just a language used to program for the Dalvik VM — an issue Google has had to defend in court against Oracle.
All in all, it's almost like learning C is the best as a first language if career or "real-world" is at issue!
But that ignores the learning involved in a first language. Students need to learn to think in a way that can be expressed easily with pseudo-code — that's really the most important thing to learn as a beginning computer science student.
As Peter Norvig found, Python was much closer to pseudo-code than Java (and in fact, he found his attempt at re-writing AIMA examples from Lisp to Java to be "largely unsuccessful. Java was too verbose, and the differences between the pseudocode in the book and the Java code was too large").
With the above information at hand, I think it's clear that the choice of Java as a first language is simply not the most effective. As for what language to teach instead? Well, there's Python. MIT chose Python as their first language to teach undergrads — if it's good enough for MIT, it's good enough for me!
Addendum: Not long after I wrote this, I read Bad code plagues business applications, especially Java ones, where it discusses a study that found Java Enterprise Edition applications have the greatest number of problems in terms of bad coding practices that affect stability, and performance. Should this news affect how we view Java in terms of what to teach students?