Java
While preparing my Deep Dive talk on Java 21 for friendly Java User Groups, I’ve noticed a curious case of JEP 443: Unnamed Patterns and Variables (Preview). I’ve managed to create a reproducer, so I’d like to share the findings here.
I assembled a simple demo of the JEP. It’s obviously very nice and for sure it will improve Java’s abilities to shine in data-first coding scenarios.
However, this JEP is not only about switch and ifs, it’s also about lambdas, catch blocks and so on.
Java™ 21 is real now. And so are virtual threads. Everyone got excited about them, yet you prefer to keep your Java 8 job forever, and you already have a nice plan to “accidentally” derail the migration to 21 by using virtual threads in a very, very unfortunate way. What a pity…
So you decided to come for this talk to look for some inspiration ;-)
Okay, please join us to learn how NOT to use virtual threads, and see the potential performance pitfalls of using them the wrong way.
Spoiler alert: this is a “from zero to hero” session. Assuming you’re familiar with programming (hopefully in Java), after this session you should be able to explain why Testcontainers are needed, simple and powerful 😉
The pyramids in Egypt were built in ancient times. We still admire them today, appreciating the craftsmanship and hard work of their builders. However, do we build houses from giant stone blocks today? Not likely, current times bring other needs and offer other technologies.
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:
Let me start this entry with a dad joke.
An electron rides a motorcycle. Suddenly, a police officer stops the electron and says:
‘I had to stop you, because you were speeding, driving exactly 178 and half kilometres per hour.’
‘Well, THANK YOU VERY MUCH, officer!’ the electron says, ‘Now I have absolutely no idea where I am!!!’
Some dad jokes are terrible, and don’t worry if you don’t get this one.
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:
Some people complain that they’re not doing integration tests “because they take too much time.” All right, the interaction with real dependencies sometimes can’t be made shorter, but there are surely ways to start the databases, message brokers, and so on faster if you happen to use Testcontainers for that.
In this entry, I’ll be using Java. However, since Testcontainers is (from a certain angle) a convenient way to interoperate with Docker-compatible containers using the programming language you know, this should apply to other technology stacks as well.
The pyramids in Egypt were built in ancient times. We still admire them today, appreciating the craftsmanship and hard work of their builders. However, do we build houses from giant stone blocks today? Not likely, current times bring other needs and offer other technologies.
Pyramids of testing were also built some time ago. We admire legacy projects with a rich set of tests, but do we create projects today the same way we did 10-15-20 years ago?
During my trainings and lectures, I get asked “but how do you switch Java so fast?” or even “it’s possible to have several versions of Java on your computer at the same time?!” Sure it is!
The way is very simple: use SDKMAN! I use it almost every day, it comes in handy not only during lectures about the latest versions of Java, but in ordinary daily work when you need to check “how it works on another version”.
During my trainings and lectures, I get asked “but how do you switch Java so fast?” or even “it’s possible to have several versions of Java on your computer at the same time?!” Sure it is!
The way is very simple: use SDKMAN! I use it almost every day, it comes in handy not only during lectures about the latest versions of Java, but in ordinary daily work when you need to check “how it works on another version”.