I am a big functional programming geek. I am one of the few people on the planet who can honestly say I have been paid to write F#, Haskell, Clojure, and Erlang. I have spoken at FP conferences like six or seven times, and I have shit on Java for most of my career. And yet, my latest talk at Lambda Days basically boiled down to “Java 21 and later don’t actually suck anymore”, and I genuinely do mean that. Java 21 is…
I don’t use Java often, but many developers at my workplace do; they universally hate the new FP features.
All New Java Language Features Since Java 21
21–30 of 130 posts
Re: All New Java Language Features Since Java 21
#22I am a big functional programming geek. I am one of the few people on the planet who can honestly say I have been paid to write F#, Haskell, Clojure, and Erlang. I have spoken at FP conferences like six or seven times, and I have shit on Java for most of my career. And yet, my latest talk at Lambda Days basically boiled down to “Java 21 and later don’t actually suck anymore”, and I genuinely do mean that. Java 21 is…
I don’t use Java often, but many developers at my workplace do; they universally hate the new FP features.
They’ll give half-hearted justifications that are usually reductive or just flat out lies [1], but ultimately it seems to boil down to new=bad.
The amount of terrible code I have had to debug because Java programmers haven’t figured out you can use queues is upsetting, because all they learned in university is how to use `synchronized` wrong.
[1] I have learned that nearly every time someone says their disgusting code is “faster”, even when they claimed they tested it, it is almost universally untrue when I write a microbenchmark to check it.
Re: All New Java Language Features Since Java 21
#23Earlier quoted context omitted.
> You mention "var", why would we ever want in Java to hold a variable that you can't read immediately what is the type? var items = new HashMap(); Instead of HashMap items = new HashMap(); That's the point of var. It reduces noise a lot in some situations.
You should write Map items = new HashMap (); It allows you to limit `items` usage to `Map` supertype and allows you to swap implementation easily, if necessary. `var` is weird feature, because it allows people to use implementation-specific methods methods and tie code to a single implementation, essentially making it less agile. There are valid use-cases for `var`, but IMO this feature should not have been added to…
For argument types you don’t have var, so methods that take in a map can stay abstract and you can still pass in the implementation-specific version into those without casting it to the interface.
ETA:
I guess I am trying to say that if you want to be abstract, they should be at the argument or properties level. Local variables should be used locally. I agree that generally speaking you should try and prefer using Map for anything shared across different parts of code but I am not convinced it’s bad to have var be implementation-specific; if your method is big enough to where swapping out implementations like this will take a lot of time, your method is probably too big anyway.
Re: All New Java Language Features Since Java 21
#24The only new feature I might use since 1.8 (that only had NIO stability and GC improvements over 1.7) are the virtual threads without pinning in 24.
Re: All New Java Language Features Since Java 21
#25Earlier quoted context omitted.
I don’t use Java often, but many developers at my workplace do; they universally hate the new FP features.
Everyone seems to love them at my workplace and in /r/java.
Re: All New Java Language Features Since Java 21
#26Earlier quoted context omitted.
The new features make the code easier to read. For example var: List accounts = List.of(new Account(1), new Account(2)); var accounts = List.of(new Account(1), new Account(2)); It just reduces visual noise and boilerplate that you already know. Java 8 is also a slow and old runtime. It performs terribly in 2025. Here’s a quote from 2020 and the gap has only gotten wider [0]: > JDK 8 is an antiquated runtime. The defa…
Using Java 8 doesn't mean using the java 8 JDK. It just means not using the newer features. I don't see anything in the parents post about restricting which JDK they use.
Still glorifying it.
Re: All New Java Language Features Since Java 21
#27Earlier quoted context omitted.
> You mention "var", why would we ever want in Java to hold a variable that you can't read immediately what is the type? var items = new HashMap(); Instead of HashMap items = new HashMap(); That's the point of var. It reduces noise a lot in some situations.
You should write Map items = new HashMap (); It allows you to limit `items` usage to `Map` supertype and allows you to swap implementation easily, if necessary. `var` is weird feature, because it allows people to use implementation-specific methods methods and tie code to a single implementation, essentially making it less agile. There are valid use-cases for `var`, but IMO this feature should not have been added to…
Re: All New Java Language Features Since Java 21
#28Earlier quoted context omitted.
Everyone seems to love them at my workplace and in /r/java.
That's called selection bias for both of you. Reddit will expel anyone whose opinion does not correspond to the local mob bias. Workplaces select people who are similar to already working ones.
Re: All New Java Language Features Since Java 21
#29I am a big functional programming geek. I am one of the few people on the planet who can honestly say I have been paid to write F#, Haskell, Clojure, and Erlang. I have spoken at FP conferences like six or seven times, and I have shit on Java for most of my career. And yet, my latest talk at Lambda Days basically boiled down to “Java 21 and later don’t actually suck anymore”, and I genuinely do mean that. Java 21 is…
I view this largely as a symptom of the widescale “success” of the bloated J2EE app servers in the early 2000s to mid 2010s. Your Java version and dependencies were locked in and upgrading was a massive effort. A large group of developers stagnated on Java 1.4.2 and 5 and seemingly never updated their use of the language, even when moving to Java 8 and beyond. The legacy stuff keeps ticking along.
I think people here are really underestimating how intellectually lazy most people are at their jobs. HN selection-biased for a geekier crowd so a lot of my criticisms don’t apply to readers of this forum.
Re: All New Java Language Features Since Java 21
#30There were times I hated it, but turns out I really just hated messy, over-engineered legacy code and working in a gray cubicle at aging MegaCorps.
The language itself is quite beautiful when used properly and with modern features.
It just really needs a makeover and better tools.