Java’s more relevant than you think.

by dreamreal on 5 April, 2010

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.)

{ 18 comments… read them below or add one }

Abel Halson April 5, 2010 at 9:10 am

When you enumerate these so-called “newfangled” languages, you do realize that Erlang, Haskell, Python and Ruby all are older languages than Java, I hope. Just checking.

Reply

dreamreal April 5, 2010 at 9:20 am

Well, no. Java was originally created in 1991 and foisted on the world in 1995; Ruby was created in 1993, but Java wins (slightly) there.

Haskell is older (1990 or so). Erlang was released as open source in 1998.

Python was defined earlier than Java (late 1980s), too, but Python 2.0 – the one we’re most familiar with, pre-3.0 (with which it’s incompatible) was in 2000.

I’m aware, yes, that the histories of the languages are actually intertwined. However, I’d say their advent as ‘cool languages’ is much, much, much later – within the last five years, for example, is when all of them really exploded into any semblance of common usage.

Reply

GR April 5, 2010 at 9:31 am

I am learning clojure right now and have gotten to the point where I need Java to understand what’s really happening and in order to do some advanced stuff. Doesn’t seem like there’s really anyways around it. Good think Java is so similar to php, which I already know. And there’s a great free book on the internet (How to think like a computer scientst: Java version)

Reply

Carlos Carneiro April 5, 2010 at 9:37 am

Pra quem so conhece o martelo como ferramenta, todos os problemas parecem pregos.

stupid.

Reply

dreamreal April 5, 2010 at 9:47 am

A rough translation from portuguese: “When all you have is a hammer, everything looks like a nail.”

Valid. But I’m not sure to what the statement applies. I’m certainly not advocating that everyone use Java for everything; use what you need to use and what’s appropriate.

Reply

dreamreal April 5, 2010 at 9:52 am

GR :

I am learning clojure right now and have gotten to the point where I need Java to understand what’s really happening and in order to do some advanced stuff. Doesn’t seem like there’s really anyways around it. Good think Java is so similar to php, which I already know. And there’s a great free book on the internet (How to think like a computer scientst: Java version)

The book’s url: How to think like a computer scientist: Java version. It looks interesting, sort of, but it’s horribly dated. Looks like pre-Java 5, and considering that Java 5 itself has reached its end-of-life period, that doesn’t say good things about the book’s currency.

With all due respect to both you and the book’s author: use a different source.

Reply

Siepert77 April 5, 2010 at 11:01 am

You certainly did invest some time to craft a solid point there. I do however work for a software development company and would like you to consider the following: Our java developers as well as our RoR guys would largely use the same agile methodology, would have similar working conditions and comparable customer projects to work on. All web based projects, to specify it a bit. I would even go as far as stating that the level of individual ability would on average be slightly higher with Java developers in our company.

However, the RoR teams would always come up with overall better solutions for our clients, faster in terms of implementation and easier to staff because code would be more transparent to developers who hadn’t yet worked on a particular project.

Taking that experience of four years and client feedback we decided to discontinue working on Java based projects. All the technologies you mention will compare differently when looked at from a meta-level. On the ground, these languages were developed to handle software projects. When it comes to web based projects Java isn’t an option anymore if money and time are constraints for you. Cool doesn’t even come into it.

Reply

dreamreal April 5, 2010 at 11:07 am

@Siepert77: Good point, and good observation.

However, I’d say that in MY experience, RoR is great for the great middle – and kinda sucky for the high end. I don’t think java’s irrelevant for the web by any means, but traditional java web development has sucked.

That doesn’t mean some of the newer trends don’t fix this somewhat… although my judgement in that arena is fractured by my distaste for UI.

Reply

Dimitris April 5, 2010 at 11:08 am

Interestingly, I see JVM becoming irrelevant faster than Java. It has long been losing ground nearly on every front besides the server side. Even there, on it stronghold, it is being used to a lesser extent as rich client technologies are taking over the presentation duties.

In contrast, Java – the language has been given a second life outside the JVM, through GWT and Android.

Reply

Lars April 5, 2010 at 11:28 am

