Is Java Still Used and Relevant in 2023?

ProfilePicture of Nicolae Caprarescu
Nicolae Caprarescu
Senior Developer
Three developers talking in front of a coffee machine with a Java logo in a frame behind

In 2023, Java (together with its associated framework ecosystem) has been experiencing a steady loss of its “cool factor” in the web development community of late. By contrast, dynamically-typed languages such as Python, why are trending upward in popularity.

In this article, I’ll examine if this loss of interest in Java is justified by breaking down the technical and business perspectives of the language with comparison to Python.

To get to the bottom of this, we’ll analyze how Java is architecturally inclined towards scalability and how it outperforms Python in benchmarks. We’ll also explore what made Twitter decide to switch from Ruby to Java and look into a market segment where it has a strong presence.

Then we’ll look at the factors that can cause differences in time-to-market when using Java versus dynamic languages. The final aspects we’ll assess are hiring, from a remote-working perspective, and financial considerations. With this information, you should be well equipped to make a savvy decision whether to consider using Java for your software project in 2023.

Table Of Contents

The Technical Perspective: Java vs Other Languages (Speed & Multithreading)

Python vs Java: Architectural Differences

Python is an interpreted, dynamic language and Java is a compiled, static language. Throughout this article, we’ll be referring to the default (reference) implementation of both Python and Java. While Java’s JVM takes a bit longer to get going due to its warm-up phase, the Python runtime is faster at starting up. But this is where Python’s advantages in terms of pure execution performance stop.

Python interprets all code at runtime, and, even though it does translate code to bytecode, the fact that it does so at runtime means that there’s not much optimization going on. This is in contrast with Java, where code is translated to bytecode at compilation time and then executed inside a JVM. Yes, there are Python implementations that can compile bytecode before runtime, but this negates the whole point of the reference implementation of Python: using this means that you start going towards Java and introduce a slower startup time, which essentially negates one of the advantages of using Python in the first place.

At an abstract level, there are multiple ways to achieve parallelism, and multithreading is one of the most popular choices. Python lacks true multithreading support because of its Global Interpreter Lock: this prevents multiple threads from executing in the same interpreter. Java, on the other hand, offers out-of-the-box support for multithreading via its standard API, which can be further enhanced by its many existing frameworks.

The fact that Java translates code into bytecode when it is compiled rather than when it is run helps make it faster than Python. This is combined with Java’s multithreading-oriented design, which is in contrast with Python’s single execution thread model. Of course, whether multithreading is the best solution for your parallelism requirements depends on the context. Sometimes, a multi-process setup might be better, or even a single-threaded model. However, if you do need to make use of multithreading (which is often the case), Java is the clear winner.

A table that compares the benefits and key features of Java and Python

Python vs Java Benchmarking

It’s difficult to say what benchmark mechanism is most appropriate to use without having the context in which a given web application will operate. Given the broader focus of this article, the best we can do is to analyze as many benchmarks as possible and to ensure that the comparison is fair by always comparing the results of the same benchmark for each language.

Fortunately, such analysis has already been carried out and we have extensive data as part of The Computer Language Benchmark Game. In general, the main reason for benchmarking is execution time, and Java is a clear winner on this category in each of the benchmarks provided.

Case Study: Twitter’s Move from Ruby to Java

In 2012, Twitter was able to withstand the record traffic generated by the US Presidential election thanks to its move from Ruby to Java, a process which was started in 2008. Twitter quoted Ruby’s inability to deal with long-running and memory-intensive processes as primary reasons for the shift.

However, the fact that Twitter moved to Java doesn’t mean that Ruby on Rails doesn’t have its place. On the contrary, when starting out, like most startups, they needed something that would give them the best return in terms of speed to market for each hour of development time. And Ruby, much like other dynamic languages used for web development, was great for that.

But things changed, and as the platform grew, being able to handle operations at scale became more important. Their move to Java and Scala happened in order to resolve this, and very few of Twitter’s services still run on Ruby.

