Why Java is so hot right now
The Java platform has become one of the most widely used platforms, with a huge ecosystem in the world of technology. Java lets developers create applications for several platforms, such as Windows, Linux, embedded systems, and mobile.
Java also has received criticisms, such as: Java is fat; Java takes a lot of memory; Java is verbose. But, Java was created to solve big problems, not small problems. Of course, you can also solve small problems with Java, but you see the real benefit of Java when you have a big problem, especially when creating solutions for enterprise environments. In this article, we’ll take a closer look at the current Java ecosystem.
Java is great for enterprise environments because of its power to solve complex problems and its multi-platform characteristics, but also because it promotes more security to business promoting backward compatibility and offers solutions based on specifications.
Java has a big ecosystem, with emphasis on Java EE (now Jakarta EE) that promotes several specifications to solve common problems in the enterprise environment. Some of these specifications are: EJB, JPA, JMS, JAX-RS, JAX-WS, and others. Furthermore, we have the Spring ecosystem, although it is not based on specifications but uses some specifications from Java EE.
Cloud computing and microservices
The cloud computing concept has changed how developers architect, write, and think about applications. Cloud computing is a set of principles and approaches that aims to provide computing resources as a service (PaaS, IaaS, SaaS). With this, we use only those resources that are necessary to run applications and scale when needed. This way, we can optimize computing resources and consequently optimize costs to business. It is fantastic, but to benefit from cloud computing, applications should be developed according to this approach. With this, the microservices architecture came about as a good approach to architect applications for cloud computing (cloud-native applications).
Microservices architecture breaks a big application (monolith) into many micro-applications or microservices, generally in the business domain. With this, we can scale only the business domains we really need without scaling all of them, thereby gaining fault tolerance as well as resilience. Additionally, microservices architecture lets us explore cloud computing benefits and optimize computing resources.
Java and cloud computing
In a cloud-native application approach, the complexity is not in the applications but in the communication between these applications, as well as management and monitoring. In other words, the complexity is about how these applications (microservices) interact with each other and how quickly we can identify problems. With this, the Java platform and its ecosystem have many gaps to solve, which will be discussed below:
- Fat JVM: Many Java applications start with libraries that are not used, and the JVM will load things that the application doesn’t need. This is okay when you have a big application that solves complex problems, but is not so good for small applications (like microservices).
- JVM JIT optimization: The JVM has JIT optimization that optimizes applications running a long time. In other words, the longer the application life cycle, the more optimization is done. That means it’s better to run an application for a long time than for a short time. In cloud computing, however, applications are born and die all the time and their life cycle is shorter.
- Longer boot time: Many Java applications have a long boot time compared to applications written in another language because these applications commonly solve other things at boot time.
- Fat packages (war, ear, jar): Many Java apps have a large package size, mainly when they have libraries inside them (in lib folder). This can increase the delivery time, degrading the delivery process.
- Java EE has no pattern solutions to microservices: The Java EE has many important specifications to solve enterprise problems, but it has no specs to solve problems that came from microservice architecture and cloud computing.
- Java and Java EE updates are slow: Java and Java EE have slow processes for updating features and creating new features. This is bad because the enterprise environment is in continuous change with new challenges all the time.
With this, the Java ecosystem had several changes and initiatives to solve each gap created by cloud computing and put Java on top again.
The Java platform is a robust platform that promotes many solutions, but to me, the best part of the Java world is the community, which is very strong and hard-working. The Java community has promoted many actions and initiatives that have boosted the Java platform and promoted solutions to bring Java closer to a cloud-native application approach, which many people refer to as cloud-native Java.
The main actions and initiatives done in the Java ecosystem include: Jakarta EE, Microprofile, new Java release cycle, Java language improvements, JVM improvements, and Quarkus. I’ll explain how these initiatives have impacted the Java ecosystem.
- Jakarta EE: Java EE was one of the most import projects at Java ecosystem. Java EE promoted many pattern solutions to enterprise problems, but this project was migrated from Oracle to Eclipse Foundation and had many changes in the work’s structure. The project is now called Jakarta EE; it’s an umbrella project that promotes pattern solutions (specifications) for the enterprise world and has a new process to approve new features and evolve existing features. Thus, Jakarta EE can evolve quickly and improve more enterprise solutions.
- MicroProfile: As mentioned above, Jakarta EE has many good solutions for the enterprise world, but it does not have pattern solutions to many problems in a microservices architecture. MicroProfile is an umbrella project that promotes many pattern solutions (specifications) for microservices architecture problems. This project has compatibility with Java EE and lets developers more easily create applications using microservices architecture. Some of these specifications are: MicroProfile Config, MicroProfile OpenTracing, MicroProfile RestClient, Microprofile Fault Tolerance, etc.
- Java release cycle: The Java release cycle changed, and now Java releases occur every six months. It’s an excellent change, because it permits the Java platform to respond quickly to new challenges and promotes a faster evolution of the Java platform.
- Improvements in Java language: The Java language has seen several improvements, such as the functional feature, as well as the Jigsaw project, which introduced modularity. With this, we can create thinner Java applications that can easily be scaled.
- Improvements in JVM: The JVM had some issues when used in containers, mainly about measurements of memory and CPU. This was bad because the container is very important to cloud computing. With containers, you don’t deliver just the application, but the entire environment with all its dependencies. Since Java 9, the JVM has seen many updates that made communication with containers better. With this, the JVM is closer to cloud computing necessities.
- Quarkus: Quarkus is the latest news in the Java ecosystem and has been at the top of the talks. Quarkus is a project tailored to GraalVM and OpenJDK HotSpot that promotes a Kubernetes Java application stack that lets developers write applications using the best of breed Java libraries and standards. With Quarkus, we can write applications with faster boot time, incredibly low RSS memory, and an amazing set of tools. Quarkus is really an amazing project that defines a new future for the Java platform. This project works with a container-first concept and uses the technique of compile-time boot to boost Java applications.
All of these projects and initiatives in the Java ecosystem bring Java back into focus and start the new era for the Java platform. With this, Java enters the world of cloud computing, offering ways of working with specifications and promoting standardized solutions to cloud computing. These initiatives are amazing both for Java and for cloud computing, because from these standardized solutions will emerge new enterprise solutions that will have the support of many companies, thereby making adoption of these solutions even safer.