How to Build Java Applications Today: February 8, 2021
Java 16: what’s new, Netflix open-sources GraphQL framework for Spring Boot, getting started with VS Code for Java, Mozilla lets Rust go, and the state of Go.
Introduction
This is issue #22 of my weekly newsletter, “How To Build Java Applications Today”. The newsletter complements my site betterprojectsfaster.com.
Last week, I again spent most of my time on this new project. I hope I can tell you more in the spring!
Weekly Links
Java
Java 16: What’s New?
It’s just five more weeks before we get Java 16 on March 16 (nice date!). But as expected, Java 16 won’t change day-to-day Java development. We save some keystrokes (“if (thing instanceof Integer i && i.intValue() > 0“), and immutable classes are now easy (“public record Cat(String name, String breed) {}“). You know, what Lombok has done for years.
And that’s pretty much it. Yeah, the JDK now also runs on Alpine Linux and Windows 10 on ARM, starts up a little faster, can talk to other processes through Unix domain sockets, and has some more small changes. But none of that impacts us much. With two Java releases each year, there’s just not much stuff for us regular developers in each one. Still, we can grab the release candidate here.
Spring Boot
Netflix Open-Sources GraphQL Framework for Spring Boot
GraphQL is an increasingly popular alternative to JSON. Why? Because a built-in schema makes it more type-safe, unlike the “Anything goes” approach that JSON takes. And we can request as much or as little data as we want through queries, unlike JSON’s “One size fits all” way. That’s what made GraphQL also popular at Netflix.
And now, Netflix open-sources its internal framework called Domain Graph Service (DGS). We get code generation from a GraphQL schema, Spring Boot annotations, integration with Spring Security and GraphQL Federation, file uploads, unit tests, error handling, a GraphQL client for Java, and more. It seems like this is the best way to start with GraphQL in Spring Boot now!
Tools
Getting Started with VS Code for Java
IntelliJ is the undisputed champion of Java IDEs, sitting at 62% last year and rising. That’s the market share Eclipse had in 2012 before it started its nosedive (now at 20%, sinking fast). Good ol’ Netbeans only dropped from 15% to 10% during that period. Be still, my beating heart: In two or three years, Netbeans may finally beat Eclipse! Of course, it would be by shrinking slower, but that’s just nitpicky! 😆
Now if your heart goes out to a true underdog in this race, then look no further: Microsoft’s Visual Studio Code, used for Java development, sitting at a 2% market share. 20 years ago, I would have completed the sentence “Microsoft has a 2% market share in…” with “…applications with a good user interface”. How the times have changed! Microsoft even has more usable applications now, though Windows 10 is still a design mess.
Over the Fence
Mozilla lets Rust Go
Rust is “a better C++” for small & fast system-level software: Safer code, close to the metal, easy concurrency, and no garbage collector disruptions. That’s why the Linkerd service mesh for Kubernetes is just 10 MB in size! Mozilla (of Firefox fame) created Rust.
But now, the newly-founded Rust Foundation will steer the language. Apart from Mozilla, companies like Amazon, Google, Microsoft, and Huawei are members there. Given that Mozilla, sadly, had substantial layoffs in January and August last year, this can only be a good thing.
The State of Go
Talking about “Go”: That’s also the name of Google’s “C++ killers”. “Mozilla lets Rust Go” - see what I did there? 😇 Anyhow, like Rust, Go compiles to native code. Unlike Rust, Go has garbage collection but no error handling. It’s still plenty fast for many areas, so Docker and Kubernetes are written in it.
So what’s going on over there? Go claims 1,1 million professional developers who use it as their primary language. That’s a quarter of the more than 4 million Java developers. More than half of all Go developers are in Asia, 22% in Europe, and 16% in North America. Go is a plumbing service language: Places 2-7 on the list of software developed with Go are utilities, IT infrastructure, libraries/frameworks, system software, database/data storage, and programming tools.
Now GraalVM won’t win these folks back, but maybe it can slow the bleeding?