Hi, I'm Adam. Email me about: CTOs, Mobile/iOS, Project Management, and Development

Java considered harmful as first programming language…

Today, I was pointed at an article suggesting that java is responsible for the decline in the quality of Computer Science graduates.

Specifically if you want to be a Computer Scientist, I’d say that the initial claim that “java is bad as a first language” is true, just as “C++ is bad as a first language” is true. What disappoints me is that they go on to suggest that C++ is good as a first language (disclaimer: my uni course taught ML as first language, ARM assembler as second).

Do you want to be a Computer Scientist? Why would you want that? Well, the article makes some good points in that regard – essentially, if you want to be an OK-to-good programmer, then it will help to be a CS, but not required, but if you want to be a *great* programmer, you absolutely need to be a CS. So, if you’re not interested, stop here :). But if you hope to be a really good programmer one day – or to understand those who are – read on.

“Better” first programming languages

(by “category”, rather than naming individual langs – within these categories, anything popular / common is equally good)

Assembler

Teaches you to be REALLY good at the meat of programming: the individual lines of code that follow one after another within any chunk of a program, such as the body of a function or method.

Functional

The closest form of programming to the theoretical mathematics of programming, and hence the easiest in which to achieve a lot of solutions (for instance, parallel programming such as needed to take advantage of multiple CPU’s or multiple servers in a cluster is orders of magnitude easier to do in a functional language).

Data-driven

Much of the programming problems in the world come down to manipulating, generating, or managing data. Data languages don’t get much attention because they aren’t general-purpose languages, but they’re the best choice for a big chunk of the systems that most programmers will spend most of their lives working with. Amongst the non-general languages, they’re probably the most useful to a modern programmer (sheer speculation on my part there – feel free to smack me down for my foolishness :)).

C? C++? …etc

Anything C-derived (and that includes java!) seems to be an excuse for avoiding teaching the fundamentals of computer science: you should either be teaching the theory (as the article laments we are not currently doing), or you should be teaching the hardware (as it also laments, but less forcefully, and seems to mention only as an excuse for why C is good). Or…you should be accepting that you’re not [even attempting to] teaching either. C/C++/Java force you to learn neither of those things, so make for poor first languages IMHO.

Is java “bad”?

Let me be clear:

Java is one of the best day-to-day practical languages available in the world today (C# is pretty much the same – but the Microsoft / Windows obsession often counts against it); Java is the WRONG approach for many problems – but it’s the RIGHT approach significantly more often than C++, LISP, C, Assembler (any), etc.

If you already know how to program, then Java is an excellent language. One of the core features is that it lets you work in large teams, alongside other programmers who aren’t as good as you, and not have your code screwed-up by their incompetence or inexperience.

By contrast, C++ makes it easy for other people to destroy your code, and C positively encourages it.

LISP? Well … with LISP, the chances are most of your colleagues will give up entirely, and leave you to write all the code for the entire company. Sadly … relatively few people are willing to code with LISP.

Flamebait articles

In passing, I wanted to comment on the article itself. Mainly because on the whole it’s a GOOD article, making some good points and bringing attention to some problems that have been allowed to get out of hand – but I can’t recommend it without reservations, because in some respects it’s deeply flawed. To people under-experienced in this stuff (e.g. undergraduate programmers, and high-schoolers choosing CS degrees) I think it would be easy to be misled by some stuff in the article that really isn’t fair.

The way the article has been written makes it easy to speed-read it and recycle it as food for a “java is bad” argument :(. As noted at the start, I think the arguments for this aspect ALL hold equally true for declaring that “C++ is bad”, but the author not only glosses over this but instead even has a half-hearted attempt to argue the opposite. To see this as justification for either argument would be foolish, of course, but it’s easy to see how pre-prejudiced (i.e. flamers and trolls ;)) people will do that. I’m sure it will happen, although I don’t think the authors meant it that way (if anything, I think it’s an extended attempt to elevate Ada in people’s estimation). In the modern internet world, on certain topics (such as anything that compares and contrasts programming language) you have a duty to be extra careful about how you present your arguments.

Given the way the article starts (by poking java), I’m particularly disappointed that the “Why Java matters” section misses out any of the stronger benefits of java in particular, mainly I think because they wanted to mention them in the Ada section (where several of them appear), and didn’t want the fact that they’d mentioned them in the java section to weaken the argument (I note that C#/.NET/CLR isn’t mentioned at all either – if you’re even going to try to defend java as a choice, I think you should mention other managed languages).

I also think it’s odd that they would choose LISP as the only functional language represented. Not just because I’m an ML fanboy :), but because IME, functional languages fit much more closely to standard human approaches to problem solving than imperative languages.. If you’re going to pick the ideal language to teach students first, it would be a functional language, so there ought if anything to be MORE fn langs than imperative ones in the list – but it’s the other way around. I think if they fairly compared both fn and imperative, the fn langs would probably win the majority of reader mindshare. I think the main reason they didn’t include them is probably their desire to make Ada seem good, as mentioned above.

That’s purely my personal opinion, of course; take it or leave it…

3 thoughts on “Java considered harmful as first programming language…”

Comments are closed.