Language selector

Java

When I have time to talk about Java for more than one hour, it’s a Deep Dive (I call it “What’s new and noteworthy?”) When I have less than forty minutes, we can barely touch the surface, hence it’s called then “Surfing Modern Java”. Anything in between, like regular-size talk, is more than surfing, but less than deep dive, hence “Sailing Modern Java”.

For such a talk I usually cover one or two latest releases, sometimes mentioning what’s ahead of us, trying to sneak in as many code demos as I can.

Let’s be honest: we’ve been waiting for the Virtual Threads quite some time. We’ve been waiting eagerly, we’ve seen names changing (they’re not fibers folks), but here there finally are: Virtual Threads.

Some say the Project Loom is the biggest change Java has seen since version 8, lambdas, and streams. Some say it’s even bigger than that. Discussion aside, they are a huge change, it seems.

I remember how we were excited (I was still at the university back then), that we could finally use some real Threads in Java on Windows. Yet time flies by, the industry has changed, the hardware has changed, the way we build our systems has changed too. While we found ways to bypass the limitations of “one OS thread per one Java thread”, it came with some price: convoluted stack traces and difficult debugging are the first ones that come to mind. Virtual Threads are about to keep us in the boooring, yet easy to grasp thread-per-request model, while unblocking the silicon power down below.

Hey, there are two major Java versions released every year! We don’t have to wait 3 years or so for new features anymore. Isn’t that cool? 😉

Java was supposed “to be slow”. However, Java turns out to evolve so fast, that next releases aren’t just version bumps, but might significantly change the rules of the game. That’s a good reason to check out what’s new in Java.

To name a few changes:

“You can never understand one language until you understand at least two.” – Geoffrey Willans

For years, I’ve been developing mostly in JVM languages. Sometimes in other C-derived languages, which was both cool and easy.

A few months ago (due to a career shift) I had to learn Go rapidly. While technically Go has keywords looking similar to C, many things are simply different and even unheard of in C-based OOP languages. Learning Go is a great journey and the best are these AH-HA moments, when doing things in Go I suddenly understood Java better.

Modern Java is really awesome when it comes to “Hello, World!” demos. It’s also cool for a sophisticated systems and algorithms, provided their authors write code which obeys a few fairly simple contracts and avoids obvious traps.

There are a few mantras regarding recent features of modern Java, such as:

  • records can replace JavaBeans everywhere
  • you never need to write hashCode() for records
  • pattern matching with instanceof is the best tool for equals()
  • just ignore --illegal-access and set it to permit
  • synchronize (new Long(42)) is the best for monitoring and so on.

This talk has been given at jLove, Doing Java Better and Java Day Lviv.

Another (half a) year has passed, another major Java™ version has been released. Java was supposed “to be slow”. However, Java turns out to evolve so fast, that next releases aren’t just version bumps, but might significantly change the rules of the game. That’s a good reason to check out what’s new in Java. We’re going to cover:

  • Records, where and how to use them, apart from DTO/VO
  • Pattern matching with instanceof A.K.A. Smart casting
  • Sealed classes, new dimension of types extensibility (for inheritance)
  • Warnings from Jigsaw (–illegal-access strikes back!)
  • And Valhalla (for value-based classes abuse)
  • Talking to native stuff from Panama
  • and more.

All visualised in actual code, not just slides.

What do I think about Lombok?

I think it’s a nice island, and I wish to visit it one day.

What do I think about Project Lombok?

Well, I’ve been asked this question so many times, I’ve decided to write this post. Its main purpose is to be able to paste the link and back up, because the (yet another) discussion might be so intensive, that fists will be shaken and heads will roll… There are three assumptions here:

Another (half a) year has passed, another major Java™ version has been released. Java was supposed “to be slow”. However, Java turns out to evolve so fast, that next releases aren’t just version bumps, but might significantly change the rules of the game. That’s a good reason to check out what’s new in Java. We’re going to cover:

  • Records, where and how to use them, apart from DTO/VO
  • Pattern matching with instanceof A.K.A. Smart casting
  • Sealed classes, new dimension of types extensibility (for inheritance)
  • Warnings from Jigsaw (–illegal-access strikes back!)
  • And Valhalla (for value-based classes abuse)
  • Talking to native stuff from Panama
  • and more.

All visualised in actual code, not just slides.

I had a great pleasure to take part in the JAVIPS online 2020.

In the dark ages, we had to wait for 3-4 years to see the new Java version with some new features. Now there are two major releases every year! Can we benefit from the new features before the next LTS release?

We don’t have to wait 3 years or so for new features any more. Isn’t that cool? 😉 So… you’d like to check what has happened since Java 11? Record types? Switch expressions? Pattern matching? No more NPE? String blocks? New functions in APIs? What are the Shenandoah and ZGC about? AppCDS to speed up spin-off?