Java becoming a LanguageForSmartPeople, not a LanguageForTheMasses?

I’m in the processes of wading through the language changes in the new JDK 1.5 early access compiler. I’ve always enjoyed a reputation as a language lawyer, so I probably have a brain that is geared towards understanding new syntaxes and languages. In fact, I’m really interested in what are often considered “hard” languages, like Lisp and Dylan. So when I say that the Java language is becoming a whole world more complex you can imagine I’m not making an understatement.

(As to why Java is getting more complex, see the end of this article. First, I have some meandering to do.)

Languages designed For the Masses (LFM) and Languages designed for Smart People (LFSP)

If you have a couple of minutes, I recommend quickly reading this article on Paul Graham’s site. Mike Vanier seems to have a stone to grind against the LFM wheel; but I think he has interesting things to say about both camps.

Luckily Java is a LFM.

Java is (currently) a LFM, pure and simple. In fact, more than any other factor, I attribute Java’s success as a language and a platform to it’s simplicity. No header files, an easy compilation process, no multiple inheritance, primitives where you might the performance, no “in-out” parameters, no operator overloading, no-nonsense static typing. It has garbage collection! Just enough syntax and semantics to do good, sound, middle-of-the-road OO designs and implementations; in an easy-to-recognise C++-like syntax (curly braces).

(Okay, as an equal-first for Java’s success I might also nominate the presence of a good standard library. But this makes Java simple too… simple to learn and use.)

I love Java’s simplicity; especially since when I applied for my first Java job, I knew nothing about Java and simply read the first edition of “Java in a Nutshell” the night before the interview. That was enough to convince some people that I knew about Java. ;-)

If you look at a few lines of Java code, there is a good chance you can work out exactly what is going on. You don’t have to ask yourself “is that plus-operator being overloaded” or “is that string immutable or not”? Java gains many strengths just from it’s simplicity alone.

If Java became a LFSP, would that be bad?

Let me quote something from the above article:

LFMs deliberately restrict the abstractive power of the language, because of the feeling that users “can’t handle” that much power. This means that there is a glass ceiling of abstraction; your designs can only get this abstract and no more. This is reassuring to Joe Average, because he knows that he isn’t going to see any code he can’t understand. It is reassuring to Joe Boss, because he knows that he can always fire you and hire another programmer to maintain and extend your code. But it is incredibly frustrating to Joe Wizard Hacker, because he knows that his design can be made N times more general and more abstract but the language forces him to do the Same Old Thing again and again.

As a seasoned Java programmer, I have felt that “frustration of Joe Wizard Hacker” many, many times. I’ve wanted parametric polymorphism (generics), or multi-methods (multiple dispatch), or real closures, or first-class functions, or continuations, or compile-time-loose but run-time-strict typing. So, on one hand, I’m happy Java is a LFM. But the Wizard Hacker in me wants out (that is, I want to do Wizard Hacker work for my day job). But is that a good reason for turning Java into a LFSP? No.

But it may turn out that it doesn’t matter if there is a good reason or not.

Java has already landed and complexity won’t displace it

I like Robin Sharp’s taxonomy of the programming language life-cycle. Robin puts Java somewhere between Maturity and Inefficiency (I’d say we haven’t quite hit Inefficiency yet); that is, the language and libraries are capable of delivering profitable solutions, tools have matured and there is a particular focus on functionality rather than efficiency (in order to reap profits).

I think we can agree that Java has already hit the mainstream, that there is a large body of Java code and coders, and that in many organisations there is a large (and varied) level of inertia against moving away from Java. Sun is going to be adding complexity to the Java language; you may not want to use it, but there is nothing you can do about it. Java already has you on it’s hook, and no amount of wiggling at extra complexity will shake you off, if you still need Java.

What complexity am I talking about?

I like all the little nuggets that are being added with JDK1.5, but there are a lot of little nuggets in there. The next time you look at a few lines of Java code, will you be able to remember even these 13 additions to the simple core language?

  • The new for loop syntax.
  • Auto-boxing on assignment and parameter passing.
  • Unboxing may cause a null-pointer exception.
  • Which method of a set of overloaded methods gets called in the presence of auto-boxing.
  • What method is being called when some methods may have been “statically” imported.
  • What identifier is referred to when enum constants have been statically imported.
  • What is going on when methods have been added to individual enum constants.
  • What the new angle-brackets mean when defining a generic type.
  • What the angle-brackets mean when using a generic type.
  • Where the angle brackets go for a generic method.
  • Remembering that generic methods may throw generic exceptions.
  • Remembering that you can’t use reflection to determine the parameterised types at runtime.
  • Understanding what happens to your generic type when someone simply “casts it away”.