You’ve got your perspective on languages really the wrong way around. Perl’s not hard to read because it fits the way we think, perl’s hard to read because its syntax hides some operations and encourages side effects. It’s syntax over literacy. Java is hardly simple, and severely constrains your thinking and programming expression in a manner that’s really quite unpleasant once you’re used to mixed paradigm languages. This is why people don’t like it. It’s getting new life since truth be told there’s a lot of java libraries about, and JVM targeted languages let you leverage this community. Really though, running these languages on the JVM is often a slow, clunky and disappointing experience compared to running the natively (for those with C-based origins).

Reply

Siepert77 April 5, 2010 at 1:44 pm

@dreamreal

You’re onto something there. RoR won’t be the be all and end all to software dev for the web. But it’s great for prototyping and small scale projects.

I see nothing wrong with starting a new project in RoR to quickly validate the concept. Now 80% of web projects will either fail that or stay a niche service where the prototype will serve users well. Your investors just saved a busload of money by not having to pay for scalability issues that will never happen.

Once you surpass that level it is normally extremely easy to reimplement the parts of the software that require a sturdier technology to support it. Scala, Java, Lisp: Whatever fits the bill. We could start comparing languages not on whether they can do all the jobs all the time, but rather on when there’s the right time to employ them.

I believe that would save us all a lot of tedious discussions on the political level you mentioned.

Reply

Tero April 5, 2010 at 2:29 pm

Java will stay relevant. What is perhaps a bit ironic is that the number of competing alternatives makes the landscape so utterly fragmented that there is no threat to Java’s dominance until most of them die off.

Reply

pr3d4t0r April 5, 2010 at 9:01 pm

Excellent post!

There are several reasons why we shifted our development from Java to Python on the JVM:

1. Python has desirable language features not available in Java.

2. The standard library is equivalent in both languages, less verbose in Python, and portable across JVM and native environments

3. We can implement functionally equivalent code in (avg.) 35% of the code (less typing!)

4. The compilation/unit testing/local deployment cycle goes from at least 45 seconds to 3 seconds – If you try that 10 – 12 times/hour, that means you’re wasting 10 minutes each just waiting for Maven to complete, the app server to start, the OSGi bundles to activate/deploy, and otherwise screwing with stuff that adds nothing to do with what you’re trying to accomplish

5. My team is already proficient at both Java and Python

6. We have a business requirement to make lower-level calls than what Java supports and that Python provides with a better abstraction level; these calls must be portable across UNIX-like and Windows systems and that was harder to do in Java than in Python

7. We have more fun coding in Python than in Java

I’ve been asked at both TheServerSide Java Symposium and at PyWeb Dev “why not Groovy?” Well… because while the language has some cool features, it still relies on the Java libraries, so it brings with it some of the verbosity we aim to avoid by coding in Python.

We understand the opportunities and limitations of this approach because we’re proficient in both languages. We do some of our work in Java, some in Python, in the end we go with the old rule: use the right thing for the right job. We aren’t using Python/scripting just because it’s cool (well, it is). We evaluated our options before diving in, contrasting Groovy, Ruby, and Python. Given our requirements and the team’s makeup, Python was the way to go for what we’re doing.

Cheers!

E

Reply

dreamreal April 5, 2010 at 9:30 pm

It’s odd that the editor of a site that bills itself as ‘your enterprise java community’ has bailed on java.

Reply

Roridge April 6, 2010 at 4:13 am

Totally agree.

Reply

Ajay April 6, 2010 at 5:15 am

stupid..

Reply

atreyu April 6, 2010 at 6:13 am

I think with this too pragmatic attitude we’d be still programming in cobol, fortran (or lisp!). I see similar arguments (get things done etcetc) in posts defending cobol f. e. In fact java is the nowadays cobol imho
A few years ago java didnt need defenders, it defended itself alone

Reply

puran April 6, 2010 at 1:09 pm

Good Article!! But your comment section sucks!! Can you please improve it so that i can READ??

Reply

Leave a Comment

{ 1 trackback }

Previous post:

Next post: