3 ms·
The problem is when you sit down to teach the beginner, all the boilerplate clutter forces you to either A) teach them the magic incantation to be unquestionabl
by OkayPhysicist 4y ago
The problem is when you sit down to teach the beginner, all the boilerplate clutter forces you to either A) teach them the magic incantation to be unquestionably written before they start writing any code, or B) you explain everything before getting into any real programming.
Both suck. In the first case, students are torn away from the mode of thinking that programming thrives in: that everything is made up of simple, understandable pieces, that can be built up into complex solutions. It ends up serving as a trap for the very kind of inquisitive student that is equipped to succeed in programming. In the second case, everyone's bored to tears, and you can be assured that your entire class will be hopelessly lost before they write their first line of code. It's a bad time all around.
Basically, programming wants to be built up with the following concepts, in order:
1. Algorithmic Thinking (solutions can be representing as a series of simple steps)
2. Structured Syntax (these steps can be represented as structured text)
3. Symbolic Reasoning (types, variables, arrays)
4. Control Flow (loops, conditionals)
5. Functions
6. Higher Structures (classes, objects, etc)
Python, IMO, is pretty good pedagogical tool in this regard
print("Hello World")
"We want our computer to display to us (or 'print' in software terms) the phrase 'Hello World'. Python provides us with a built-in way to do so: the "print" function. In the majority of programming languages, we express a call to a function as a command, followed by its inputs (or 'arguments') contained within parentheses. As our one and only argument, we provide what we want printed, in this case the text "Hello World". By wrapping this text in quotes, we can tell the language that we intend this text to be interpreted as a chunk of literal text, called a 'String' rather than as a variable or other symbol for the language."
In contrast, explaining everything going on in the equivalent Java
public class MyFirstClass {
public static void main(String[] args){
System.out.println("Hello World");
}
}
would take more text than I'm willing to hammer into a HN comment, but to be explained to a complete beginner would likely involve skipping, but promising to explain later: classes, functions, "public", "static", "void", command line arguments, and the uniquely weird "System.out", followed by a similar explanation to the Python example, with the added "we end each step with a semicolon".
- java-man 4y agoThank you for a detailed explanation! Please see my response to @pgwhalen. In short, the problem has, I think, a much simpler solution. What I really dislike about this JEP is not only that it tries to solve the educational problem in a worst possible manner (my opinion), but it also risks creating a generation of students who don't really understand the fundamental concepts that allow us to write reliable code. Perhaps we need to start teaching basic programming with BASIC instead, and graduate to a more complicated platform once the basic concepts have been understood.
- OkayPhysicist 4y agoMy personal opinion on it is that Java's simply a bad first language, and over-taught in schools. It has a lot of language-specific baggage that it thrusts upon you immediately on first use. My preferred first (university-level) language is Racket, because it's got incredibly simple syntax as a LISP, it's radically batteries-included giving a good sandbox to play in, and segues into CS-theory type stuff pretty damn well. It also has the added bonus of minimizing the impact on the subset of the class with non-trivial programming experience, who otherwise can easily get bored hearing stuff they know already, stop paying attention because they assume they know everything already, and then wash out when the real CS-heavy stuff hits. But a lot of "universities" treat their "CS" programs as glorified trade schools, and want to focus exclusively on industry-applicable languages, and land on Java because Oracle had a great outreach program. Like it or not, many students will be starting their programming journey in Java, and not fucking it up is probably a good idea. My approach would have been pretty similar to their listed alternative under "Interpret code units as static members", but that probably comes down to differences over the importance of Object-Oriented principals in beginner programming pedagogy. Barring that, this proposal really isn't bad. It doesn't break existing code, it does its job well enough. I would have liked there to be support for inline subclasses that can be called from within the same anonymous class environment, but I can see how that would create ambiguity with existing code.
- pron 4y ago> I would have liked there to be support for inline subclasses that can be called from within the same anonymous class environment, but I can see how that would create ambiguity with existing code. Not sure what you mean by "inline subclasses", but an anonymous main class can contain class declarations -- just as classes, named or anonymous can today. This file would be a complete legal program: record Foo(int x, int y) {} class Bar { static void print(Foo f) { System.out.println(f); } } void main() { Bar.print(makeFoo()); } Foo makeFoo() { return new Foo(3, 4); }