(And that’s not even mentioning the “variance” proposal to Generics!)

That’s what I mean by complexity.

So what does all this mean?

In short, I’m saying “get ready”. Java is getting harder. You use Java. Java is getting harder *for you*.

7 Comments

  1. Gerry
    Posted June 3, 2003 at 11:33 pm | Permalink

    Check out http://www.artima.com – there’s a new Bill Venners interview with author/black-belt programmer Bruce Eckel about Python. He seems to think that Python is more of a LFM than Java is. I agree with some of his points, but for the most part I think I can live with Java just fine.

    It would be nice if Sun agreed to either fork Java on purpose or create a "Java 3" version that breaks all compatibility with previous versions in order to strip out deprecated stuff, upgrade primitives to real types, and fix a whole bunch of inconsistencies and poor designs that they’ve since learned better not use use. Something I’d also like to see is a better modularized library system where if a JVM didn’t have the "standard" libraries it needed it could do a WebStart/JNLP "get" of the stuff it needed at runtime (or not, if so configured). Then the JVM starts out nice and slim and could be deployed on purpose to remain that way.

    There really is a lot of Java that needs to be "fixed", but like I said, I can live with Java as is API-wise for quite some time and still be happy as long as they keep improving performance. OTOH I think I might give Python a try as well….

  2. Malcolm Edgar
    Posted June 4, 2003 at 11:50 pm | Permalink

    I am quite concerned about the new language features for 1.5: http://java.sun.com/features/2003/05/bloch_qa.html

    They may save a couple of lines of coding and some type casting, but I think the cost benefit ratio is too high. Generics in particular will give people enough rope to hang their whole team.

    I think it is really too late to be introducing these sort of changes into the language. My target platform is 1.3, it is going to be years before the app servers catch up to 1.5 when its released. All this stuff is really academic.

  3. Terris Linenbach
    Posted June 19, 2003 at 12:06 am | Permalink

    The Java linguists at Sun seem to be envious of the .NET platform which, after all, supports any sort of language that defines a Turing machine one way or the other. I have often heard Java proponents say that Java’s simplicity — and the fact that there is only one dialect known as Java — is its main advantage over .NET. So I wonder what Java people think about Sun polluting the Java namespace. As someone who has no investment in .NET or Java, I’m just an interested observer. Java is about multi-platform reach mainly, rather than its simplicity, but thanks to the Mono project, and the ECMA standardization of c#, .NET can be viewed at least somewhat in the same manner. At least ECMA and not Microsoft or Sun have a say in what C# becomes, and I know many Java developers who are worried what Sun will do next to interfere with their apple cart.

    Thanks for the opportunity to express my views.

  4. Terris Linenbach
    Posted June 19, 2003 at 12:09 am | Permalink

    Please allow me to rephrase

    At least ECMA and not Microsoft or Sun have a say in what C# becomes

    with:

    At least Microsoft nor Sun have a monopoly over C#.

  5. Frank Harper
    Posted August 13, 2004 at 7:41 am | Permalink

    One year later and JDK 1.5 is coming out RSN.

    My question is will the added complexity now allow you to do your "Wizard Hacker work"? That isn’t apparent to me, since almost none of the features you mentioned have been implemented in 1.5:

    "I’ve wanted parametric polymorphism (generics), or multi-methods (multiple dispatch), or real closures, or first-class functions, or continuations, or compile-time-loose but run-time-strict typing."

    So my question is, has Sun just added complexity without much real benefit?

  6. Posted August 16, 2004 at 3:33 am | Permalink

    A very good question. I certainly don’t think the 1.5 features would please any "wizard hackers". And at the same time, this added complexity is strangely targeted at low-skill (VB-ers) coders, to make it simpler.

    I think we will need to look to Groovy for "wizard hacker" features (eg, it has clousres).

  7. NT
    Posted January 14, 2009 at 10:10 am | Permalink

    The people who think that ECMA standardization and Mono will make C# a cross platform language truly must have been born yesterday! Microsoft and standards? They don’t work well together, don’t you know that? As ever, if the standard succeeds its goals and gains adoption, oh my, a new version will be forked by MS (e.g. NET 3.5) which is not currently supported by Mono, but say, it’s so much more productive as you get all these free tools with it ;) If the standard does not gain popularity, well at least some swinging voters moved on Microsoft’s side, preaching how green the field is there.

    Furthermore, clearly they do not understand that Java is cross platform as in “it works fully on all supported platforms”. Mono barely works with 2.0, with a lot of things not being there yet (not even on 1 platform, not 2 or 3) and other never being planned to be there (say full WPF stack). The latter is not called cross platform last time I checked, rather “half-baked”.

Post a Comment

Your email is never shared. Required fields are marked *

*
*