Market Study: Java Still Rules the Enterprise Financial World

An analysis carried out by eFinancialCareers on the number of job ads published by American and British banks shows that Java is still the most heavily used language in the enterprise financial world. This includes banking institutions, insurers, stock markets, and other types of financial firms.

Interestingly, Python is the language that showed the greatest jump in demand year-on-year within this study. This is partially due to it being more accessible than Java to people who aren’t primarily software developers. In particular, Python’s rich machine learning ecosystem of libraries means that it’s increasingly used in the enterprise financial world by people who are involved with financial analysis and modeling but who aren’t technical.

This also drives up Python’s overall usage because there are clear advantages if both technical and non-technical staff are able to use the same language. Although Python is increasing its financial enterprise market share, Java is still the clear leader.

The Time-to-Market Perspective

The claim that we are going to assess in this section is that the time-to-market is reduced when using a dynamic language for a web app compared to using Java. This consideration is especially relevant to startups who are often cash and time-constrained, relative to established enterprises.

The supporters often cite Java’s verbose boilerplate code and a dauntingly large framework ecosystem as their justification for this claim. In the upcoming two subsections, we’ll first create a few API endpoints using Spring MVC, and then show how Ruby saves you the trouble of doing so.

Let’s Create Two Sample Endpoints Using Java’s Spring MVC

Using the Spring Initalizr at https://start.spring.io/, generating a skeleton project takes just a couple of seconds, and then you’ll just need to import it into your IDE. You will have your web app server running in just a couple of minutes.

The following code snippet defines a REST controller that creates your first web server endpoint.

1@RestController
2public class MyFirstController {
3
4 @RequestMapping("/greeting")
5 public String helloWorld() {
6 return "Hello";
7 }
8}
9

The following code snippet defines a web controller and serves the ‘greeting’ view, after rendering it using the Thymeleaf engine on the server side.

1@Controller
2public class MySecondController {
3
4 @GetMapping("/hi")
5 public String greeting(@RequestParam(name="name", required=true, defaultValue="you") String name, Model model) {
6 model.addAttribute("name", name);
7 return "greeting";
8 }
9}
10

Let’s See How Ruby Does it Automatically

This is where Ruby shines. While the above Java sample project is light and easy to understand, the point is that Ruby will allow you to get much more done with pretty much the same effort. And this is what comparing time-to-market results is all about. Even though Rails might not be as easy to set up as Spring, once you do so and use its scaffolding mechanism, you’ll start seeing some real results. Running the following command will automatically generate simple models, views, and controllers, for a single table (entity), in a CRUD fashion:

1rails g scaffold helloApp greetingMessage:string
2

A Rich Java Framework/Library Ecosystem Can Sometimes Be a Disadvantage

One advantage that comes with choosing Java is the abundance of libraries and frameworks. The following two Wikipedia tables summarize this very well relating to web development:

The same is true for the object-relational mapping space for:

While having options is great, there’s an argument to be made that having too many options is a factor that can contribute to a slower time-to-market, depending on the context of the firm or team. Spending too much time on achieving consensus on what to use for what parts of the system, or attempting to bulletproof for the future by optimizing such choices are two common anti-patterns that can drive time-to-market up.

Additionally, when there are fewer options in an ecosystem, it is more likely that all developers in that ecosystem will know and use the same tools, which means faster onboarding for new team members who don’t need to learn new things for each different project. Despite this, many organizations may consider “too many options” to be a good problem to have.

The Java Hiring Perspective

Remote Work

If you’re looking to build a team on a fully-remote basis, the decision to use Java, Python or another language can be influenced by the fundamental supply and demand laws of the remote talent marketplace.

I’ll share data related to the actual programming language, rather than the specific framework used to carry out web development within that language. A Java developer with knowledge of Spring will probably find it easy to build a web app using DropWizard instead. Same for Django vs. Flask in the Python context.

There’s also the fact that each language is not only used for web development, which is less true for others. Applying both of these rules consistently to each language keeps our comparison as fair as possible, though.

