Live data from Hacker News

Overkill: Java as a first programming language (2010)

matthias-endler.de

51–60 of 70 posts

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

#51
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…

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 to me now with "oh, that's magic, just ignore it.", I still would walk away from your course if you can't explain that within a week.

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

#52
post #5

Earlier quoted context omitted.

I don't think it's worse in C++. You can make purely imperative C-like programs in C++ with essentially no boilerplate (with the exception of maybe needing io from the standard library), and build things up as they go.

While I still am a big fan of C++, I'd attest to the fact that is a worse language to teach beginners. Funnily enough, that's not so much because of the language, but because of its legacy. I learned programming with Borland Turbo Pascal and later Delphi and have to admit I struggled with the OOP mindset at first. The according chapters of the book I used were filled with contrived examples that left me saying "I can…

The problem there seems to be that you were learning an IDE/Gui builder and c++ at the same time. I still think I language that exposes pointers directly (c, c++, others?) are far better than something like python. Pointers force you to understand memory, allocations, the heap and stack, etc. There are way too many professional programmers that don't understand them.

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

#53

He's deliberately made the java example of file input too busy, it's poorly written. And added multiple exception handling to make it longer than it needs to be (in its context). I started in BASIC as a kid. The barrier to entry was minimal and fun for a few hundred lines of code. To manage the complexities of a large code base, you need to have supports and infrastructure and information hiding to structure it neatl…

>He's deliberately made the java example of file input too busy, it's poorly written.

Do you have evidence to judge the intention of the author?

The simple truth is that good pedagogical code is hard to write in any language, but Java makes it especially hard since it makes the two most essential things, invocation and I/O, needlessly difficult. Java also makes graphics (AWT and Swing) and even something as simple as Date/Time needlessly difficult. Just about the only thing that's really outstanding in the standard library are the Collection classes (arguably util.concurrent is good too, but a) concurrency isn't for beginners and b) concurrency requires better language and runtime constraints, like those provided by Clojure or Erlang).

Java was invented for embedded devices and was supposed to be C without pointers that could run anywhere. Not quite sure how it ended up as an Enterprise Server platform. marketing, I guess.

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

#54
post #52

Earlier quoted context omitted.

While I still am a big fan of C++, I'd attest to the fact that is a worse language to teach beginners. Funnily enough, that's not so much because of the language, but because of its legacy. I learned programming with Borland Turbo Pascal and later Delphi and have to admit I struggled with the OOP mindset at first. The according chapters of the book I used were filled with contrived examples that left me saying "I can…

The problem there seems to be that you were learning an IDE/Gui builder and c++ at the same time. I still think I language that exposes pointers directly (c, c++, others?) are far better than something like python. Pointers force you to understand memory, allocations, the heap and stack, etc. There are way too many professional programmers that don't understand them.

  The problem there seems to be that you were learning an IDE/Gui builder and c++ at the same time. 
