Live data from Hacker News

Overkill: Java as a first programming language (2010)

matthias-endler.de

61–70 of 70 posts

Re: Overkill: Java as a first programming language (2010)

#61
post #58

Earlier quoted context omitted.

Yeah, I did Pascal in high school too, but I thought x01 were college designations, we don't use them here. Actually, I've been brushing up on my awk lately and it seems like it might be a good candidate for those not on the CS track. It teaches/requires the command line. It has a built in loop (great for fast feedback). It's a decent enough language. And I'd argue it and the rest of unix tools are probably more wort…

> I thought x01 were college designations, we don't use them here. As I said, this is properly a terminology question. I can't speak from experience for the american naming scheme, and where I live, much of it has been "rehashed" in different institutions. Does that mean that you have noone at the beginning of a CS degree that can't program yet? We certainly hat a good bunch of them. As for UNIX tools: Absolutely. I'…

> Does that mean that you have noone at the beginning of a CS degree that can't program yet? We certainly hat a good bunch of them.

I don't think our school was very typical, it was a fairly poor public school, I suspect it was taught because there was a sepecific teacher that wanted to teach it. It was being run from the commerce department at the time, with half the time spent in the graphic design class rooms (they only ones with computers). This was in the late 90's when they were still teaching us touch typing on electronic typewriters. It does seem like a huge waste for students to start a CS degree without experience though, a good portion of them will never have any aptitude for it.

> Do you have any preference for introduction material for awk?

I've been going through O'Reilly's "Sed & Awk" that was sold as part of a unix bundle a while ago. I haven't done much at all, though it has simplified monitoring things at work, like coloring log files reading from log files to tell us how many and how long a particular set of processes are taking.

Re: Overkill: Java as a first programming language (2010)

#62
post #56

Earlier quoted context omitted.

> Also, not everyone who programs wants to become a software developer. Sysadmins don't need pointers, but a readable alternative to shell scripts is nice (I know such people, they exist). A journalist who wants to make a flashy chart on the internet doesn't need to know pointers. A biologist also doesn't - but (s)he can certainly benefit from programming. Have you seen what Jupyter can be used for? In context, this…

> Also, although being easier, is jupyter doing anything not being done in emacs years ago? While I already think it's worthwhile that you can sidestep emacs' setup and learning curve for uninterested students, you might be interested in how it is already used for collaboration and teaching. One list of examples might be this: https://github.com/jupyter/jupyter/wiki/A-gallery-of-interes... If you're teaching math or…

Clicking on a few random ones seemed to be broken in the web view, which doesn't bode well ;)

I'm sold on the idea though. 20 years ago all our math books came with basic programs in each section, I can't help but think maths and physics would have been much more fun if we'd been able to run them or had something like jupyter. I've been told textbooks don't come with this any more, which seems like a shame now that computing devices are so ubiquitous.

Re: Overkill: Java as a first programming language (2010)

#63
post #36

Earlier quoted context omitted.

The reverse is to give people a way to build things. Even simple things. This lights up the brains response every time you get the computer to, as my old lab partner in my first CS class put it 'to do a thing! Automatically!'. My first real python program made me gush with endorphins. I feel like if I didn't start off on Python first (and, for whats it worth, still heavily use today) I wouldn't have been NEARLY as in…

I agree with your view point. Although why are you in the CS class? If you're only interested in just getting the job done the fastest? From a practicality stand point of view using bash, batch files, nodejs, python is going to be faster second to none, I'm not discussing that. The point is using a low level language you have to consider about decoding the jpg, memory allocation or possible streaming issues. Optimal…

It's not about getting the job done. It's more about opening ones eyes to the potentials of computer science. Learning Python open the doors to other kings. Not to mention many of the things you are mentioning here are power user features of python as well.

Re: Overkill: Java as a first programming language (2010)

#64
post #24

Earlier quoted context omitted.

In my CS101 class I asked what the "public static void main(String[] args)" meant at the beginning of the java code we kept getting and got the response: "It's some magic, don't worry about it."

