News for hackers. Stuff that matters.
Re:Java record pattern matching in JDK 19 by jeroenhd on Saturday May 14, 2022 @05:18PM (#31382590)
Most Java is very easy to comprehend, but then you have things like implicit finals and whatever you call the `List<? extends Something>` language construct. I think most Java is very boring, functional code with some notable exceptions related to threading and the typing system. It gets the job done, but often in an ugly, roundabout way.

The way `Optional` is implemented and the roundabout way to just grab the first item in a list (`list.stream().findFirst()` or `var e = null; if (!list.isEmpty()) e = list.get(0);`?) where other languages have added helpers years ago. Or, even worse, the lack of tuples, leading to your average medium-sized Java project containing five different implementations of Tuple/Pair. There are also runtime restrictions that sometimes crop up because Oracle can't break compatibility (type erasure, for example).

If code clarity was the only metric for language quality then we'd all be writing some BASIC derivative. I don't think more modern languages like Swift and Kotlin are all that applicable to all areas where Java shines, but ever since dotnet went open source and cross platform I'm really starting to wonder why anyone still bothers with Java.

Re:Java record pattern matching in JDK 19 by vips7L on Saturday May 14, 2022 @08:21PM (#31384059)
I personally feel that tuples are an antipattern. It’s relatively simple to just define a record with the properties you need and gives meaningful context information because the record and it’s properties are named.
Re:Java record pattern matching in JDK 19 by grishka on Saturday May 14, 2022 @09:45PM (#31384522)
Records are very new. To be honest, I haven't seen a single project that isn't my own use modern Java features. Most projects I've seen still target Java 8, some Java 11.
Re:Java record pattern matching in JDK 19 by vips7L on Sunday May 15, 2022 @11:25AM (#31388123)
It’s still just as easy to define a class with 2 fields. It takes 1 minute to write.