Java Episode VI : The Fanboy Menace
There's been a lot of discussion lately about the Java language: were the Java 5 features a mistake, will the features being suggested for 7 be worth it? One aspect of this debate is a kind of 'feature envy', in which pressure mounts to support a feature or particular mode of working because a rival language supports it. It seems that increasingly we live in a world where languages are not seen as merely tools addressing specific problems, but flags around which communities rally to practice their own peculiar brand of fanboy devotion.
Time was when each language did a different job. Working with a lot with numbers? Fortran may well be your thing. Want to write a company payroll? COBOL is where you should look. Want something quick, easy, and beginner friendly? Let me point you in the direction of BASIC. (Big fan of Jedi Master Yoda? Then try, you must, Forth!)
The COBOL folks never fretted that their language didn't have the mathematical dexterity of Fortran. The BASIC folks didn't spend sleepless nights wondering when they'd be able to define record field formats. And nobody seriously wondered whether they should adopt Object Orientation. Each language was a tool, with its own focus, strengths and weaknesses -- you learnt as many as necessary for the type of work you did and picked the right one for the job at hand.How things have changed. Now we worry about how popular our language is, and break into cold sweats when someone from a rival camp points out that our beloved 'chosen one' doesn't have the same dexterity as X or Y when it comes to doing Z.
I recall once getting dragged (reluctantly) into a heated discussion over access modifiers with some Python people. "Access modifiers are a stupid waste of time" seemed to be the general thrust of their argument, as they regaled me with tales of woe about API programmers locking important pieces of functionality behind private or package level access. "They work for some types of language, and not for others" was the gist of my reply, trying to explain that Python and Java were aimed at largely different types of work, and therefore came at programming from different angles. "Unit testing is all you need, not rigid compiler checks" they responded. And so it went on...
It was no good. Python doesn't formally support access modifiers (and probably doesn't need to) so access modifiers were evil! Always! No matter what! As a parting shot I offered "I suppose if modifiers are added to the next version of Python you'd suddenly think they were wonderful?" That really didn't impressed them. :)
Was it always like this? Was language advocacy always this bad? Maybe(?) But perhaps the modern problem lies not in the fanboys themselves, but that the movers-n-shakers who guide how computer languages evolve have started to listen to this fanboy chatter?
I blame the internet! (Being an inanimate and somewhat amorphous entity it is unlikely to fight back, so I feel I'm on safe ground here!)
The internet has forced everyone into the same space. Every language must have its own response to the needs of the almighty web app. Any language caught without a coherent web app strategy is quickly cast aside. And with strong commercial interests backing individual languages (Oracle and IBM behind Java, Microsoft behind C#, etc.) I suppose it is inevitable that languages would end up being sold as 'product' -- like Coke and Pepsi, MacDonalds and Burger King...
(Aside: Given that Java was from the ground up a network friendly language, it is perhaps unfortunate that the community decided to fight for its slice of the internet pie by chasing web applications -- an area which probably favours lightweight scripting languages -- and neglect the applet and WebStart-like technologies in which it had a near unique advantage. But that's history now. What's done is done...)
Whatever the reason, it seems that many of the high profile languages are eyeing each other cautiously. Can it be mere coincidence that a suggested (or implemented) feature in one language pops up shortly thereafter on the speculative 'wants lists' of the others?
The inclusion of
invokedynamic and the making of other languages into first class citizens of the Java 'community' is an excellent idea. It shifts the focus away from the Java language, and onto the platform. Previously the pressure was always on the Java language to provide a solution: a universal tool which could fix almost any problem. (Would it be unfair to say that we want closures, for the most part, because trendy web app scripting languages have them?) Now the JVM/APIs assumes that universality role, and languages like Java, JRuby and Groovy are once again just mere tools in a toolbox, each specialised in a particular class of problem, and/or offering a particular mode of working.
At last we can be free to judge new language features on whether they help solve the kind of problems which should be within Java's special area of expertise -- rather than whether they solve problems better off being addressed by other languages. We could even (*gulp*) reboot Java and create a 'Java mark II' from the ground up, learning the mistakes of the past and ironing out wrinkles which crept into the language due to the need for backwards compatibility.
Now there's an idea!