As I write these lines, the Java programming language has its 21st version released – as always, with some features like virtual threads, record patterns, key encapsulation mechanism API, generational pattern matching and others, some of them in preview format. But the goal here is not to pinpoint Java’s features, but rather discuss the applicability of the language nowadays and try to understand if it’s still worth for a programmer to invest his time and effort in this language.


As an old Java programmer (aka, a “dinosaur”) who started learning the language in 1999 and has been using it professionally for over 23 years, I think I can put some arguments on the table. Of course, I don't expect to give a simple answer to the question I posed in the beginning, and I’m sure I will be far from obtaining consensus about it, but I feel comfortable talking about my own experience with the language and give an opinion about what I think are Java’s strengths and weaknesses.


Java was officially born in 1995 and had its 1.0 version released in January 1996. Sun Microsystems, the company behind Java, was mainly known for their computers at that time, but also for being an advocate of open software. This principle was important for the development of the language and can be exemplified by the acquisition of the MySQL database in 2008, just a year before the company was sold to Oracle. 

 

Being a Java programmer over the years

When I started using Java professionally, it was in its 1.2 version and the environment in which developers were living was much different from the “world” of languages and tools we have today, especially considering web development.


In the beginning, Java was considered a good choice for building web applications. Concepts like “front-end” and “back-end” essentially did not exist, and the choices we had to build web interfaces were limited to HTML, CSS and JavaScript. 


The frameworks era was only just beginning. When I started developing in Java, we used things like Java Server Pages (JSP) and Servlets to write code for web applications. At some point, frameworks began to emerge and things started to become a little easier (although some people may disagree with that).


Over time, new frameworks and tools came and went, new versions of Java introduced new ways of dealing with the problems, and things changed so much that sometimes it’s difficult to believe that the language itself is still here.


Today, Java is considered to excel in back-end development. I used Java in a context where there were nearly no frameworks for front-end. Throughout my career, I experimented Java Server Pages, Struts, Java Server Faces, PrimeFaces, among other frameworks, altogether with HTML, CSS and JavaScript, but it always seemed to me that Java was not the ideal solution for front-end. When the JavaScript frameworks arrived, the use of Java in back-end became standard.

 

Java and Object-Oriented Programming (OOP)

Before diving into some (alleged) Java problems and benefits, I’d like to talk about another concept that I believe is intrinsic to the language, and for that sake I will use my experience as a teacher. Java was the first mainstream programming language to use object orientation concepts at a commercial level, with reasonable success. So, to learn Java and use it properly it was always necessary to understand the OOP paradigm.


I experienced this problem not only as a developer, but also as a teacher. For 16 years, I prepared students to be programmers, trying to teach them Java, OOP and OO Analysis and Design. To be a good programmer, the process starts with good logical and mathematical thinking. Most of the students (60-80%) that arrived in my Java classes did not have those foundations, making my job much more difficult.


Of course, this happens when learning any programming language. However, in Java’s case, the students also had to study object orientation, leading to a lot of frustration. In the end, most of them blamed Java for being “too difficult” to learn, when the question is a bit more complicated. A final note about that: some students, when they finally understood OOP concepts, like inheritance and polymorphism, became so eager to use them that ended up using them incorrectly. But that’s another discussion.

The dark side of Java

