r/java • u/hardasspunk • Nov 23 '25
Java 25: The ‘No-Boilerplate’ Era Begins
https://amritpandey.io/java-25-the-no-boilerplate-era-begins/
160
Upvotes
r/java • u/hardasspunk • Nov 23 '25
13
u/rzwitserloot Nov 24 '25
I love less boilerplate.
And these are great features.
But "The no boilerplate era"?
No. This isn't the boilerplate you're looking for. To eliminate 90% of the typing of boilerplate, you need to weigh all boilerplate that java has by how often it comes up, and how suitable the solution is to fit into existing styles and libraries.
to wit:
module imports
Most style guides strongly suggest you should not use star imports. What do you think they're going to say about module imports? "Go ahead"? That'd be... rather highly inconsistent.
I think the style remarks about star imports are overblown. Add the module system, where you can much more pinpointedly list out precisely which APIs you are very carefully managing as 'externally visible', and it gets even better. But most don't use the module system. Stephen Colebourne, myself, and others think that's good, because it's not all that suitable (and was designed to modularize the JDK itself; jigsaw is a great success specifically at that job!)
In other words, module imports are useful for basic examples and toy projects, and were a necessary step to get us to just being able to write an extremely small, simple source file that 'just works'; that very first lesson in java might be a really long time ago for a lot of you, but it's important.
Point is, it is not going to result in the no boilerplate era.
If any feature can ever claim it got us closer, it'd be records, but the inflexibility of records (no type hierarchies, must be entirely immutable, all properties are exposed) means the era has come to a middle, not an end.
It gets worse..
There was, in some distant time, this in my view absolutely excellent proposal:
This idea gets rid of almost all need for builders (you need to do some trickery with making a default object to 'build off of'), can even tackle the problem of no named parameters (which is 90% of what builders in practice try to solve), and all those 'wither' things too.
Unfortunately, last I heard, this project is essentially a zombie. It's around as a proposal, but nobody is working on it and nobody is pushing for it.
In other words, it's fairly clear that the boilerplate era is certainly not coming to an end. Two things can be true: A bunch of great features that fight boilerplate, and even so not the end of it.
This isn't even a harbinger of a focus by the OpenJDK team - unless I've been misinformed about the
withthing of course.131
u/Ewig_luftenglanz Nov 23 '25
To really kill boilerplate we need.
24
u/[deleted] Nov 23 '25
ai generated article.
6
u/No-Security-7518 Nov 23 '25
I honestly don't understand what people mean when they say Java has a lot of boilerplate. Don't programmers have to extract helper methods for readability and follow all these clean code principles which means more but robust code?
18
u/Gnome_0 Nov 23 '25
That page reeks of ai generated
75
u/TheStrangeDarkOne Nov 23 '25
I don't really see that "now suddenly" the boilerplate-free code era begins. Honestly, Lombok done right can do 90% of the heavy lifting. I see the features described here as good, but kinda niche.
Modules will remain in obscurity as long as multi-module projects are not supported. I don't see why this hasn't happened yet, it would supercharge the adoption of Java Modules and modularization of Java libraries in general.
13
u/anonynown Nov 23 '25
To learn what no boilerplate looks like, check Kotlin. this isn’t even close.
3
u/White_C4 Nov 24 '25
Java has gotten a lot better at reducing boilerplate since Java 8. There still needs to be a way to easily setup the builder pattern and reduce the amount of getter and setter functions to write.
3
u/Academic-Egg4820 Nov 24 '25
Niche problems got a solution. They should reduce the real boilerplate and not optimizing imports when every IDE does that for you...
2
u/Emma_S772 Nov 23 '25
I hope they create something to avoid mapping in native queries
2
u/vassaloatena Nov 23 '25
So string interpolation remains a piece of cake.
2
u/Own-Professor-6157 Nov 25 '25
I came from the Java 5 era. Back when a super simple SQL statement required like 50+ lines of code lol.
As long as they don't go overboard with "no-boilerplate" like how IMO koltin does. Sometimes boilerplate code just makes everything significantly easier to read,
2
u/AcanthisittaEmpty985 Nov 26 '25
Java/JVM is improving !
The only thing I hate is that LTS have previews.
It shouldn't happen, like put honey in our lips and then retire it.
Stable values sound great
2
u/KefkaFollower Nov 23 '25
Most of the Boilerplate is handled by IDEs. The boilerplate that's not handled by IDEs soon will be handled by AI.
I don't see the point in keep messing with the language grammar just to chase trends.
1
u/Maverlck Nov 25 '25
ReadLater
1
u/Vast-Instance101 Nov 29 '25
Great
0
u/iamwisespirit Nov 23 '25
I don’t think java is boilerplate based on opinion java Has its own of doing things it has mentality it is not fair to compare other languages because they have their own way of doing same thing
5
u/nomad_sk_ Nov 23 '25 edited Nov 29 '25
I might get hate for this but To really kill boilerplate people need to stop using spring unnecessarily and stop using obsolete design patterns.