How to Build Java Applications Today: July 19, 2021

TL;DR

JavaFX: 1 codebase for web, PC, and mobile, 9 tips for Oracle DB with JPA & Hibernate, JetBrains “State of Developer Ecosystem 2021”, Spring Framework 5.3.9 & 5.2.16, Quarkus 2.0.2, Hibernate ORM 5.3.21.Final, and Spring Data 2021.0.3 & 2020.0.11.

README

This is issue 45 of my weekly newsletter, “How To Build Java Applications Today”. I read all the Java newsletters, so you don’t have to! And it’s “Java news with a smile”.

If you like my newsletter, then subscribe to it on Substack! Or read it on dev.to, the Java Cafe, or Medium. Even better: Share it with people who may be interested.

Quote of the Week

Choose a job you love and you will never have to work a day of your life.
Confucius, a Chinese philosopher (551–479 BCE), hopefully describes most readers of my newsletter!

Stand-Up

When I was a kid, I knew it was summer when it got warm, and the newspaper got thinner. I think the latter was because many journalists were on vacation. But maybe they were ordered to write less to save paper or what-not. I lived in East Germany, after all!

Well, it’s summer again: It’s hot, and this issue is a bit thinner because, frankly, not a lot is happening in the Java world right now. How hot? We just got the first-ever “extreme heat weather warning” here in England because “temperatures would continue to climb and could reach 33C (91.4F)”. For my American readers, this temperature probably just qualifies as a “warm Spring day”. But it’s never been so hot over here. And like the rest of Europe, our homes typically don’t have air conditioning!

Talking about hot stuff: I’m looking for a contractor project in October this year! Please see the first-ever advertisement in this little newsletter of mine below.

ADVERTISEMENT

FULL-STACK JAVA FOR 22 YEARS

I’m a full-stack Java developer with 22 years of experience, looking for a project in October 2021, in Milton Keynes, London, or remote. I’ll work as a contractor or fixed-term employee but don’t take permanent positions.

Interested? Then check out my resume & work samples!

Bookmarks

Java

JetBrains “State of Developer Ecosystem 2021”

The IntelliJ IDEA maker finds Java the third most popular language and the second most popular **main* one. Half of all Java developers plan to adopt/migrate to other languages. Java is most popular in the finance industry and Asia. Java 8 handily beats Java 11 in this report. And every second Kotlin developer already builds server-side applications.*