Now let’s talk about some aspects of Java that open up room for discussion: good and bad features that cause people to either love or hate the language.

  • Java is slow compared to other languages, especially C/C++
    Since the beginning, Java adopted the “WORA” (Write Once, Run Anywhere) principle. Yes, Java is an interpreted language and can be slower than others, especially the ones that produce machine code.

    On the other hand, Java compilers evolved a lot in order to maintain code that is used ready to run (which, of course, takes up more memory usage). There are also processors with multiple cores that can divide the job of executing a program.

    Finally, there are good practices that a Java programmer should adopt to improve the performance of a Java program. Common examples of these practices are:
    • Choose the right data structure to solve your problem.
    • Avoid the use of long methods.
    • Try to optimise your loops.
    • Avoid using multiple if-else statements.
    • Prefer StringBuilder class over String.
    • Avoid creating complex objects.
    • Prefer primitive types over wrappers.
    • Optimise your queries to avoid unnecessary “trips” to the database.

  • Java is always behind its competitors and takes longer to adopt innovations
    Many Java critics argue that the language takes too long to incorporate important changes, unlike alternatives like Kotlin, Python, JavaScript, or Golang. Having worked for companies that adopt Java as the main language for nearly my whole programmer career, and having dealt with critical systems that have significant impact on organisations, I can say that not adopting new Java versions right after their launch is a very common practice among medium and big-size companies. 

    Today, Java versions are launched every six months, in March and September, and only some of them are recommended for use in production (8, 11, 17 and 21 being the last ones). These are called Long-Term Support (LTS) versions and companies usually adopt them a long time after they’ve launched, as a way of avoiding problems (they frequently wait for a new LTS version to adopt the previous one).

    So, from my point of view, companies look for a reliable language that attends their needs (and their clients’ needs), which are more important concerns than having their products being furnished with the latest innovations.

    Sometimes, a new functionality is not present in Java itself, but it is present in some tool of its ecosystem, which is huge. For example, that’s the case of Spring, perhaps the most well-known Java-based ecosystem in the market. Spring covers a bunch of functionalities that extend and improve Java itself, and it’s widely adopted today when it comes to web applications and cloud-based Java applications. Quarkus is another example of a tool that allows the development of Java applications for the cloud.

    In conclusion, what I have seen from my experience is that companies that rely on Java for its critical systems are more concerned with the stability of their enterprise systems than with new features of the language.

  • Java is outdated and, therefore, not being used to build new systems
    Companies today seem to think much more about the myriad of possibilities of programming languages they have before starting a new project. Understanding what each language offers is crucial when choosing what to use in a new project.

    It’s true that we have a huge base of installed Java systems running around the world, and this cannot be neglected. The language is over 25 years old and has been widely used across time, so this is a natural consequence. Many systems evolve from pre-existing systems, so having a Java legacy, a language that still exists and is being maintained, is important when deciding to add new capabilities to an existing application.

    Also, as I mentioned before, a new functionality that maybe does not exist in Java’s core can be provided by some tool in the ecosystem, and sometimes by more than one provider. 

    So, even when we must start a new project from scratch, I don't think Java should be discarded. It’s also important to say that today’s systems are not a result of a single language itself. Systems are made of a stack of tools that integrate to produce a value. Java has the advantage to be easily integrated with many tools in the market, due to its time of existence, big community and general acceptance.

Java is still breathing

According to the TIOBE index, which measures the popularity of programming languages and is updated monthly, Java is still in the top 5 of the most popular languages in the world. This is a good indicator that the language is still alive.


Java is compatible with a lot of solutions used by developers to produce a working computer system. Most tools developed in the market are Java-compatible, which demonstrates the force and popularity of this language.


Take a look at Stackshare, a portal where developers and enterprises share the tools (stacks) they use in their normal activities. Here, we can see that companies like Uber, Instagram, Airbnb, Netflix, Google, Amazon, among others, use Java in their stacks.

 

This means there are always jobs for Java developers and these offers don't seem to decrease. A quick search for Java job offers in websites like LinkedIn, for example, can prove this point.


Finally, I can say from my own experience that Java is used in big companies to build systems that provide value for millions of people. Throughout my career, I’ve had the opportunity to participate in many important projects that had Java in their core – for example, Brazil’s most popular instant payment system, named Pix, was developed using a bunch of technologies, but in its core there’s Java code running.

 

“It’s too bad she won't live. But then again, who does?”*

It’s clear that Java does not have today the relevance it had in the past. We don’t know for how long the language will stand, but the facts don’t seem to suggest any disappearance in a short/medium term. Java products continue to be developed and maintained, generating demands we can see every day. 


So, Java is not dead, or at least not near its death. Java has its problems, but it’s still widely used, in part because it has a huge base of installed systems, a vast community and ecosystem, but also because it works and people think its reliable. It’s also true that the language keeps reinventing itself throughout the years.


With the growth of new technologies, especially in the Artificial Intelligence (AI) field, some may say that programming languages will not be used in a few years. True or not, that’s a challenge not only for Java, but for all the programming languages. The fact is that all of them will have to keep adapting to the ever-changing world we live in.

 

* Famous quote from the movie Blade Runner (1982), by Gaff (Edward James Olmos’ character).

Udostępnij ten artykuł