- Java, the programming language,
- the Java Virtual Machine
- the Java Ecosystem, surrounding the language and the JVM.
The language itself, however, is a different story. Back in the days when it was new, its standout features - garbage collection and bytecode execution - made a real difference and relief for weary C++ programmers. Also, the dawn of the internet and Software as a Service favoured Java, and so it had a distinct advantage compared to pretty much anything else. Times change, however, and even though some attempts (such as Java 5 generics) were made to improve the language, development slowed down due to politics and "spastic" insistence on backward compatibility, and pulling the plug on Sun didn't help either. A generation had grown up and realised that they have so much more to express, which they couldn't do in Java - they had to resort to runtime hacking tactics, like AspectJ and Spring, or more recently, Lombok.
Some said, to hell with the chains of static type safety, long live dynamic typing - and this spurred the first wave of languages on the JVM, be them ports of existing languages (JRuby, Jython, Rhino) or new ones (such as Groovy, later Clojure).
Around this time came another blow from the world of reality: Moore's law stopped working for CPU speeds, and so processors started to become not much faster than their predecessors, but merely having more cores in them to facilitate the parallel execution of many threads. That means you have two options to scale: still run on one machine, but utilize as many cores as possible, or - if you have to serve millions of requests per second - try to scale your program to multiple computers. Both approaches lends themselves quite naturally to the functional programming style, where one has (mostly) immutable values, and functions without side-effects that can be passed around as the system requires it. This meant that some people started to realize the benefits of previously mostly ignored languages (Haskell and Erlang, for example), and some had the chance to try something new (Clojure and Scala are the most prominent examples).
But the most sneaky blow came from those who said, hey, I like Java, if only it were a bit less verbose and pedant and a bit more flexible and extensive. Can we do better if Sun and Oracle refused to do it? Why yes, we can - said the developers of Xtend, Kotlin, Ceylon, Fantom, and probably others that we haven't heard about just yet. They all try to cater to the seasoned Java programmer by sticking to the basics of Java while providing some new and exciting features - type inference, lambdas, closures, smart null pointer checking, and so on.
Meanwhile Oracle is moving with the speed of a snail climbing uphill, promising then failing to deliver some functional features in Java 8, and further delaying even more important and fundamental changes like Jigsaw to version 9 at the time of this writing.
You probably have guessed one of my points that I'm trying to make here: Java (the language) is dead. It has been for some time, and I don't see that it could be revived in the future. "Dead" I mean in the sense Fortran and Cobol are dead. They will probably never become entirely extinct, there will always be some systems written in them that need to be maintained and perhaps even developed. But the world had moved on, and I see no particular reason why someone would want to start a new project in Cobol, for example. Sure, Java has a long-long way to go before this "final" state, but I clearly see the path, and frankly, I don't really want to be a part of it. There is a glimmer of hope in the form of native Android development, but I'm not optimistic.
What is the future mainstream language of the JVM going to look like? I think these are the two options:
- It is going to be a statically typed language with type inference, first class functions, pattern matching, having a collection library with immutable collections. It will have a syntax pretty similar to Java.
- with LISP-style syntax (sorry Clojure, you lost it here)
- dynamically typed (static types have too much value for large systems and organizations).
Here are some things you will need to be familiar with by the time we get there:
- lambda calculus and expression evaluation
- lazy evaluation
- functions as first class values
- types as first class values (maybe this is a bit far off, but I can imagine it coming into the mainstream)
- constructing your program in a functional way: immutability, pattern matching, type classes, currying
- mixing functional and object oriented styles
- working with persistent data structures
- reasoning about functional constructs in terms of memory consumption and execution order
- approaching concurrency in an entirely new way, in message passing style and/or transactions
I am now wondering if there is a language out there that unifies the ideas above and allows the programmer to go slow, introducing concepts one by one, or to go crazy and grow a beard.
Scala has lots of promise from this point of view. It has some problems, some serious issues which stop me from declaring it as the Next JVM Language, such as issues with compilation speed, compatibility, language design and so on. Maybe it is not Scala, even though there are more and more companies using it and building really large systems and churning out production code. Maybe it is just a fad that will collapse under its own weight.
But tell me honestly, for YOU, the programmer, does it really matter? Does it matter if you learn some syntax that you may not be using after 5 years, if the concepts behind it are fundamental and will help you become a better programmer for the rest of your life? Some people much smarter than me say it is worth it, so if you don't believe me or agree with me, believe them.
Fortunately, we have entered the age of Freedom of Learning, and so if you are convinced, you have several options to start learning online, without even buying a book. This is where I would recommend you to start.