Concepts of programming languagesECMAScriptGroovyJava 8Javascript

Java 8 – Catalyst for a Superior Language?

These days I’ve read two language-related stories at Lavalobby. The first story I read matched my own experience on the topic. It has also an refreshingly optimistic air. Obviously, the author believes in progress. The second article also had a lot of ideas matching my experience.

Thing is, both articles contradict each other.

While the first article expects Java 8 to be merely a catalyst giving rise to more innovative languages, the second article insists that Java is here to stay. It the programming world’s lingua franca, and it won’t be replaced by a fancy new language.

Both articles have a point.

Let’s start with James Roper’s optimistic article. He examined the Java 8 libraries. As it turns out, Java 8 is going to include some functional aspects, but it isn’t going to be a functional language. You can’t help it, lambda expressions are added to Java 8 as an afterthought, and the ubiquitous quest for compatibility leads to awkward constructions. That’s what I experienced myself when I looked at the Java 8 previews: While Java 8 does smooth out a few rough edges of the language, I failed to program in a pure functional way. It’s an object oriented language with a few functional additions. That’s a great start, but it isn’t enough. Why should developers put up with this half-bred language? Once they’ve grasped the ideas of functional programming, they’ll happily abandon Java and move on to a more progressive language. The choice it to wait another five years or so for Java 9,1 or to could adopt a more advanced JVM language right now.

My bet is that the language of choice might be Groovy because of its similarity to Java. Everybody who’s able to write a Java program is a fluent Groovy programmer, even if he doesn’t know yet. On the other hand, programmers might feel the need for a more radical change. Maybe programmers will adopt Scala, which is a very cleanly designed language that managed to attract a lot of interest and which is supported by an active community. Big companies probably prefer Scala to Groovy because Scala is statically typed. Dynamic typing is great for small programs, but as to my experience it’s a nightmare when it comes to maintaining a million lines of code.

I doubt anything like this will happen. I know the reluctance of my co-workers to adopt a new language. Most of them see no point in learning a new language as long as the old language meets their needs. So they refuse to do so. This is even a clever strategy: you can learn only so many new things at time, and while you’re learning, you can’t make money.

That’s the gist of the second article written by David Green. Come on, folks, he says, you still have to convince me that your new language is superior. As for now, he continues, I have seen a lot of promises and a lot of failures to fulfill them. He seems to dislike Scala in particular: Scala has incorporated too many features and is just as bloated as C++. Remember, Java quickly became more popular than C++ because of its simplicity. Virtually everybody is able to write a Java program. C++ requires far more skills, and so does Scala. As a JAX speaker2 once put it, Scala may be beyond the capabilities of the average Java programmer3 Pressed further what the next big programming language might be, he said it might be the outcome of political developments.

Reluctantly, I’m inclined to follow the latter opinion. The successor of Java won’t be selected by a committee looking for The Ultimate Language. Maybe it will be the result of corporate policy struggles. It also might be the result of some unexpected development like the sudden appearance of smartphones. Until very recently, Objective-C used to be a hot candidate to become Java’s successor. Mobile computing being very popular, a lot of people started to learn Objective-C in order to be able to program their smartphone. The movement stopped one or two years ago, when Android became more popular than IOS. Whether Objective-C is more elegant than Java or not was a moot point: Developers were attracted to the language by the platform (the cell phones), not by the language itselft.

Javascript is another hot candidate to supersede Java. Javascript has gained a lot of popularity during the last couple of years. Much of the popularity stems from the fact that Javascript is the least common denominator of Android phone, IPhones and desktop computers. Each of them is an attractive target platform for your application. The only way to write an application running on each platform is to use HTML5, CSS and Javascript.

Hardly anybody seriously claims Javascript to be better than Java. It’s just different. Javascript can make for a better user experience, but it doesn’t provide a better programming model than Java. Granted, it’s an interesting programming language of its own right. It’s a pity Javascript has been underestimated for so many years.4 You can do a lot of things more elegantly in Javascript than in Java, but in general, I doubt large Javascript programs are more elegant than their Java counterparts. The lack of namespaces is a major obstacle to success 5. And like Groovy, Javascript uses a weak typing system. Dynamically typed languages have a tendency to make their programs crash at runtime. After shipment, that is, on the angry customer’s desktop.

Putting it in a nutshell, I wouldn’t consider migrating from Java to Javascript an improvement. But it may still happen due to the success of mobile devices and due to the customers insisting on better user interfaces.

