Why Java is the most popular programming language

Roger Smith examines why 20 years after its release, Java tops the TIOBE index as the most popular programming language.

Twenty-year-old Java, despite being long in the tooth, is still the most popular programming language for developing enterprise applications. The TIOBE index, which is one measure of the popularity of programming languages, shows that Java has been number one or number two for the past decade and has had a recent uptick in popularity.

Java vs. other program languages in popularity

Credit: TIOBE Index for April 2016

One interpretation of this graph shows Java (blue) being overtaken by C (black) over the course of the decade. What this interpretation belies is the fact that Java and the C family (C, C++, and C#) of languages are generally used for different purposes. Because C is a lower-level language that is faster and requires less memory than Java, C is often used for many more cutting-edge applications like gaming and virtual reality.

Higher-level Java applications are usually compiled to bytecode that can run on any Java virtual machine (JVM) regardless of computer architecture, which make them easier to deploy in enterprise environments. The prominence of C and Java atop the TIOPE index isn't by accident, since both of these languages have powerful advantages and features that developers continue to use to create robust applications and software.

It's worth remembering that the TIOBE index is not about which is the most popular programming language or the language in which most lines of code have been written -- that is likely to still be COBOL, until every single mainframe is unplugged -- it's an attempt to measure the size of each language's community of developers. A Java design goal from the beginning was that it needed to be simple, object-oriented and familiar, which allows enterprise Java applications to be maintained by others in the large established base of Java developers.

Portability is also one of the key strengths of Java. Java software runs on everything from laptops to data center servers, from game consoles and IoT devices to scientific supercomputers, which makes it a good choice for business applications that need to run on several platforms. Java's "Write once, run anywhere" motto may qualify as hyperbole in some cases, but it's closer to being a true cross-platform programming environment than any of the other languages on the TIOBE list.

Java's evolution

The fact that Java programs run on a JVM rather than directly on a computer's processor as native code, as C and C++ programs do, meant that Java, especially its early versions, lagged in performance compared to other languages. While developers had a legitimate complaint about Java's speed in the early days, that's no longer the case. JIT compiled code on modern JVMs runs very close to optimized native code in terms of speed and certainly much faster than scripting languages like Perl, PHP, Python and JavaScript. This is a point that James Gosling, the creator of the Java language, made in an interview I did with him at last year's JavaOne conference. "Any of the scripting languages are still at least 10 times slower than Java. The JavaScript acceleration in the Chrome browser is probably the best you're going to get, and it's still not great," Gosling said.

Your enterprise's investment in Java applications ought to be safe, at least for another decade or two.

Android development is a main driver in the recent uptick in Java's popularity and the language's re-emergence at the top of the TIOBE index. Google has never officially commented on why it's using Java for Android software developer's kits, but there are several obvious Java features that may have swayed their decision, such as the fact that Java apps run in a securable VM where there's no need to recompile them for every Android device. Not to mention the large number of open source libraries and development tools available to make developers' lives easier.

Another one of the main reasons for Java's popularity with a large swath of developers is the Java Community Process (JCP), which is the mechanism for developing standard technical specifications for Java technology. The JCP allows any Java developer to review and provide feedback for hundreds of different Java specification requests, as well as participate as a member of a Java Expert Group. JCP membership for organizations and commercial entities requires annual fees, but is free for individuals.

Thanks to the JCP, the Java language has been extensively revised to address all kinds of different programming problems. Case in point (see sidebar) is how a simple Java function to sum an array of integers has evolved over the last 20 years, through different Java language releases.

This coding example shows how the language has evolved over the years by tackling pain points that Java developers complained about through the JCP. In response to complaints about Java's verbosity, the latest version, Java 8, added features taken from functional programming idioms that make Java code shorter and more expressive. The Java 9 release, due in 2017, will introduce modularity to create a scalable and more secure platform. Beyond Java 9, the Valhalla and Panama releases, are designed to provide more efficient access to data and better control over data layout in computer memory to achieve higher performance, which are pain points that big data developers face.

While mainstream Java is managing the difficult task of evolving and remaining widely popular, Scala (No. 31) and Clojure (No. 50) are a couple of niche languages that warrant higher rankings than they currently have on the TIOBE index. Based on current scuttlebutt in the Java community, either or both of these languages have the potential to replace Java as the most popular programming language since this is where a lot of cutting edge innovation is happening. However, both Clojure and Scala use JVMs and can be considered part of the greater Java ecosystem. This means that your enterprise's investment in Java applications ought to be safe, at least for another decade or two.

How do you account for Java's ongoing popularity? Let us know.

Next Steps:
Java's 20th anniversary: What's in store?
Talking microservices and container technologies
This Java programming example will help you learn the language
Learning the Java language

The evolution of Java syntax

EXAMPLE OF JAVA CODE EVOLUTION:

SUMMING AN ARRAY OF INTEGERS

// Summing an array of ints

// Java 1

int result =  0;

For (int  =  0; i<array.length;i++)

result += array[i];

System.out.println("Sum: " + result);

// Java 5: Use enhanced for-each loop

int result = 0;

for (inti : array)

result += i;

System.out.println("Sum: " + result);

// Java 8: Use streams library and parallel computation

System.out.printf("Sum: %d%n",

IntStream.of(array).parallel().sum());

Dig Deeper on Core Java APIs and programming techniques

App Architecture
Software Quality
Cloud Computing
Security
SearchAWS
Close