Well then your instructor was doing it wrong, and that's a shame. I teach this course regularly, in Java (and previously in C++). Week 1: "it's just some magic, don't worry about it" Week 2: arrays are a thing, hey look, args is an array of strings! Week 3: functions are a thing, hey look, "void" is the return type, args is the parameter! Week 8: objects are a thing, hey look, static mean's it's not a member of an ob…

That instructor was in fact abysmal, and was not offered a new contract when her last one expired, even while tenured.

Sounds like you're a really good instructor for that type of stuff. We need more of you.

Re: Overkill: Java as a first programming language (2010)

#65
post #24

Earlier quoted context omitted.

Well then your instructor was doing it wrong, and that's a shame. I teach this course regularly, in Java (and previously in C++). Week 1: "it's just some magic, don't worry about it" Week 2: arrays are a thing, hey look, args is an array of strings! Week 3: functions are a thing, hey look, "void" is the return type, args is the parameter! Week 8: objects are a thing, hey look, static mean's it's not a member of an ob…

But that's already the problem: You start by ignoring instead of explaining things. If you start with print("Hello world!") you can already start explaining your subjects everything they've just written and build from there. So, you'll get around faster to teaching the mindset of programming instead of explaining access modifiers. Those are not needed for that. Also, if you would start an explanation of anything new…

I think you're being a little bit aggressive about the when's and the how's. I think there's nothing wrong with saying "Don't worry about that until next week, we'll be discussing that in another lecture" as long as it does in fact get explained. I don't think the statement should be "it's magic, ignore it," ever.

At most universities I've seen, CS101 assumes no programming experience, so if you want to show a real Java code block there's going to be a lot of stuff a student's never seen before.

I also think this is why languages with REPLs and relatively few syntax modifiers (like Python) are good for intro courses. You can fire up a REPL and type `print "Hello World"` and it'll do just that. The students don't have to see any "don't worry about it" type stuff.

edit We may have been agreeing about the "print Hello World" part and the Python part. The problem is that some universities (like my Alma Mater) had the hard requirement of all CS and IT students started with Java.

Re: Overkill: Java as a first programming language (2010)

#66

Earlier quoted context omitted.

But that's already the problem: You start by ignoring instead of explaining things. If you start with print("Hello world!") you can already start explaining your subjects everything they've just written and build from there. So, you'll get around faster to teaching the mindset of programming instead of explaining access modifiers. Those are not needed for that. Also, if you would start an explanation of anything new…

I think you're being a little bit aggressive about the when's and the how's. I think there's nothing wrong with saying "Don't worry about that until next week, we'll be discussing that in another lecture" as long as it does in fact get explained. I don't think the statement should be "it's magic, ignore it," ever. At most universities I've seen, CS101 assumes no programming experience, so if you want to show a real J…

Yeah, that's exactly my point (I'm not sure if we're misreading each other here?). If you want to teach someone how to program, there is much to be had if you start with simplicity and consistency. Algol-derived languages pretty much all struggle with this, whereas Python, Javascript etc. have a much more sane base to learn from.

(NOTE: Only a base. Both Python and JS get very complicated and magic-y if it comes to details. But those are not what you'll want to teach. You'll want to explain scopes, variables, functions, objects etc.)

In both, the basic file is a scope. In both, you can write "Hello World" without fluff, because that scope is executed. It is consistent on a starter level. Then you move to variables. Then to loops. Then to functions showing how you can modularize code. And you didn't have to write `public`, `static`, `class` or whatever. Your students don't even need type theory beyond "that's a string" and "that's a number".

> The problem is that some universities (like my Alma Mater) had the hard requirement of all CS and IT students started with Java.

Mine did too (still does, AFAIK). Incidently, they also did also basically nothing to guarantee any didactic quality in any of their courses. Go figure ;-)

I still maintain the opinion that people defining rules like this overestimate the effort that comes with switching languages. If you're teaching solid fundamentals instead of "Language X", you shouldn't have too much of a problem teaching the same students something like Java at a later point. But the way to get the basic understanding will be much smoother.

