Saturday, May 24, 2008

Is Java the new C?

I've been watching the language changes being proposed by the community for Java 7.0 like a hawk.

Alex Miller's Pure danger tech blog has become one of my favourite reads as a result.

However I'm pretty sure I'm not the only one who seems to be rather disappointed about what came out of JavaOne this year regarding the proposed Java language features.

It seems that many of the changes will probably be postponed until Java 8.0.

Maybe this is not such a bad thing though.

If I look at the message coming out from JavaOne I could summarise it as being: "Please use Java as a platform but you don't need to use the Java language at all".

In fact I have have a vast array of excellent choices:

  • If I want a highly productive platform for doing web development, use JRuby.

  • If I want a highly productive platform for my existing Java Developers use Groovy.

  • If I want a concise type safe platform with high productivity use Scala.

  • If I want a mainstream language with Java benefits and high producivity (when it matures) use Jython.

  • Of these languages, Jython (Python in Java) and JRuby (Ruby in Java) are the most "mainstream" being in the top ten on the Tiobe index with Python and Ruby respectively sandwiching C# - which in itself is quite amazing considering that neither have had C#'s marketing.

    Groovy and Scala are a little less mainstream but both have broken into the top 50 with Groovy at number 33 behind Smalltalk and Haskell and Scala finally breaking into the top 50.

    Would I still need to write stuff in Java? sure, but only for those bits and pieces which need some low level stuff where speed becomes important especially considering that Java is the only language in the list which still supports primitives, In this scenario the Java language takes on roll much like C.

    In fact I'd even go so far to say that Java needs to stay the way that it is in in order to keep it viable for this very important role.

    After all we wouldn't want to turn it into the new C++.

    Maybe then we should stop regarding Java as the new Cobol but rather look at it as the new C.


    Casper Bang said...

    Here's the thing I don't understand though. While officially "one language", it's pretty clear that there are huge fractions which consider Java 1.4 real Java and stick to this. Others consider 1.5 real Java and will not be moving to all the closure stuff. So for all practical purposes, we are talking about 3 different languages (let's not even go into the ME and EE stuff) and as such, I fail to see the big problem in making 1.7 the one where we break computability and fix up the language for good - arguable over the coming years, a LOT of new software projects will be developed in Java and would benefit from this.

    julian_za said...

    Wouldn't breaking the language be equivalent to creating a new one?

    As you rightly say many people think 1.4 is the last real java, what do you think closures will do?

    The beauty of something like Groovy is that it is Java in a new more modern form and can be used in conjunction with legacy.

    It is Java 7.0.

    Why go halfway when we have something that has these features instead getting something that is half baked especially if we are going to break compatibility?

    BTW: ME and EE are just a set of APIs, the language is unchanged. There is only one Java language thank goodness.

    Ricky Clarkson said...


    Java ME is/has a separate language. For example, it has not float or double types.

    Talden said...

    "My language is better than yours because it has feature X and we managed to prevent your language getting that feature..." -- brought to you by HypotheticalQuotes (tm)

    Our organisation has a huge code-base in Java and an experienced team that knows Java. The extent of proposed changes for Java are an incremental learning experience for this team and, as java is the dominant language of the industry, we're likely to be able to find additional team members easily.

    I believe that, as with Java 1.4 to 1.5, there'll be only minimal effort to be able to move our code to forward to meet compatibility. We can then allow the usual development processes to gradually take advantage of the new features.

    Java, as with any language, has a limited shelf life but I'm sure that if the language is locked down, or even held back much, it will expire much sooner than if a greater proportion of the proposed extensions are adopted.

    If people want to develop a better language to replace Java, great.

    Please let it compete fairly, don't lock down Java to try and force people to seek something that isn't locked in the past.

    JBaruch said...

    Java ME has both float and double for a very long time now. 27 Mar 2003 was more than 5 years ago.

    julian_za said...

    Please understand that I'm not against language changes, I'm just pointing out that maybe a new language would be better than introducing new things that the language was never designed to have. If Sun can add radical new language changes without breaking the language too badly, then they should definitely do it.