this post was submitted on 25 Oct 2023
0 points (NaN% liked)

Java

1614 readers
1 users here now

For discussing Java, the JVM, languages that run on the JVM, and other related technologies.

founded 2 years ago
MODERATORS
 

Advances in the java programming language, version 16 and newer, slashed a million lines of code from my codebase. Maintaining my programs became easier overnight, due to this 1 secret trick: Records. 
Unfortunately version 16 was not LTS, so I had to wait until this year's release of version 21, which is LTS. 
 Go read the linked article. It explains Java Records in a very approachable manner.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] -1 points 1 year ago

I feel like so much effort is spent trying to solve problems that just aren't problems.

Creating simple data objects (or what we used to call Java Beans) is ready to do - especially in a modern IDE. It's also simple to understand what is happening in one and different take very long to read at all.

I can count on the fingers of one hand the number of times I've actually needed to write a hash or equals method.

But the solution to this, in my opinion, non problem is to use a highly inflexible tool that only works in a subset of cases - e.g. when it's ok for your data objects to be immutable.