How to Build Java Applications Today #72
TL;DR
Java had patch releases, we can now write command-line interfaces with Java, and this book will save IntelliJ users tons of time.
README
Welcome to the February 2023 issue of my newsletter “How To Build Java Applications Today”! If you like it, then subscribe to it for free on Substack! Or read it on dev.to or Medium. Even better: Share it with people who are interested!
What’s This?
In my monthly “Java Full-Stack Report”, I recommend IDEs, build tools, JVM languages, databases, back-end frameworks, web frameworks, and mobile app frameworks. I also cover essential releases and news.
This report is different because it measures popularity by observing what all Java developers do: job ads from 59 countries, online training students, Stack Overflow questions, and Google searches. My recommendations are based on that popularity, industry analysis, and my 24 years of Java experience.
Why popularity? Because picking a popular technology makes our developer life easier: easier to learn, easier to build, debug & deploy, easier to find jobs/hire, and easier to convince teammates & bosses. Now popularity can make a difference in two situations: When multiple technologies score similarly, we could go for the most popular one. And when a technology is very unpopular, we may not use it.
Stand-Up
I told you that I started a new Java contract on January 3. Two sprints in, I can share that I’m working with some technologies I haven’t touched before. Namely Spring Boot 3, Kubernetes, MongoDB, and React. After many years, I also work with Maven again — and realize I still like Gradle a lot better.
My first conference talk of the year is at Germany’s biggest Java conference, JavaLand. It’s about when native Java with GraalVM is worth it. As it seems to have become a tradition, I first give my conference talk to the London Java Community (LJC). I was already booked for a regular online talk in early March when suddenly, a slot opened up at LJC Live on February 16. That’s a monthly on-site event with two speakers. And I’m now one of them! This cuts my preparation time a bit short. But who says that deadline pressure is wrong?! 😅 So if you’re in London on February 16, I’d love to see you at LJC Live!
Last year, I talked about Google’s Flutter at QCon London and then at QCon Plus. The QCon Plus talk was prerecorded. I edited it myself, so it’s quite polished, if I may say so. 😏 And that talk is now public on InfoQ — as a video and text transcript. So if you want to know about Flutter, view or read for yourself!
Technology Index (Last Update: January 2023)
IDEs
- Popularity trend: Eclipse is the most popular Java IDE and leads IntelliJ in job ads 2.5:1, though it has declined over many years in other categories. IntelliJ holds up well for a commercial product: It’s only slightly behind Eclipse in Google searches and slightly ahead in questions at Stack Overflow. NetBeans is the least popular IDE. VS Code isn’t a fully-fledged Java IDE, but apart from jobs, it’s 3–4 times as popular as Eclipse & IntelliJ.
- If you don’t want to spend money, then use Eclipse.
- If you may spend money, evaluate IntelliJ.
- Evaluate VS Code for non-Java work, like web development (I use it for all my websites).
- If you’re using NetBeans, consider moving off of it.
Build Tools
- Popularity trend: Maven is 2.5 times as popular as Gradle, except for Stack Overflow, where Gradle is slightly ahead. Ant and sbt have declined for years.
- If you use Scala, then use sbt.
- Otherwise, if you absolutely cannot stand XML files and/or need to customize your build heavily, then use Gradle.
- Otherwise, use Maven.
JVM Languages
- Popularity trend: Java is #1, Kotlin #2, and Scala #3. Java probably wins in job ad mentions where Scala also leads Kotlin. But Kotlin leads Scala in all other categories. Groovy and Clojure have mostly declined for many years. Python and JavaScript beat Java everywhere, but the job ad mentions rankings are unknown.
- On your current project, keep your existing language unless that language is absolutely, really not working out for you.
- If you need to switch languages or are on a new project:
- Use Scala if you need functional programming.
- Use Kotlin if you really need a “more modern Java”.
- Otherwise, use the latest Java LTS version you, your team, and your application can take.
Databases
- Popularity trend: MySQL is #1, Postgres #2, and MongoDB is #3. After some turbulence, MySQL and MongoDB are back to their October 2021 values: MySQL leads Postgres 1.4:1, MongoDB has 70% of Postgres’ numbers. Postgres and MongoDB are nearly at peak values at Stack Overflow.
- On your current project, keep your existing database unless that database is absolutely, irrevocably, really not working out for you.
- If you need to switch databases or are on a new project:
- If you know that you’ll need the NoSQL features and/or scalability, and you can’t get this with MySQL, then use MongoDB.
- Otherwise, use MySQL.
Back-End Frameworks
- Popularity trend: Spring Boot dominates and still grows in all categories except for Google searches. Despite a long decline, Jakarta EE leads Quarkus in all categories but questions at Stack Overflow. Quarkus is now #3 in job ad mentions, Micronaut is the new #4.
- On your current project, keep your existing back-end framework unless that framework is absolutely, really not working out for you.
- If you need to switch back-end frameworks or are on a new project:
- Use Quarkus if you need the smallest possible, fastest-starting Java application now.
- Otherwise, use Spring Boot.
Web Frameworks
- Popularity trend: React is #1, Angular #2, and Vue #3. React leads Angular by only 15% in job ad mentions but by 1.5–3.6 in the other categories. Vue has only 30% of Angular’s job ad mentions but about 40–60% in the other categories.
- If you already use React, Angular, or Vue in your project, then keep using them. Otherwise, evaluate a migration. In many (most?) cases, such migration doesn’t make business sense.
- If you start a new project or migrate, then start with React first, Angular otherwise, and finally, Vue.
Mobile App Frameworks
- Popularity trend: React Native dropped from a 2.9:1 lead over Flutter to a 1.9:1 since last April. Among developers, Flutter leads React Native 2:1 and pulls away (except for Google searches, where both slightly lost in 2022). Xamarin and JavaFX have generally declined for years.
- Don’t build two separate applications with Apple’s and Google’s first-party frameworks. Use a cross-platform framework instead.
- If you start a new project and have used React for building web applications, then use React Native.
- If you start a new project and have .NET experience, then use .NET MAUI.
- If you start a new project and need to use a library that’s only available in Java, then use JavaFX.
- Otherwise, start with Flutter first and use React Native if that doesn’t work out for you.
Release Radar
Java had patch releases, while only Quarkus had a major release. Git, IntelliJ, VS Code, Spring Boot, Quarkus, Micronaut, and Helidon also had minor releases.
New & Noteworthy
We Can Now Write Command-Line Interfaces with Java
Command-line interfaces (CLI) need to start quickly and not use much memory. Sot that ruled out writing them in Java for most of us: Sure, Maven and Gradle start fast. But they’ve been tuned for years and don’t use the frameworks we want to use, like Spring Boot.
Until now, that is: Native Java with GraalVM makes it possible to write CLIs in Java!
just
is an example of such a CLI. It doesn’t matter to us that it’s a Spring Boot tool. What matters is that it’s a Spring Boot application starts in less than one second. On my M1 Max MacBook Pro, the application launches, displays the help screen, and quits again in 0.8 seconds:
% time just --help
██╗██╗ ██╗███████╗████████╗
██║██║ ██║██╔════╝╚══██╔══╝
██║██║ ██║███████╗ ██║
██ ██║██║ ██║╚════██║ ██║
╚█████╔╝╚██████╔╝███████║ ██║
╚════╝ ╚═════╝ ╚══════╝ ╚═╝Unknown option: '--help'
Usage: just [-V] [COMMAND]
-V, --version Print Just version
Commands:
run runs Spring Boot project - either with Maven or Gradle in dev mode
with hot reloading enabled
help Display help information about the specified command.
format formats code with Spotless
init initializes Just related files
build builds application
kill kills process running on port
just --help 0.80s user 0.07s system 97% cpu 0.897 total
%
So if you wanted to write a CLI in Java but didn’t: Now’s the time! Just pick a Java framework that supports native Java, like Spring Boot 3, Quarkus, or Micronaut. And build it as a native executable with GraalVM.
To the Quarkus and Micronaut fans among my readers: I know you guys could build fast CLIs for years. But I hope we can all agree that Spring Boot 3 made native Java more mainstream. 😀 Hence, this news item appears now.
This Book Will Save IntelliJ Users Tons of Time
If you are an IntelliJ user, this book will save you a lot of time! Trisha Gee, the former lead developer advocate at JetBrains, and Helen Scott, the current lead developer advocate at JetBrains, wrote it together. Trisha covers the advanced users, while Helen dishes out tips for beginners.
So, how will this book make you faster? By focusing on three areas:
- Keyboard First
- Always Green
- Staying in the Flow
The book is on Leanpub and costs 30 dollars. Saving dozens, if not hundreds of hours in the future, this book is a no-brainer for IntelliJ users!
Interested? Then read the interview with Trish & Helen.
Better Debugging with Kotlin 1.8
I know, this is a Java newsletter. But what’s wrong with occasionally looking at the other side of the fence and seeing if it’s really greener? Which brings me to Kotlin 1.8, the latest release of the #2 language on the JVM. And this time, the grass is brown & muddy.
Why such harsh words? Well, let’s look at the list of new features:
- Better debugging by removing optimizations that mess with the debugging experience
- Built-in function for recursively copying and deleting directories
- Faster reflections
- Support for writing Gradle tasks with Kotlin for Gradle 7.2 (released August 17, 2021) and 7.3 (released November 9, 2021).
Does this grass look green to you? And the support for Gradle 7.2 and 7.3 is especially baffling to me: What took so long? These releases are more than a year old! And how do I write Gradle tasks with Kotlin in the current Gradle release, 7.6?
Kotlin 1.8 has more changes, but they don’t concern us Java developers (like improved interoperability with Apple’s Objective-C & Swift).
Next Issue
The next issue will arrive on Wednesday, March 1, 2023. Subscribe to this newsletter on Substack for free to receive the next issue automatically!
About
Karsten Silz is the author of this newsletter. He is a full-stack Java developer (Spring Boot, Angular, Flutter) with 24 years of Java experience. Karsten has worked in Europe and the US and is also an author and speaker. He got a Master’s degree in Computer Science at the Dresden University of Technology (Germany) in 1996.
Karsten co-founded a software start-up in the US in 2004. He led product development for 13 years and left after the company was sold successfully. Karsten then co-founded the UK SaaS start-up “Your Home in Good Hands” as CTO in 2020. Since 2003, he has also worked as a contractor.
Karsten has this newsletter, a developer website, and a contractor site. He’s on LinkedIn, Twitter, Xing, and GitHub. Karsten is also a Java editor at InfoQ.