Language Ecosystems - Java
Overview
I'm starting a new series of posts about programming languages and ecosystems. My aim is to provide some context about the past, what I currently see and my predictions of the future.
What languages are in scope?
I've primarily worked in the server side domain and will be looking at currently popular languages. I'll also talk about languages that are promising for the future. Languages that are used mostly in a professional setting in companies rather than personal projects will be considered. I'll be brief about language features but also try and cover information about the ecosystem which includes libraries, community and other domains that are applicable.
The languages that I plan to cover are-
Java (this post)
Kotlin
Swift
Maybe's
Typescript
Rust
Out of scope
Dynamic Languages
Languages like python, javascript (with node), php, are extensively used in server side programming. However I do not think these languages scale for large teams. Understanding code becomes too complex without types and performance suffers without compilation.
I've used clojure in a professional setting and loved the experience. However I'm older now and prefer simpler code compared to the magic that dynamic languages allow.
Niche languages
Go, scala etc are examples of languages that showed promise and did capture some mind share. They are still extensively used in some areas but I expect usage to stall or dip over the next few years.
There are winners and other upcoming languages like Julia, R, that are used extensively but are not used in general server-side programing.
A ton of the infrastructure for server side programs is built in C and C++. These languages are also used to implement web servers, databases and virtualization software etc and will continue to be relevant for a long time. However I see their market share also reducing over time.
Besides I know too little about these “out of scope” languages as well, so safer to ignore them.
I’m definitely adding fuel to multiple holy wars at once, but what else is the point of a blog?
Language popularity
Two popular language ranking sites are tiobe and redmonk.
Tiobe
Tiobe ranks languages based on counting hits for search engine queries as described in their definition.
Their top 20 list includes Java, C#, swift. Kotlin, Rust and Typescript make it to the top 50 list.
For a longer timeline for the top 10 languages see the chart below-
Redmonk
The redmonk ranking system is based on stack overflow and github data. They published a report for language popularity over time and it has a similar set of languages.
Of note are the ascendance of typescript, R, swift. Rust and Kotlin have just made it into the top 20.
Languages that have dropped significantly are perl, haskell, and objective-c.
Java
Origins and First principles
Java was first released over 25 years ago in 1995 and developed in Sun microsystems (acquired by Oracle). Java is similar in syntax to C and C++ but was designed as a general purpose higher-level language primarily competing with C/C++.
Some of the important features were-
Batteries included - The standard library included a large set of common APIs including threading, collections, file I/O by default.
Cross-platform execution capabilities marketed as - write once run anywhere. Java source was compiled into an intermediate level bytecode which could be run on different operating systems where the Java virtual machine (JVM) was installed. The JVM is independent of the language syntax and multiple languages like scala, kotlin, clojure compile to bytecode and can interoperate with other libraries.
Automatic garbage collection, better memory safety and removal of pointers which drastically improved developer productivity.
Some of the design goals of the language were-
Simple, object oriented and familiar -
Java was designed to be approachable by anyone who has worked with C-style languages. There were no features like macros, or much else that would introduce magic. Java is verbose, but that is a feature not a bug. It was always designed to be used in an industrial setting with low surprises.
Backwards API compatibility is considered very important and most library changes are additive. Slow deprecation of APIs only started in recent versions of the language
Robust and secure - removal of pointers and garbage collection meant that a large class of errors from C/C++ were avoided.
Architecture neutral and portable - With the JVM it was possible to run the same code on multiple operating systems which was important if you needed to deploy to client devices.
The language was initially targeted to run on set-top boxes and was also popular as a browser extension (netscape and java applet days) and eventually settled into a language primarily used for server-side programming.
Java version history
Details on the java version history are captured in wikipedia. Some highlights are-
Version 1 -> version 1.4 - language features were added from the initial version. More libraries were added including the collections framework, regular expressions, non-blocking IO, xml parsers.
Version 5 (2004) - Major language changes were addition of generics, annotations, enumerations.
Version 8 LTS (2014) - Functional programming with lambdas, streams API, support for dynamic languages, small language improvements (project coin) concurrency utils, better type inference.
Version 11 (2018) - java modules, reactive programming, better APIs and improved type inference.
Version 16 and ongoing (2021) - records for data classes, enhanced pattern matching.
Post java 8, the release cadence for java was switched to be time based rather than feature based. Every 6 months there would be a stable release of the language and special releases would have Long term support (LTS). This has made updates much more predictable.
Community and Ecosystem
From the very early days Sun was always trying to build a community around the java language and ecosystem. Many features and extended APIs were created in standards committees with other companies and universities. Adoption by many different communities is one the primary reason for an extremely rich ecosystem of libraries and tooling for the language.
Public specifications and open source were adopted very early. That was not the norm in the early days of the project. That meant that developers could learn from the standard SDK and also develop many libraries. It is very likely that there are well run open source libraries for major applications in Java but from individuals and companies. If anything java has meta libraries to choose other library implementations since there are so many options (java logging for example). Some of the best java libraries include areas like logging, collections and utilities (guava and apache), http and networking libraries (tomcat and netty), database drivers, testing (junit, mockito). On the server-side (or enterprise) domains there libraries like apache struts, tomcat and spring. Spring run as an open-source community killed standards like J2EE which were driven by the industry but not designed well. Projects like joda time were popular as replacements for the standard APIs, but eventually introduced into the main SDK. Java concurrency APIs and the memory model are one example of a project with massive contributions from universities like Doug Lea. The community and libraries continue to remain strong. Even today most companies releasing a language SDK start with a java implementation for server side developers.
Tooling support for Java is arguably the best in the industry. The best IDEs for Java have been eclipse (started by IBM to spite Sun) and intellij idea. Both have provided fantastic refactoring support and have been free for most users. Java is syntactically verbose, but with the tooling support we've always had fantastic code completion and never had to type much in reality. Even today, the IDEs basically make code refactoring suggestions as you upgrade the SDK which means that people like me can learn as they code. Build tools (ant, maven, gradle), testing libraries, dependency management (maven) all have been built by the community. There are also advanced integrations possible to native libraries and at the compiler level.
Future
Positives
Java still remains extremely relevant since it has continuously evolved and adapted to the needs of developers. Adoption of newer language features has been slow (like generics, functional programming) but in retrospect have arrived at the right time and been of extremely high quality. The java ecosystem does value stability and slow change over time which is critical for enterprises as well. Languages like Scala and Ceylon were created in part to provide a better feature rich java. However java has continued to keep its market because of the founding principle of being a practical industrial language. Design decisions like generics, lambdas have been complicated because of design tradeoffs to adhere to the principle of keeping the API backwards compatible. However the benefit is the lifespan of libraries increased and there were no internal forks.
The JVM has improved leaps and bounds in every release as well fulfilling the vision of the java language. The original versions of the runtime were excruciatingly slow with a massive overhead over C/C++ programs. However massive improvements were made in areas of JIT compiling (bytecode to native code generation at runtime) that solved these initial problems. Garbage collection algorithms have also been improved over time and we are finally reaching a “pauseless” stage.
Language updates - large and small - are happening and the API's are evolving for newer applications. Records (immutable classes) were recently added and at least 3 major projects are underway which should modernize the language - Valhalla for value types, Panama for better native language interop and Loom for user-space light weight threads. All of these features exist in other languages but will be implemented in a Java way eventually.
The release cadence with long-term support has brought stability to the release process!
With the GraalVM project, it is possible to compile java to a native binary which means that startup time reduces significantly. This is important so that java continues to be relevant for serverless programming. Java libraries also tend to be bloated (but perform great in a server environment because of JVM magic) but the old rules are now changing with serverless again. Spring had adapted with reactive programming and working on native ports. Alternate frameworks like micronaut are also gaining steam. Java took some time to become container aware and with massive changes like modularity, it is now possible to reach extremely minimal distributions for serverless as well.
Negatives
In 2009, Sun was bought by Oracle and there was an immense amount of uncertainty around the future of the language. Oracle in its nature tried to monetize the language and I don't think it succeeded as much as it would have expected. However I would still rate their performance as average since they did not actively kill the language like solaris. Having a strong community including corporate sponsors like IBM (redhat), eclipse, intel, etc must have helped. Java is also used extensively in many leading companies like Google, Amazon, Microsoft and thousands of smaller companies and startups which means that a fork would have happened if Oracle seriously messed up with stewardship. I'm not sure how much java is evangelized any more. That means that eventually the will kids stop using it in college which means that they will stop using it when they join the workforce. It's hard to say how much active research is being done now in the language as well. The awesome java domain java.com shows some irrelevant download links for consumers. Even searching for "java language" in any search engine does not show any useful landing page for developers. Even today java is not cool (especially with alternatives like kotlin) and this lack of investment in active evangelism will hurt long term. The main JDK has moved to github so it looks like good changes are being made but I'm hoping for more.
In summary, I'm extremely positive that Java will continue to be at the top ten list for the foreseeable future especially because of the massive existing IP in addition to its thriving ecosystem.
Other posts in this series will cover more languages because the competition is heating up. Stay tuned!
Thanks to Bruno Sales and anonymous for reading drafts of this.