The point is, it's a terrible first language because it's impossible to actually understand what's going on even in a basic "hello world" program until halfway through the semester. So inevitably you have to start them off by saying "here's a bunch of noise that you don't understand, but that's OK, just copy and paste it" which is a terrible habit to reinforce.
You need to understand
* access modifiers (public/private)
* classes
* static methods
* void return values
* the main() function
* modules (System.out.println)
Just to understand a basic "hello world". It's too much for first-time programmers.
Actually, the hello world doesn't seem that bad to me. And I program mostly in Python nowadays.
class Test {
public static void main(String[] args) {
System.out.println("Hello world");
}
}
And then
javac Test.java
java Test
The class acts as a kind of namespace here, you don't need to go into OOP concepts for hello world at all. The beginner will have to understand
* Class is in file with the same name ¯\_(ツ)_/¯ and contains functions (maybe it'll help me later in organizing code?).
* Command line arguments (not strictly necessary concept but not too problematic either)
* Types - why is there String[] in the definition? (A must have in a statically typed language anyway)
* void - the function doesn't return anything (OK)
* public (not OK, some magic here)
* static (not OK, some magic here)
* Compilation vs. run step (a must have in a compiled language)
So IMHO there are just two concepts that could be thrown away. Or three, if you accessed CLI args from a library. But the meaning of public and static will come naturally when the students will learn about OOP.
I think you can omit the "public"s in the Java hello world (thereby making everything package protected, and sneakily sidestep the issue), but I don't want to ruin this machine by installing Java on it to make sure.
To be super thorough, you would also have to understand:
- semicolons (and the related issue of newlines being semantically equivalent to normal spaces)
- naming conventions (to explain why it's not "System.Out.Println" and "Main")
You can in C#, but not in Java. You can make it an enum, I think, to shorten all that. But my Java golfing knowledge is a bit rusty by now, admittedly.
You are right about first time programmers. But should people come to university without any prior programming knowledge?
If someone applying for an architecture degree or engineering degree is required to have basic drawing skills and basic math knowledge, why we shouldn't assume the same for CS?
Because computer science isn't about programming? That's exactly why a simple and elegant language should be chosen, one that allows to express the concepts that are taught. Java is such a horrible choice that it's laughable that it enjoyed this success at universities.
Yes, a simple language is better to teach CS. CS is not just about programming, but I think CS is about programming too and having a reasonable level of programming is useful.
If I was a teacher and I'm going to teach someone what a linked list is, or what a binary tree is, I can of course use natural language and drawing, I can use abstract algebraic concepts.
But the student should be also able to construct said structures and observe how they work. The same for any other concept.
Yes, and that's why a simple language is always preferrable to Java. It doesn't matter if a student has previous exposure to programming languages if this language can be taught in about two or three weeks worth of class.
You need to understand
* access modifiers (public/private)
* classes
* static methods
* void return values
* the main() function
* modules (System.out.println)
Just to understand a basic "hello world". It's too much for first-time programmers.