How to Build Java Applications Today: April 26, 2021
Tags: java, bpf
Published: 2021-04-26 21:56:14

## TLDR
Kubernetes & Service Mesh fundamentals, PostgreSQL as an OLAP database, collaborative programming in IntelliJ, Google’s new programming language Logica, Gradle 7.0, and GraalVM 21.1.

***

## README
This is **issue 33** of my weekly newsletter, “How To Build Java Applications Today”. I read all the Java newsletters, so **you** don’t have to! And I try to entertain you a bit while presenting Java news.

If you like my newsletter, then [subscribe to it on Substack](https://bpfnl.substack.com)!

***

## Quote of the Week
*It is not because things are difficult that we do not dare, it is because we do not dare that they are difficult.‌*
[Seneca](https://www.brainyquote.com/quotes/lucius_annaeus_seneca_107581), Roman Stoic philosopher ([4 BCE - 64 CE](https://en.wikipedia.org/wiki/Seneca_the_Younger)), obviously never tried to set up a Kubernetes cluster.

***

## Stand-Up
This week was primarily devoted to my start-up, “[Your Home in Good Hands](https://yourhomeingoodhands.co.uk)”. The mobile app that I’ve worked on for six months is now used in pilot mode. It holds up well so far! The number of users will expand a lot in May. So I got my work cut out for me! 😅 

And my third InfoQ news article [got published](https://www.infoq.com/news/2021/04/java-osgi-eclipse/). It’s about the OSGi Working Group (WG; previously named “OSGi Alliance”). After shipping the OSGi Core Release 8 in December, the OSGi WG is now incubating at the Eclipse Foundation. Talking about a dry topic!

***

## Code Review
### Issue 32 from April 19, 2021
[Last week’s issue](https://bpfnl.substack.com/p/how-to-build-java-applications-today-894) had just one embarrassing mistake: It said “Spring Spring Boot” in the summary section that got mailed. That’s one less mistake there than issue 31. Yay, progress! 

***

## Bookmarks
### Frameworks & Services
#### Kubernetes & Service Mesh Fundamentals
Organizations and cloud vendors quickly standardize on Kubernetes to deploy software. Sooner or later, we Java developers will run Kubernetes on our machines. So what’s Kubernetes, and how can we run it?

An excellent pair of podcasts from [Software Engineering Radio](https://www.se-radio.net) answers these questions. Here’s my explanation of Kubernetes: We describe in Yaml what we want - like 3 Spring Boot containers, five microservice containers, and two database containers. Kubernetes then makes this happen: It runs the containers in so-called pods (typically one pod per container). If a pod fails, then Kubernetes creates a new one.

Things get interesting with [so-called sidecars](https://www.magalix.com/blog/the-sidecar-pattern): These containers run alongside our own containers inside a pod. Why? To add cross-cutting concerns, like logging or access controls, to our applications.

Service Meshes take the sidecar idea to the next level. They help our Spring Boot pods find the right database pods (service discovery) and further improve health monitoring, security, and other aspects.

Now here’s the big “But”: Kubernetes is complicated to set up. So only invite this complexity into your world if you can really benefit from it! Fortunately, everybody and their dog are working on [abstraction layers on top of Kubernetes](https://cloud.google.com/blog/products/containers-kubernetes/introducing-gke-autopilot). Hopefully, you can use one such abstraction when the time comes for you! 

Did you know that the best way to [run Kubernetes these days](https://andrewlock.net/running-kubernetes-and-the-dashboard-with-docker-desktop/) is [Docker Desktop](https://docs.docker.com/desktop/)? And that you can [run Docker Desktop in Windows 10](https://andrewlock.net/installing-docker-desktop-for-windows/) now on Windows 10 Home? Though in typical Microsoft fashion, it’s a complicated installation process. 😉

[Kubernetes podcast episode](https://www.se-radio.net/2021/02/episode-446-nigel-poulton-on-kubernetes-fundamentals), [Service Mesh podcast episode](https://www.se-radio.net/2021/03/episode-451-luke-kysow-on-service-mesh)

***

#### PostgreSQL as an OLAP Database
If our Java programs run in a big organization, chances are that their data is stored twice: In a relational database/NoSQL datastore **and** in a data warehouse. That adds complexity & cost. What if we could do away with the data warehouse and just store all data in one place?

That’s exactly what PostgreSQL proposes: Being both a transactional software back-end ([On-line Transaction Processing - OLTP](https://en.wikipedia.org/wiki/Online_transaction_processing)) and a data warehouse ([On-line Analytical Processing - OLAP](https://en.wikipedia.org/wiki/Online_analytical_processing)). Well, how hard can it be? Very hard, as it turns out: OLTP databases access data in rows, OLAP often in columns. So PostgreSQL needs to add column access to the rows.

Here’s where [Swarm64](https://swarm64.com) comes in: That company use PostgreSQL’s ability to execute [parts of database queries in parallel](https://swarm64.com/post/increase-postgresql-parallelism/) to implement OLAP. The podcast gives you the details!

Even if you don’t use PostgreSQL for OLAP, it’s well worth a look anyhow. For 13 years, I lead a software product that ran on MySQL (it probably still does). But I’m pleased with PostgreSQL as my “new database”: Small, fast, advanced, and extensible.

[PostgresSQL podcast episode](https://www.se-radio.net/2021/04/episode-454-thomas-richter-on-postgres-as-an-olap-database/)

***

### Tools
#### Code With Me: Shared Programming in IntelliJ IDEA
After [giving us out the early access version](https://betterprojectsfaster.com/blog/weekly-links-2020-10-08#intellij-gets-official-remote-pair-programming-pluginhttpsblogjetbrainscomblog20200928code-with-me-eap) half a year ago, JetBrains now released its collaborative programming service [Code With Me](https://www.jetbrains.com/code-with-me/) to the public. What can it do, and how much does it cost?

A host with a JetBrains IDE, such as IntelliJ IDEA, can share their code with up to 50 guests through Code With Me. Guests don’t need a JetBrains IDE; they download a small program instead. They can then edit and run the code that remains on the hosts’ computer. That’s useful for pair programming, code reviews, training, workshops, and probably many more scenarios.

Sounds great, so what does it cost? The Community Plan is free and gives us 30-minute sessions with up to three guests. The premium plan has no session time restriction and allows for up to 50 guests. It starts at $5/month for individuals. But at least for now, developers with an active JetBrains IDE subscription (such as IntelliJ IDEA Ultimate) get the premium plan for free.  Sweet!

[Release announcement](https://blog.jetbrains.com/blog/2021/04/12/code-with-me-reaches-public-release/), [YouTube demo](https://www.youtube.com/watch?v=Lq0fCMCK-Yw)

***

### Over The Fence
#### Google’s new Programming Language Logica
Another week, another programming language by Google: “Logica” is the name this time. It’s a SQL successor that is “more concise and supports the clean and reusable abstraction mechanisms that SQL lacks”. Logica compiles into SQL, so it uses the same approach as [Sass](https://sass-lang.com/guide) or [Typescript](https://www.typescriptlang.org).

Now I’m not convinced by the examples that [Google’s announcement contained](https://opensource.googleblog.com/2021/04/logica-organizing-your-data-queries.html). For instance, here’s a SQL query they want to replace: 

`SELECT comment_text FROM comments WHERE user_id = 5;` 

Logica replaces it with this:

`MagicComment(comment_text:) :-
 `comments`(user_id:, comment_text:),
 MagicNumber(x: user_id);` 
 
 That’s not even complete - we need to define these magic numbers, such as: `MagicNumber(x: 2);`
 
 Maybe I’m just not smart enough to understand and see the benefits here. But I guess I’m really just too old, having written SQL for 30 years…
 
 If Logica is your cup of tea, then [Google’s tutorial](https://colab.research.google.com/github/EvgSkv/logica/blob/main/tutorial/Logica_tutorial.ipynb) is the spoon you need! Ouch - that sounded better in my head.

[Release announcement](https://opensource.googleblog.com/2021/04/logica-organizing-your-data-queries.html)

***

### Releases
#### Gradle 7.0
Whenever a new major version of Gradle is released, developers all over the world hold their collective breath and ask: How will my build break this time? Based on my use of Gradle 7.0 with a Spring Boot 2.4 project, I can say: Surprisingly little! How did they manage to do that?

By kicking the can down the road: Gradle 6.x warned me that “deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.”. Gradle 7.0 also warns but now says my build will be incompatible with Gradle **8.0**. 

What else is new, apart from breaking fewer builds?

Gradle 7.0 fully supports JDK 16, has faster incremental builds, and runs natively on [Apple’s M1 Macs](https://www.theverge.com/2021/4/20/22394034/apple-new-imac-m1-chip-colors-design-specs-price-release-date). And from the “too little, too late” department: Gradle now supports the [Java Module System](http://openjdk.java.net/projects/jigsaw/). You know, that part of Java that was to revolutionize how we write Java code but ended up as a JDK implementation detail instead? 

Anyhow, Gradle 7.0 does seem to compile my Spring Boot application faster. And it didn’t break anything for me - so I’m a happy camper!

[Release notes](https://docs.gradle.org/7.0/release-notes.html), [InfoQ article](https://www.infoq.com/news/2021/04/gradle-releases-version-7/)

#### GraalVM 21.1
Talking about the nail in the coffin of the Java Module System: GraalVM has a new release. Unlike Gradle 7.0, the JDK 16 support in GraalVM 21.1 is just experimental. 

The other headline feature is “faster warmup”: [Multi-tier compilation](https://medium.com/graalvm/multi-tier-compilation-in-graalvm-5fbc65f92402) performs fewer optimizations initially so it can start faster. Because some optimizations now run later, we also get “later peak performance”. But you don’t find that term in the release notes!

If you need to worry about download sizes: The GraalVM downloads are now smaller because Node.js isn’t included in the base downloads anymore. 

[Release announcement](https://medium.com/graalvm/graalvm-21-1-96e18f6806bf)

***

## About
Karsten Silz is the author of this newsletter. He is a full-stack web & mobile developer with 22 years of Java experience, author, speaker, and entrepreneur. Karsten got a Master's degree in Computer Science at the Dresden University of Technology (Germany) in 1996.

Karsten has developed software in five European countries and the US. In 2004, he co-founded a software product start-up in the US. During power outages, the software protected TV, Internet, and phone services for 50 million North American cable TV households. Karsten led product development for 13 years and left after the company was sold successfully.  

Karsten has worked as a contractor since 2017. He co-founded the UK SaaS start-up "[Your Home in Good Hands](https://yourhomeingoodhands.co.uk/)" as CTO in 2020.

Karsten has [this newsletter](https://bpfnl.substack.com/), a [developer website](https://betterprojectsfaster.com/), and a [contractor site](https://ksilz.com/). He's on [LinkedIn](https://www.linkedin.com/in/ksilz/), [Twitter](https://twitter.com/karsilz), and [GitHub](https://github.com/ksilz).