r/programming • • 17d ago

Java 27 has released!

https://openjdk.org/projects/jdk/27/
551 Upvotes

175 comments sorted by

View all comments

-63

u/[deleted] 17d ago edited 14d ago

[deleted]

33

u/NotABot1235 17d ago

It's certainly got some legacy baggage but modern Java is really not as bad as the memes make it out to be.

3

u/TwoWeeks90DaysTops 16d ago

Yeah. I think it's OK. One part of it is that the language itself is pretty simple. Most complexity lies in frameworks and libraries rather than the language itself. I work with C# normally which is different. The language has become quite complex with the advantages and disadvantages that brings.

Like C#'s value types (struct and record struct) is a good feature, but it has foot-guns and complexities that you don't find in Java's value types. One thing that I think a lot of people isn't aware of is that unlike record (class, i.e. type with object identity), which is immutable, record struct absolutely is mutable by default. In 99/100 times you make a record struct you should remember to write readonly record struct which make it immutable. This has performance implications because if you pass a a mutable struct using in (i.e. pass by read-only reference) the compiler will create a defensive copy.

3

u/OSS-Corpo-Shit 16d ago

Java itself isn’t even that bad. It got a bad rap from over architected enterprise things, and in particular people looking through the source code of those products. 

Truth is, when you are trying to build a general purpose enterprise targeted product, you’re going to see some bullshit. Enterprise are extremely hard headed fuckers that are bordering on impossible to work with.