Even from a modern persective, I'd disagree with that. Yes, the IDE was a pain point, but it existed because the alternative is much worse. You don't want to start out explaining Makefiles to anyone (even if you start with VS you'll be spending an hour setting up instead of programming).

  Pointers force you to understand memory, allocations, the heap and stack, etc. 
Yeah, and we'll both agree that this is crucial knowledge for any professional programmer. But if you're starting out (we're talking first language here), it's in the way. You don't even know what a loop is yet. You're at least years away from professional.

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?

Edit:

As a side note, I also see much value in starting with a more functional language than C++.

Lexical scope really affects your thinking. If you can get to that at the end of the first course, you'll have taught something tremendously useful. I've been working at a local university of applied sciences until last year, and you really don't want to know how many students there struggle with a C++ lambda expression.

Again, to reiterate: I'm a fan of C++. I still cringe at most other imperative languages. But I see its weaknesses (especially in teaching).

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

#55
post #52

Earlier quoted context omitted.

While I still am a big fan of C++, I'd attest to the fact that is a worse language to teach beginners. Funnily enough, that's not so much because of the language, but because of its legacy. I learned programming with Borland Turbo Pascal and later Delphi and have to admit I struggled with the OOP mindset at first. The according chapters of the book I used were filled with contrived examples that left me saying "I can…

The problem there seems to be that you were learning an IDE/Gui builder and c++ at the same time. I still think I language that exposes pointers directly (c, c++, others?) are far better than something like python. Pointers force you to understand memory, allocations, the heap and stack, etc. There are way too many professional programmers that don't understand them.

[deleted]

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

#56
post #52

Earlier quoted context omitted.

The problem there seems to be that you were learning an IDE/Gui builder and c++ at the same time. I still think I language that exposes pointers directly (c, c++, others?) are far better than something like python. Pointers force you to understand memory, allocations, the heap and stack, etc. There are way too many professional programmers that don't understand them.

The problem there seems to be that you were learning an IDE/Gui builder and c++ at the same time. Even from a modern persective, I'd disagree with that. Yes, the IDE was a pain point, but it existed because the alternative is much worse . You don't want to start out explaining Makefiles to anyone (even if you start with VS you'll be spending an hour setting up instead of programming). Pointers force you to understand…

> 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 is about CS classes, while the others might do some programming they shouldn't need to do computer science. Also, although being easier, is jupyter doing anything not being done in emacs years ago?

>You don't want to start out explaining Makefiles to anyone (even if you start with VS you'll be spending an hour setting up instead of programming)

To anyone on the path of becoming a professional programmer, yes, it's worth a few minutes to write a trivial makefile. It's worth teaching how to compile from the command line and how to batch those commands with a DSL is really simple. Again, there are way to many programmers who have no idea what their IDE is doing, which really isn't that much.

> Yeah, and we'll both agree that this is crucial knowledge for any professional programmer. But if you're starting out, it's in the way. You don't even know what a loop is yet. You're at least years away from professional.

c/c++ don't force this straight away though, you can easily do for loops before you begin managing memory. In any language memory should be understood before arrays are.

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

#57
post #56

Earlier quoted context omitted.

The problem there seems to be that you were learning an IDE/Gui builder and c++ at the same time. Even from a modern persective, I'd disagree with that. Yes, the IDE was a pain point, but it existed because the alternative is much worse . You don't want to start out explaining Makefiles to anyone (even if you start with VS you'll be spending an hour setting up instead of programming). Pointers force you to understand…

> 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…

> In context, this is about CS classes, while the others might do some programming they shouldn't need to do computer science.

We seem to read the same statement differently. I actually had a CS101 class in highschool (also in Pascal, I didn't learn much there ;-) ). While all students there wanted to go in the engineering/science direction, I think only a hand full of us ended up in CS. Granted, this might be due to terminology.

On the other hand, I work with people who studied "business informatics", which at a bachelor's degree has the same base classes. I can guarantee you none of them use a pointer in their daily work (again, they do more in the sysadmin direction).

> To anyone on the path of becoming a professional programmer, ...

Yes, but not in the first lecture. Not before they know what a loop is. Many don't even know the command line (yes, I was also stunned to see that).

On the other point, I entirely agree :). I could make a huge list of frustrations I have with professionals not being willing or able to introspect how things work.

> c/c++ don't force this straight away though, [...]

As I said, it's not so much of the language anymore, more its legacy. C++ has stuck around quite a while, and this results in an abundance of old and bad APIs.

And with the better ones, you'll be able to leave pointers aside, but end up ignoring templates instead... Also, already the output operator on STL streams means you'll have a lot of explaining (or ignoring) to do.

Additionally, if you really are already teaching computer science students, I'd say you'll give them a better time explaining pointers and so on to them after they already know a language they can certainly use in the industry - in which case the idea of using Java to start out still has a point...

Edit:

This basically leads back to the original argument of the article: If you change the starting language for beginners, do it for their learning progression. If you're changing it to C++ for C++'s sake, you won't be doing your students a favor, stick with Java. If you can tolerate telling your students "hey, look, this magical thing is actually that feature here", you can also tell them later on that C++ is basically much like Java except for some details. I think language switching isn't as hard as it's made out to be if you're teaching the right concepts.

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

#58
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…

> In context, this is about CS classes, while the others might do some programming they shouldn't need to do computer science. We seem to read the same statement differently. I actually had a CS101 class in highschool (also in Pascal, I didn't learn much there ;-) ). While all students there wanted to go in the engineering/science direction, I think only a hand full of us ended up in CS. Granted, this might be due to…

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 worthwhile than any general purpose language, they're brilliant for data wrangling.

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

#59
post #58

Earlier quoted context omitted.

> In context, this is about CS classes, while the others might do some programming they shouldn't need to do computer science. We seem to read the same statement differently. I actually had a CS101 class in highschool (also in Pascal, I didn't learn much there ;-) ). While all students there wanted to go in the engineering/science direction, I think only a hand full of us ended up in CS. Granted, this might be due to…

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've never gotten around to learn awk properly (and never had any need to), but having experience in bash (and other shells) in combination with the GNU tools has had countless benefits for me so far.

Do you have any preference for introduction material for awk?

Edit:

When it comes to data processing, I also really like what projects like pandas are doing:

https://pypi.python.org/pypi/pandas

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

#60
post #56

Earlier quoted context omitted.

The problem there seems to be that you were learning an IDE/Gui builder and c++ at the same time. Even from a modern persective, I'd disagree with that. Yes, the IDE was a pain point, but it existed because the alternative is much worse . You don't want to start out explaining Makefiles to anyone (even if you start with VS you'll be spending an hour setting up instead of programming). Pointers force you to understand…

> 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 physics to a bunch of students who know Python and SciPy, I would assume Jupyter notebooks are an amazing way to distribute course material.

Post reply on HN