You can often hear statements that “Java is dying” and all modern people should switch to modern languages like Go as soon as possible. They say that it will be good with them, but it will be bad with old languages that everyone is about to give up. But is this true?
You can see two different variants in the “pre-death” statements. Some people say “Java is dying” quite literally: the time for the popularity of the language has passed, fewer and fewer people need it, and those remaining people are about to abandon it. Others believe that Java may be all right in terms of popularity, but technologically it is stuck in the last century, so it is not respectable to write in it now. Of course, to give an exact answer the easiest way would be to buy research papers about all programming languages, but we have no shape money and time. So let’s just take look at the available info and look at both of these theses one by one.
“No One Wants Java”
In the first case, let’s look at the hard numbers instead of “I think so.” Unfortunately, there is no single indicator of the popularity of languages in the world, and all available sources can greatly mislead. But if you compare several different sources, you can rely on the result much more confidently than the “my friend John codes in Rust” data.
The most famous such “hit parade” is the TIOBE Index. Yes, there may be questions about its methodology and results; you cannot blindly believe it, but you cannot completely ignore it either. Let’s open up the most current data—for July 2021, Java is in second place. According to TIOBE, it is not just a “dying language,” but one of the most popular languages in the world.
Here one could argue that “but the dynamics are probably negative.” The numbers vary from source to source, so it is impossible to say anything with absolute certainty, but if there were some huge annual decline, then it would be noticeable. But in practice it is the opposite—in all three sources, Java positions are stable for at least 2-3 years. All in all, if you start a Java project now, you won’t find yourself alone in a couple of years.
“Why Does It Matter?”
Why does the popularity of a language matter at all? Why should one use the same languages as others? Of course, there is no strict requirement, someone writes in Haskell and is happy. But there are several significant factors.
For example, the size of the job market. If a key developer in your company decides to quit and writes a project in something rarely used, how easy will it be to find a replacement? And the converse problem: if you are that quit developer, how easy would it be to find a good job in your field? Java has one of the largest job markets—much larger than Go.
In addition, the high popularity of the language means that there will be a lot of information on it on the Internet (blog posts, reports, answers to Stack Overflow), but when you use a rare language, you may face a lack of information . Of course, there is a certain romance in being a pioneer, but it is not the most winning strategy for quick problem-solving.
Such questions are as important as “does it have pattern matching?” When choosing a language, and Java has a huge advantage simply because of the size of the ecosystem. Because of how many people use it, it turns out to be a good choice when creating new projects, which in turn encourages an influx of people. And if this self-sustaining process ever goes away, it will certainly not in the next few years.
“Java Is Stuck in the Last Century.”
Now let’s move on to the second thissis: while the locomotive of technology is rushing forward, here is a language from the 90s. Why would you use it when you have a more modern language?
Generally speaking, for many people, it is not the language itself that is more important, but its platform and “everything around”: solutions from major vendors and open-source libraries from enthusiasts, IDE support, and alternative JVM languages. And if we consider all of this as a whole, there is a lot of development going on.
But we can not even consider third-party projects, but look at what happened directly to Java in the last decade.
In 2011, Oracle acquired Sun Microsystems, thereby getting Java, and at that time, the prospects looked unclear. Other products that came to Oracle at that time (OpenOffice, Solaris, Hudson) had a difficult future.
But Java turned out differently: here Oracle did not abandon the purchase on the shelf, but invested resources in development. And the version of Java 8 released in 2014 was a major event; thanks to the innovations, the language was noticeably changing and modernizing. The industry willingly accepted this version, and those who still have to maintain projects on older versions are usually sympathetic.
In 2017, with the advent of Java 9, a long-standing project to modularize the JDK reached release. As with any major project that has existed for decades, the internal dependencies in the JDK began to resemble spaghetti over time. And for the sake of “sawing” it, these dependencies had to be unraveled into a coherent system—that is, in essence, a gigantic refactoring was done. With projects that are truly “bogged down in the past,” this does not happen.
And since 2018, a new release cycle has been in effect: instead of preparing a large version of Java for several years, they started releasing a smaller version every six months. This was done just to match the pace of the industry, to release features faster (if some are ready, you don’t have to shell them for years until the next version is released). And there was a regular stream of releases that didn’t turn everything upside down, but still added something notable.
In general, it is incorrect to talk about the lack of development. What we can talk about is the greater conservatism of Java compared to other languages. It is true in many issues they try to act cautiously, rather than rush headlong into things. But that leads to the next question: is “rushing headlong” really a good thing?
A couple of years ago there was a lot of complaining in the frontend world about how things were changing rapidly, preventing you from being calm and focused. And in the Java community, not everyone is happy with the new release cycle now either.
There is no one right speed at which technology should evolve: what’s good for a startup is bad for a giant bank. And Java’s conservatism itself is neither a plus nor a minus: it is good for some and bad for others.
All of the above does not mean that Java is the best language in the world for everyone without exception, and you should use it. When choosing a language it is worth looking at what is required in a particular case, rather than relying on the Internet shouting “change from X to Y, otherwise, you are behind the times”. And if you approach it that way, Java will still be a good choice in most cases.