JRebel asked 876 Java developers for their “2021 Java Technology Report” (see issue #27). Snyk asked over 2,000 Java developers for their “JVM Ecosystems Report 2021” (see issue #41). But JetBrains, the maker of IntelliJ IDEA and other tools, blows those numbers away by asking nearly 32k developers and delivering roughly 10 times as much content! In a welcome move, they even documented the methodology used in the report.

So, what are the most relevant findings for us Java developers?

  • JavaScript is the most popular language ahead of Python and Java, which lost ground last year (Java more than Python). No consolation for “Team JVM”: Kotlin and Scala also lost last year. Now Java is still the number 2 main programming language, but just 10% ahead of Python.
  • Half of all Java developers plan to adopt/migrate to other languages: 13% of those want to move to Kotlin, 11% to Go, 8% to TypeScript and Python, 6% to Rust & Swift, 5% to JavaScript, and 17% to something else.
  • Java is most popular in Asia: South Korea (53%), China (47%), and India (38%). Java is least popular in Europe: Russia (18%), Ukraine (20%), France (21%), and my country of residence, the United Kingdom (22%). 😒
  • The finance industry remains a Java stronghold: 23% of all developers who use Kotlin as their main language develop for it, and 20% of all Java developers.
  • Java 8 is the king of the hill at 72%, with Java 11% behind at 42%. Fortunately, Java 12 & newer with 30% soundly beat Java 7 & older with just 8%.
  • Spring Boot & Spring MVC rule the web frameworks category with 65% and 42%. But Java/Jakarta EE is missing entirely from the results, so I think these numbers aren’t valid.
  • Surprisingly, 52% of all Kotlin developers already use Kotlin for server-side development, though Android development is still more popular at 63%. Only 38% use Kotlin for migrating old projects, and 91% of all Kotlin developers used Java before.

There’s more information on other programming languages, technologies, and more in this report.

JavaFX - One Codebase for Web, PC, and Mobile?

Java-based UI framework JavaFX now runs on the web in beta. But too few people use it, so pick Google’s Flutter or Facebook’s React Native instead.

We could already build UIs with JavaFX that run on the desktop and on mobile. Now Gluon added web browsers to the mix, using the low-level WebGL interface to “paint pixels”.

One Codebase for web, PC, and mobile, written in Java - sounds brilliant! So what’s the catch?

Too few developers use JavaFX compared to Google’s Flutter, Facebook’s React Native, or Microsoft’s Xamarin. And important trends point downward: Google searches have been down for 3 years, while questions on Stack Overflow have been down for 2.5 years. JavaFX has only 153k students on Udemy: React Native has more than 6 times as many and Flutter nearly 11 times as many. And for a conference talk last May, I counted job offers in 61 countries that mentioned these technologies: Flutter was mentioned more than 7 times as often as JavaFX, and React Native nearly 15 times as often.

So what do we Java developers use instead of JavaFX?

Now Flutter uses the programming language Dart. Oh my, why can’t we just use Java? Fortunately, Dart is “simplified Java, tuned for building UIs”. Not convinced? Look at the Dart code below - it nearly compiles in Java. Next week I’ll tell you which part doesn’t!

class MyClass extends AnotherClass {
  String myString;
  int myInt;
  List<String> myList = new List<String>();

  String sayHello(String name) {
    var feedback = "Hello, " + name; return feedback;
  }
}

Frameworks & Libraries

9 Tips for Oracle DB with JPA & Hibernate

Relational databases may not be our first choice for data stores these days. And in the age of open-source & microservices, a database that we have to pay for seems an unusual choice.

But if we find ourselves in the situation of using Oracle DB through JPA/Hibernate, then Vlad “High-Performance DB” Mihalcea has nine tips for us:

  • Configure the Buffer Pool and OS cache
  • Optimize for the execution plan cache
  • Enable the JDBC statement cache mechanism
  • Increase the default JDBC statement fetch size
  • Enable automatic JDBC batching
  • Prefer SEQUENCE over IDENTITY
  • Use the Hibernate @RowId when mapping JPA entities
  • Store non-structured data in JSON column types
  • Learn all supported SQL features

The article tells you why and how to do apply these.

Releases

Spring Framework 5.3.9 & 5.2.16

The “framework that’s inside Spring Boot” has two maintenance releases: 5.3.9 includes 45 fixes and improvements, while 5.2.16 has 12. The upcoming Spring Boot 2.5.3 and 2.4.9 releases will use Spring 5.3.9 (possibly landing at the end of this week already).

Quarkus 2.0.2

Hibernate ORM 5.3.21.Final

This small maintenance release contains 10 bug fixes, 1 improvement, and 11 tasks.

Spring Data 2021.0.3 & 2020.0.11

Both releases use Spring Framework 5.3.9 (see above). As usual with Spring Data releases, please see the announcement for the detailed changes in the 15 (2021.0.3) and 16 (2020.0.11) sub-projects.

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 marathon runner. Karsten got a Master's degree in Computer Science at the Dresden University of Technology (Germany) in 1996.

Karsten has worked in Europe and the US. He co-founded a software start-up in the US in 2004. Karsten led product development for 13 years and left after the company was sold successfully. He co-founded the UK SaaS start-up "Your Home in Good Hands" as CTO in 2020. Since 2019, Karsten also works as a contractor in the UK.

Karsten has this newsletter, a developer website, and a contractor site. He's on LinkedInTwitter, and GitHub. Karsten is also an author at InfoQ.

27