As an anecdote: Shortly before I finished my masters I would help out a bachelor student on his first project. He had the problem that they only had started out in Java a semester before, but he had to use Python (because of the tooling and libraries involved). He asked me a couple of questions that mostly equated to "how do I best do X in Python" (the hardest being non-performance critical parallel tasks - simple threading stuff). A couple lines of code later, his reaction basically was "Really? That's it?!". His impression seemed to be that most tasks must* be very difficult and complicated, since they were presented this way in his Java class...

Re: Overkill: Java as a first programming language (2010)

#67

Still, JVM languages are wonderful and meet this criteria. Groovy --- print "Hello World" Clojure --- (print "Hello World")

Apache Groovy meets the one-line criteria but fails the simple syntax rules criteria. In your example, you have to explain that Groovy's println syntax above only works for certain types of arguments. If you want to print a string then

  println "Hello World"
is being translated internally to `System.out.println("Hello World")` and therefore works. But if you want to print a list then

  println [1, 2, 3]
doesn't work because it's being translated to `println.getAt([1,2,3])`. You need to put parentheses around it, writing

  println([1, 2, 3])
to achieve the same effect. Your choice of example obscures this dirty little secret about Apache Groovy. There's many other confusing rules like this in the language, e.g. `myVariable.class` returns the class of myVariable, whereas `myVariable.clazz` returns a property called clazz.

The Java example in the blog post works for all types of arguments, even if it is 5 lines long. I agree with you that Clojure meets both the one-line and simple syntax rules, though.

Re: Overkill: Java as a first programming language (2010)

#68
post #35
post #13

I'm on board with Java not being a great first language but I'm pretty tired of posts constantly citing ancient unidiomatic Java to prove how bad of a language it is. Their file i/o example could just as easily be import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; public class fileIO { public static void main(String[] args) throws IOException { Files.copy(Paths.get("test.txt"), System…

Nothing kills a beginner's interest more than "you need to have a class and a main method, always, and I can't explain why, just trust me, you'll understand later." Java was my first language. No one explained any of that stuff to me. And for whatever reason I lacked the agency to go figure it out for myself although I had internet access. Probably because I assumed paying attention in class and doing my homework was…

I agree. I don't believe Java is a good first programming language. I'm just tired of posts bashing Java by citing code that doesn't take advantage of any of the improvements in the language since 1.4.

Re: Overkill: Java as a first programming language (2010)

#69
post #16
post #13

I'm on board with Java not being a great first language but I'm pretty tired of posts constantly citing ancient unidiomatic Java to prove how bad of a language it is. Their file i/o example could just as easily be import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; public class fileIO { public static void main(String[] args) throws IOException { Files.copy(Paths.get("test.txt"), System…

I don't see how this is much easier for a beginner. :)

Again, I don't think Java is a good beginner programming language, but this version:

1. Avoids try/catch syntax, and in fact can defer mentioning exceptions entirely (at the cost of the "throws" declaration being a mystery, which the main function already is to a beginner)

2. Does not require understanding of loops. In fact their example loop is particular egregious in its use of assignment in the loop condition which is especially likely to confuse beginners who are still learning the difference between "=" and "=="

3. Does not require introduction to Java's Reader I/O abstraction

4. Does not require familiarity with null references

I'm not saying my version wouldn't be confusing for beginners, but it would be hard to write a worse version than the one they give.

Re: Overkill: Java as a first programming language (2010)

#70

This isn't a bad idea (Python not Java for a first language makes sense on a number of levels) but the example is setting up a straw-man. Why is the Java code handling exceptions when the Python code isn't? Why is the Java code reading the file line-by-line and the Python code isn't? Further, you could easily write a simple file library in almost any language that abstracts over the difficulty of using the full file…

>Why is the Java code handling exceptions when the Python code isn't? Why is the Java code reading the file line-by-line and the Python code isn't?

Because you have to do those things in Java. That's the entire point of this article

Post reply on HN