I found my colleges’ and friends’ reaction interesting when I showed them some functional Java 8 code. It’s like learning a whole new programming language, some of them exclaimed. And they didn’t sound exactly enthusiastic. Mind you: if you’re successfully making your living programming Java expertly, why should you embrace change? I guess most people in the software industry do know they have to embrace change, but that doesn’t prevent them from considering change a chore that has to be endured. Most programmers are happily going to learn a new library. But learning a new language amounts to learning a new set of libraries. It amounts to throwing your knowledge away. It amounts to start from scratch. An intimidating thought.

Actually, it’s an unnecessary fear. What I like about Groovy, Scala and a couple of other JVM languages is that they don’t replace the Java language. Instead, they extend it. Your precious Java knowledge isn’t lost (and that’s where David Greens argument is weak). Granted, you have to learn a lot of new stuff, but the nice thing is you can still use the old libraries. You can even mix – to a certain extend – languages. Groovy, in particular, has a syntax almost identical to Java. It feels like Java on steroids. And while Scala looks a little different, I often think it’s Java the way it was meant to be. Except for Scala libraries: the excessive use of mathematical characters as functions make Scala program look very alien to Java programs. Sometimes Scala programs read just like math textbooks. I’m pretty much convinced this is the major obstacle to Scala’s success. The code just looks way to alien.

Managers play an important role in the quest for The Ultimate Programming Language. Mind you, it’s hardly ever the developers who decide on which programming language to chose. It’s their boss. Or – if you’re working as a consultant – it’s your customer’s boss. In general, the boss is roughly two decades older than you. Two decades ago, adopting a new language did indeed mean loosing all your knowledge and beginning from scratch. That’s exactly what your boss is going to hear when you tell him about the beauties of, say, Scala. He’ll instantly know every application has to be rewritten. He also knows that he has to hire a whole new staff of people who speak fluently Scala. He certainly does know he can’t afford the transition.

Another caste of programmers who won’t embrace change is the caste migrant workers (aka consultants). They depend heavily on standardization because they’re working in a couple of different companies every year. They need a uniform infrastructure across companies. They simply can’t afford to learn a new programming language every couple of months. So they’ll try to convince you to stick to the least common denominator: Java, Spring, Hibernate and HTML. Innovative architectures or alien languages makes their knowledge obsolete. Given the tremendous influence of consultants in the industry, consultants are a major source of Java’s success over other languages.

A nasty problem every early adopter of a new language encounters is the lack of tools. The Java world has a tremendous wealth of great tools. It’s hard to catch up for innovative new languages. I observed many of the early adopters of new languages use simple text editors instead of an full-blown IDE. In fact, they have no other choice. It takes many years to create nice IDEs, and it’s almost impossible to catch up with the Java world. But the majority of developers need their IDEs urgently. IDE’s are a bigger source of productivity than languages, no matter how concise the better language’s programs are. The lack of an IDE is a major obstacle to a language’s success. For example, the mediocre quality of the Groovy Eclipse plugin used to stop me from proposing Groovy as an official language in our company. Luckily, the latest version of the plugin has finally caught up. Today, it’s as good as the Java editor was five years ago (which is pretty good, indeed).

Another key to success is the amount of information available on the internet. Needless to say there’s a lot more information on Java than on any new language that’s hoping to become Java’s successor.

That’s why I doubt Java 8 is going to be a transitory language preparing the rise of a new language. It does offer enough new features to make the majority of Java developers happy, to make them stick to Java. Maybe many developers will feel overburdened by the new features, which will slow down the adoption of the new language version. Maybe David Green’s dreary prediction will come true that Java programmer will find new ways to write illegible programs using the new features of the language. I heard the same prediction by another guy a couple of years ago, but I hope they are wrong. After all, Java 8 is about simplification, not about making things awkward.

But there is hope. Many developers are interested in new programming languages (see Economies of Scala). May we’re talking about a language like Scala or Dart when we’ll mention the lingua franca in 2023.


Further reading
Will Java 8 kill Java?: Ahmed Soliman’s thoughts follow almost the same trail as my thoughts


  1. Even I have to admit chances are this time the next Java version is going to be delivered faster :).
  2. I think it was Gilad Bracha, one of the leading heads behind the Newspeak programming language, but I’m not sure.
  3. I hope he’s wrong. Scala isn’t that difficult.
  4. Mind you: it has even been condemned as dangerous. Ten years ago, web applications couldn’t use Javascript because many users disabled it.
  5. even if it’s alleviated by clever libraries like require.js