Let’s look at remote job posts on Indeed.com in the United States:

Number of job ads with the keyword "remote" and job ads with the location remote for Java and Python in December 2022

The job posting data shows that there are plenty of companies looking to hire both Java and Python developers. When looking at things from the supply side, Scalable Path’s developer profile data shows an abundance of Java and Python developers. This helps us debunk the myth that the availability of Java developers is low (due to its enterprise reputation), making them a struggle to hire remotely. Together with the job posting data, it appears there is a supply and demand equilibrium, suggesting that this consideration shouldn’t play a strong role in your technology choice.

The Financial Perspective

The geographical area chosen for this analysis is the United States, due to the large availability of data. Python commands higher salaries in each of the sources, but not by a large margin. This means that the purely financial perspective shouldn’t influence which language is chosen for building a new web app, especially when considering the averages.

Job Role Glassdoor.com Avg. Role SalaryIndeed.com Avg. Role SalaryPayScale Avg. Skill SalarySalary.com Avg. Role SalaryAverage
of Average Salaries
Java Developer$88,116$103,368$89,000$92,424$93,227
Python Developer$86,056$117,883$90,000$89,802$93,227

Popularity of Languages

Python is the fastest-growing programming language today. At the time of writing this article, the PYPL ranking places Python on its first position and Java second.

Comparatively, the TIOBE index places Python first and Java fourth with a year-on-year decline. A couple of conclusions can be drawn from this:

The Enterprise Cultural Perspective

Given the analysis carried out in the ‘Technical Perspective’ section above, it is clear how Java is a strong choice from a technical point of view for large enterprises. Think about the Twitter case study: the large enterprises are where Twitter is today. They use systems that must be able to scale their performance as needed in order to serve large business needs.

There’s also the fact that such systems typically involve a very large codebase, and Java is better at encapsulation, which makes it easier for large teams of developers to collaborate on such big systems.

This doesn’t mean that large enterprises shouldn’t use dynamic languages for some of their needs, such as prototyping new business ideas, or perhaps for smaller internal applications. There are a couple of things that prevent this though, and they’re not technical:

In Conclusion: Should you Choose Java for Your Next Project?

Through our analysis, we can see that Java remains relevant in the modern world of web development. From a technical point of view, Java outperforms Python in benchmarks and is architecturally more inclined towards parallelism, multithreading in particular.

If your goal is to build web applications that are naturally reliable and scalable, then you should strongly consider using Java. Java has been shown to be just as active as Python for remote work, exhibiting an equivalent talent supply and demand. Finally, from a financial perspective, Java’s salaries are in line with all of its dynamic language competitors.

Ultimately, Java isn’t going anywhere anytime soon. In some sectors such as enterprise finance, Java remains the most predominantly used language. We’ve also seen that tech companies such as Twitter have moved away from dynamic languages to Java in order to take advantage of its natural ability to scale and to support resource-intensive applications. Bearing this in mind, Java’s continued relevance is clear, maintaining its position as a strong choice for web development.

Originally published on Sep 1, 2021Last updated on Feb 3, 2023

Key Takeaways

Is Java still used today?

Java is still used today and remains relevant in the modern world of web development. Moreover, Java is still the most heavily used language in the financial enterprise world. This includes banking institutions, insurers, stock markets, and other types of financial firms.

Is it worth learning Java in 2023?

If your goal is to build web applications that are naturally reliable and scalable, Java is a good choice. From a technical point of view, Java outperforms Python and Ruby in benchmarks and is architecturally more inclined towards parallelism, and multithreading in particular.

Are Java developers in demand in 2023?

Java has been shown to be just as active as Python for remote work, exhibiting an equivalent talent supply and demand. Also, from a financial perspective, Java’s salaries are in line with all of its dynamic language competitors.

Looking to hire?

Join our newsletter

Join thousands of subscribers already getting our original articles about software design and development. You will not receive any spam, just great content once a month.

 

Read Next

Browse Our Blog