It’s really funny, honestly, but kids, Java isn’t cool. It hasn’t been cool for a long time.
Slashdot even posted “The Struggle to Keep Java Relevant,” which … wow. Not only is Java not cool, but it’s not even relevant any more. Now, that article is … odd, because “relevant” apparently means “used by people with piercings,” which is an odd metric, but still!
Here’s the thing, though: Java may not be cool, but the cool kids haven’t managed to replace it in anything other than their own hearts and minds yet.
There have been worthy attempts.
Some examples: Ruby, Python. Haskell. Erlang. Scala. Groovy. Clojure.
These languages are “dynamic” or “functional.” (Except Erlang, which is concisely and excellently described: “Erlang is a programming language designed at the Ericsson Computer Science Laboratory.” Well, then.)
Another interesting thing about them is that of all seven, five of them are able to target the JVM, and some of them the CLR as well.
It’s almost like they… well… honestly… they’re keeping the parts of Java that run well and mixing it with impenetrable syntax.
That’s a… loaded statement if I’ve ever seen (or written) one, but let’s think about it.
Look, I know the JVM can be improved (invokedynamic, for example, which is so necessary I can’t believe it’s not there yet), but by and large, it’s fantastic. It’s good enough that, compiling at need, it’s able to keep up with languages like C++ and C – languages that sort of set the bars for performance. It enables us idiot programmers to write simple, almost retarded syntax, and get it right almost every time. Neither it nor we are perfect, of course, but still… it works out most of the time to the point where it’s hard to tell.
That’s not cool. There’s not a whole lot of room for an ivory tower attitude when everyone’s on the first floor… but Java can do an incredible array of things well.
So what we have, now, is a host of dynamic or functional languages, most of which … target the JVM. The largest changes are in language concepts or syntax, both of which are relevant, but less so than you’d think.
A dynamic language is one which – if you’ll pardon the really poor definition – is able to change at runtime. That’s a development thing, of course, but one of the things the dynamic language people like is the lack of a formal compilation step. Write and run, baby! Find a problem? Fix it in place. Instant deployment.
The agile folks luuuuurve them some dynamic languages, because it enables an incredibly short development cycle.
Functional programming languages treat everything as a result. They tend to focus on immutability when they can. They’re what I used to think C was. Functional languages are really good at being known quantities; I want a functional language handling my airplane flight controls. (This is only partly written in jest.)
Academia luuuuurves it some functional languages, and with a few exceptions, academia is where functional languages live and die. (Some exceptions: Haskell, Erlang, Mathematica.)
I find it odd that functional languages don’t live on the JVM all that often, although many JVM-targeted languages include functional language hallmarks. (Scala is usually considered a sort of functional language, too.)
Anyway… while I certainly have no intent of running down these languages (especially considering my secret love I do the harboring for in my heart in my chest for Scala) I can’t help but think they all fail the elevator pitch test.
See, let’s look at Perl for a second. I can explain Perl to my eight-year-old. “Do this, unless that.” It works. There are a lot of bits in there that confuse everyone not named “Larry” or “Randal” but by and large, Larry Wall designed the language to work more or less like we think, and handle expressions that way.
Perl tends to be write-only largely because we think in impenetrable fashions, and the necessities for making a computing language out of how we think introduces some funky stuff.
I can likewise explain C in a minute or two. (Maybe not to my eight-year-old, although my oldest son started learning C at nine.) It’s a long elevator ride, but still. An elevator ride’s time.
Java’s a little harder, but the syntax is so close to C’s – well, leaving out generics – that Java’s language is fairly easy to pitch about in an elevator.
Now it gets harder. Ruby’s not hard, nor Python, nor Scala, nor… you get the picture, but if I had to explain them in an elevator, well, hmm. The idioms just get weird for people who aren’t into the idioms already, or who aren’t interested in climbing up stairs in that there ivory tower.
Again, it’s not impossible. The thing about these ivory towers is that you can climb them. It’s not a Goldberg contraption; it’s also not a simple ramp.
Java, on the other hand, is a ramp. Simple, predictable syntax. Again, I’m ignoring generics, la la la la – generics are easy, I won’t use Java without them any more, nor have I been willing to use Java without them for a while now, but explaining them to a newbie can be daunting, partly because they’re not real.
You can write some funky write-only keyboard vomit in Java, too, but it’s harder. The language is just too simple.
So what’s the point here?
Is it that the newfangled languages are awful, that people should use COBOL^WJava? Nope.
Is it that Java’s still the cool kid on the block? Not really – although I think it’s cooler and more relevant than it gets credit for.
Is it that people should stop trying to compare languages? Strike three! (You’re not out; this ain’t baseball.) Language comparisons are important, because they give us new ways to look at solving problems, and how would we know for what language X is better than language Y in short order unless it’s explained in a comparison?
I guess it’s just frustrating to have a language – any language, whether it’s COBOL, FORTRAN, Java, C – run down in favor of the latest entry, when the market has spoken in favor of the old guard.
I’m not all about the job market – like I mentioned already, Scala is my friend, I will hug it and kiss it and call it George – but I do have a problem when a language’s adherents accuse those who don’t use their language of choice as being uncool.
It makes programming political.
I really don’t like that.
With syntax being relevant for a mass-market language, and a runtime that’s tuned well enough that a lot of these languages use it as an operating environment – Java’s not only relevant, it’s important.
My point, then, comes down to a curmudgeonly … annoyance, because like it or not, Java is relevant, very much so, and no amount of Slashdotting or handwringing about how cool DHH is is going to change that. Deal with it.
(ETA: Look, folks, I know Ruby, Python, Perl, Scala fairly well, IMHO – just like I know Java “fairly well” – and I’m not suggesting one avoid any specific language. Plus, if you’re going to get upset about it, “impenetrable syntax” wasn’t meant to be taken literally; not only do I know many of the languages I mentioned well, but clearly I and others understand the syntax. Grains of salt, folks. Grains of salt.)
Author’s Note: A repost, predating Java 8 by a long time.