Live data from Hacker News

Overkill: Java as a first programming language (2010)

matthias-endler.de

21–30 of 70 posts

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

#21
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 neatly. That adds extra code, but contains it in a way to makes sense of it all.

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

#22
post #6

Logo[0] was my first programming language on an Apple IIe. I was in 2nd grade and I loved it. You had subroutines, but that's it. Essentially all state was visible (although you could do increasingly more magical-seeming things the more state you hid - a truism that has held since then). It was a lovely way to see the thread of execution. What an amazing experience to read Papert's[1] Mind Storms[2] as an adult to un…

We feel the same way! That's why we re-created Apple LOGO with 3D [adding UP / DOWN / R(oll)L(eft) / R(oll)R(ight) commands] support to make it more palatable to modern audiences...

http://octalyzer.com/downloads/

Any feedback you could give would be awesome! Thanks =)

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

#23
post #14

I disagree. Yes, Java is verbose, but all this verbosity makes sense. I think it is better to write more code, but be able to understand it and reason about it, than write one line and rely on all magic under the hood (having no idea how it works).

> But all this verbosity makes sense

The thing is, a person learning a first programming language doesn't understand it and cannot reason about it. They're more interested in "why do we use a for loop" and "what's an int?" and less interested in "How do these static objects work?".

But I agree with you to an extent. Eventually the hand holding has to stop, we have to take the training wheels off, and they're going to have to fall a few times. But it's easier to get back up after you've had training wheels, because you know what it feels like to ride a bike.

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

#24

I would partially agree with this even though Java is a great language. I can firmly recall in my CS 101 class where they were teaching basic programming using Java, and the teacher seriously told us "just put static in all of your method declarations, don't worry about why yet otherwise you won't be able to use them in your main". ...didn't fully learn what static meant until over a year in my programming career.

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 object

Week 9: software engineering is a thing, hey look, public is an access modifier

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

#25
Disagree 100% and that's because I've helped and seen many juniors who learn ruby or JavaScript first not actually understand what they're doing. More so ruby, FWIW.

Examples: in junior ruby engineer, even some mid level, the confusion between local variables and attributes causes huge amounts of confusion. I don't know how many times I've asked "why is this an instance variable?" to a response being the sound of crickets.

Things like attr_* in ruby cannot be appreciated until you know why they're there. In more verbose languages like Java you're forced to understand from the beginning. Yes, there's more to learn before you get started but once you've learned it you're capable.

Learning Java was a huge "aha!" moment for me after having spent years with ruby. I've known others who express the same.

I think developers who don't learn a language like Java first hit a very hard and tall walls at some point in their learning and advancement.

Java also is much better, IMHO, language to learn design patterns in, because there is often no shortcuts provided by syntax to "prevent" or circumvent them. Also an added bonus is that the example you're reading is likely to be in Java.

I used to think scripting languages were great for learning to program but my tune has changed as I've progressed over the last decade. I now think they inhibit learning at a certain point because they lack the rigidity needed to demonstrate more advanced techniques to the learner.

I love ruby, it's in my damn username, I just don't like it as a first language these days.

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

#26
post #15

If you're going to take CS AP classes in high school, it's gonna be Java. This probably explains why a lot of people learn Java as a "first" language. (And no, not everybody started programming when they were five.) https://apstudent.collegeboard.org/apcourse/ap-computer-scie... https://en.wikipedia.org/wiki/AP_Computer_Science

In Europe I'm not aware of any country offering Java classes in high-school. It's typically Python or other languages with a low barrier to entry. Maybe JS today. Yet most good universities stick to Java for CS101, and for good reasons imho. On the other hand, non-CS majors at my school were sent right away to "useful" languages in their field (C++ at that time, I assume Python is more common nowadays).

Here I'm the UK visual basic is collages and universities language of choice, its out dated and not even used much in the industry.

I finished computing science degree in may last year and every single code example was in visual basic, before that in my HND and HNC both visual basic.

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

#27
The examples the author cites of having to write a great deal of code that one does not understand is the motivation for Racket's language levels [0].

However, it is not just a matter of Java having a syntax that imposes a lot of cognitive load on novices. It is about being able to talk basic programming language features independently from advanced languages features. This is independent of both syntactic and semantic complexity. Python's clean syntax, for example, masks some really complex semantics.

Neither Java and Python are poor programming languages, but their overriding design goals are to be languages that proficient programmers can be very productive in. The pervasive mistake in CS education seems to be that these languages are therefore great choices for teaching programming to non-programmers. They are almost certainly not.

I really hope that the discussion of languages for CS1 can move beyond this. There are many languages whose overriding design goal is to be phenomenal for introductory computing education. They are designed by computer science educators, and are shaped foremost by the observed successes and difficulties of actual students that are learning to program with them. They provide answers for educators beyond just a syntax and semantics; frequently, they come battle-tested textbooks and teaching materials.

[0] https://docs.racket-lang.org/drracket/htdp-langs.html

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

#28
Or for younger programmers (pre-college) a learning oriented language like Processing where you can gently move into java, and get to do graphical and interactive programming quickly seems to be a better option. As a teen, the lack a excitement from learning to write to files and handle text input killed my initial enthusiasm for programming and had me go first into the sciences instead. Whereas, I still find it very satisfying to be able to make interactive graphics in a few lines of code in a way that text output or static webpages never will for me.

For the college level, I agree with the writer's suggestion of Python, not just for its ease of learning, but its breadth of libraries making it useful for many science and engineering courses. However, I think that for getting advanced (fun) features early on by picking and getting the right library (working) may still be a bit too much unnecessary friction to do 'fun' programming to get earlier students engaged. Learning extra tooling and library systems is 'trivial' if you code regularly, but is still a surprising amount of work when you're new to programing and gets in the way of early feedback. (I have had colleagues in the sciences hesitate at the sight of import statements, dealing with multiple libraries, and new IDE's when suggesting using something like sci-py/python over Matlab for projects, for these sorts of reasons.)

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

#29
I teach Java in my "Intro To Programming For NonMajors" class. I get around the problem of "lots of boilerplate code required" by giving them a file with the boilerplate code, and then have them start writing their code in main(). It works well enough (certainly as well as having them write 10 PRINT "Hello, World!") and the students are fine with it.

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

#30
post #9
post #3

What's the point in hiding the fundamentals of OOP, rather than starting with them very quickly? You can't get very far before you're calling methods on the strings you're printing. I'm genuinely curious, I sat through an intro to programming & follow-up course in PHP and that line of thinking seemed to confuse the students. They weren't sure of what a function was even though they were using functions! The professor…

I believe it is to teach the fundamentals of the CPU, Machine code before the student has any knowledge of the abstraction's that currently exist. Then after the fundamentals have been established introduce the abstractions and different approaches to improve productivity.

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 interested in the mechanics behind it (specifically the C libraries) or generally the things python lets you take advantage of (like manually managing memory. I still have horrid memories learning C and dealing with pointers.) It drove my curiosity to understand all the under the hood aspects.

If I started with Java, I wouldn't have had these wow like moments writing fairly large (at the time, anyway) programs that actually functioned. Like my first simple RSS reader. Or the first time I discovered I could automate my Macs tasks quite easily.

I was HUNGRY for power after that. and i knew, at least, more power, for all python was worth, would likely come from other languages being in the mix. So I learned Java, and C, and opened my eyes to the power of many other languages (I still insist Perl is better at string processing than any other language. Show me that its not! /rant)

I think there is a lot of value is in learning the fundamentals with Python or another interpreted / high-level language first.

Post reply on HN