News for hackers. Stuff that matters.
Re:Java's records, Lombok's data, and Kotlin's data classes by smoldesu on Friday May 07, 2021 @01:12PM (#27078270)
This might qualify as low-grade threadjacking, so I apologize if this is off topic, but who's actually using Java these days? Most devs I know avoid it like the plague, and only use it to maintain legacy codebases or get CS qualifications. Are there any real advantages to using Java in 2021, besides it's mature community/ecosystem/tooling?
Re:Java's records, Lombok's data, and Kotlin's data classes by Misdicorl on Friday May 07, 2021 @01:17PM (#27078334)
> besides it's mature community/ecosystem/tooling

Thats the answer. And its a really good one.

The only other languages with the same or better breadth and depth have their own reasons to avoid them like the plague (e.g. C/C++ footguns, difficulty managing large-ish codebases without types)

Re:Java's records, Lombok's data, and Kotlin's data classes by villasv on Friday May 07, 2021 @01:21PM (#27078387)
IKR. The question framing is almost like: is there any other reason to use Java except all the most important and good reasons?
Re:Java's records, Lombok's data, and Kotlin's data classes by smoldesu on Friday May 07, 2021 @03:25PM (#27079912)
I meant it more on a language level. It has a great network of support, no doubt credited to it's long legacy, but what technical advantages would it provide over writing a program in a language like C++ or Rust? Is it all creature comfort, or does it have some hidden advantage that I can't see?
Re:Java's records, Lombok's data, and Kotlin's data classes by Misdicorl on Friday May 07, 2021 @04:28PM (#27080502)
> besides it's mature community/ecosystem/tooling

How could you not see this as an incredible technical advantage in almost any context?

Re:Java's records, Lombok's data, and Kotlin's data classes by Misdicorl on Friday May 07, 2021 @04:34PM (#27080574)
If you must have a specific language level technical advantage over C++/Rust, its the incredible GC algorithms available to you while you are (mostly) stuck with simple arena collectors in C++/Rust land.
Re:Java's records, Lombok's data, and Kotlin's data classes by skinkestek on Friday May 07, 2021 @01:36PM (#27078551)
> Most devs I know avoid it like the plague, and only use it to maintain legacy codebases or get CS qualifications.

All the customers I have worked with since I became a consultant 4 years ago (and a couple of the best companies I worked with in the decade before) used Java or .Net. More specifically one of them was dotnet core and the rest are JVM.

And I'm happy with that.

Java and Maven means I can focus on the problem and not on all the crazy things people who think they are too clever to use Java do.

I mean I have seen a couple of Abstract Factories in Java, but I haven't seen anyone avoiding putting passwords in the source code by writing things like this:

  rot13(<rot13password>) 
That is stuff I have found in Python code by the one consultant who was to smart to use Java or .Net.
Re:Java's records, Lombok's data, and Kotlin's data classes by diab0lic on Friday May 07, 2021 @01:19PM (#27078356)
A large chunk of the Netflix backend runs on the JVM. Much of it written in Java. While I agree that many devs avoid it like the plague, and I used to be one of them, once I let go of attachments to programming languages I found it quite a pleasant experience to develop software using Java.

Basically using Lombok and Vavr give you a very nice lightweight functional experience. Bells and whistles tend to be a distraction from making software that works and scales. I’d way rather focus on the hard problems in computing than how to most idiomatically or elegantly express things in a language.

Re:Java's records, Lombok's data, and Kotlin's data classes by haolez on Friday May 07, 2021 @01:17PM (#27078336)
It's a language that protects your investment. There is a lot of effort in backwards compatibility and the language puts a lot of constraints in the devs so that the development moves slowly, but in a sustainable manner.

This is the best case scenario, of course. But it's an argument that I see being used in new Java projects.

Re:Java's records, Lombok's data, and Kotlin's data classes by jeroenhd on Friday May 07, 2021 @02:30PM (#27079181)
The existence of Spring Boot makes Java a very good choice for loads of dev shops. Good balance between features, ease of use, performance and security, not difficult to pick up, and very well documented.

In my personal opinion, C# is a superior language these days now that most of .NET has been ported into dotnet core. However, that's only been the case for a few years and before that, Java was in a league of its own with its excellent library ecosystem and omnipresent JVMs.

Java is a very boring language. Features get added slowly compared to other languages, improvements are generally quite gradual and new concepts only rarely ever get added to the language. This will drive away many hot startups and fresh CS graduates because they want to use the latest technologies in brave new ways and explore the ecosystem.

For general businesses, boring is good. Boring is predictable, understandable and maintainable. Java is not the fastest language to write software in, but it's fast enough not to warrant teaching your staff a new language for. It's missing many features that are standard in other languages, but there's third party libraries to make up for that.

In my mind, languages like Rust and Zig are the Teslas of the software world, exciting, new, full of flaws that need to be ironed out but ready to storm the general market one day soon. Go and Kotlin are the shiny new SUVs, impressive and high quality, but packed with weird design choices and opinions on how to use them. Java and C# are the old van the company has owned for 20 years. Nothing impressive, but reliable, comfortable, predictable, and with quirks that everyone has been learning for years now. Most businesses don't need a Cybertruck, they need to get around, and what businesses already have is good enough for the next while.

Re:Java's records, Lombok's data, and Kotlin's data classes by johnnycerberus on Friday May 07, 2021 @09:17PM (#27082713)
You forgot about the spaceship called Scala and how many startups are trying to parallel park a spaceship when they just need a Mini. Just to continue your line of analogies. Though, I still like playing with spaceships.
Re:Java's records, Lombok's data, and Kotlin's data classes by Karrot_Kream on Saturday May 08, 2021 @02:12AM (#27084401)
Hah this is a great set of analogies. Thanks!
Re:Java's records, Lombok's data, and Kotlin's data classes by barsonme on Friday May 07, 2021 @01:33PM (#27078511)
Android development. Kotlin is great, but Java is still a perfectly valid choice. In particular, if you don’t have dedicated Android developers Java can be a good choice because most people are at least somewhat familiar with it and won’t have to learn a new language to be productive. That said, I think anybody who understands Java should be able to understand Kotlin with minimal effort.
Re:Java's records, Lombok's data, and Kotlin's data classes by EvilEy3 on Friday May 07, 2021 @01:55PM (#27078778)
> besides it's mature community/ecosystem/tooling?

Not sure if I should be mad or just ignore you.

Re:Java's records, Lombok's data, and Kotlin's data classes by bob1029 on Friday May 07, 2021 @01:26PM (#27078432)
If C# didn't exist, we would certainly be a Java shop. Not only because of the ecosystem & tooling, but also because it is a language that has historically proven its ability to model incredibly complex business domains as well as support mission critical workloads without falling over on itself.
Re:Java's records, Lombok's data, and Kotlin's data classes by azth on Friday May 07, 2021 @01:37PM (#27078555)
How's your experience with C#/.NET been? Does it have an analogous offering to Java's JFR[0] for always-on profiling?

[0] https://blogs.oracle.com/javamagazine/java-flight-recorder-a...

Re:Java's records, Lombok's data, and Kotlin's data classes by bob1029 on Friday May 07, 2021 @02:35PM (#27079245)
I am not familiar with the scope of JFR, but there have been some very recent movements around profiling in C#/.NET:

https://devblogs.microsoft.com/dotnet/introducing-dotnet-mon...

https://devblogs.microsoft.com/dotnet/whats-new-in-dotnet-mo...

My experience overall with the C# ecosystem has been fantastic. We started out on .NET Framework 4.x back in 2014-2015, and today are now talking about moving to .NET 6 and rewriting our native apps to use MAUI as November grows closer. A lot of the same code we had back in 2015 is still running today with zero modifications.

Re:Java's records, Lombok's data, and Kotlin's data classes by bpicolo on Friday May 07, 2021 @02:12PM (#27078921)
Seems like EventPipe is the C# equivalent? https://docs.microsoft.com/en-us/dotnet/core/diagnostics/eve...
Re:Java's records, Lombok's data, and Kotlin's data classes by azth on Friday May 07, 2021 @02:17PM (#27079001)
It seems somewhat similar, but I don't see mention of method traces (similar to a profile view in figure 7 in the blog post I listed).
Re:Java's records, Lombok's data, and Kotlin's data classes by bpicolo on Friday May 07, 2021 @02:21PM (#27079045)
There are tools built on top of it to that effect (eventpipe -> dotnet-trace -> tools built on top of trace) https://www.hanselman.com/blog/dotnettrace-for-net-core-trac...
Re:Java's records, Lombok's data, and Kotlin's data classes by switch007 on Friday May 07, 2021 @01:38PM (#27078573)
“historically proven its ability to model incredibly complex business domains”

You surely can’t be talking about its type system?

Re:Java's records, Lombok's data, and Kotlin's data classes by bob1029 on Friday May 07, 2021 @02:31PM (#27079195)
I certainly prefer the type system of C# over Java, but the latest things I've seen come out of the Java camp give me confidence that I could port most of the same ideas across the way without too much friction if need be.
Re:Java's records, Lombok's data, and Kotlin's data classes by switch007 on Friday May 07, 2021 @02:36PM (#27079257)
You said historically, by which I assumed you meant older Java versions, not later ones.
Re:Java's records, Lombok's data, and Kotlin's data classes by lowbloodsugar on Friday May 07, 2021 @03:11PM (#27079746)
>Are there any real advantages to using Java in 2021, besides it's mature community/ecosystem/tooling?

It's fast: C fast in most cases. It can use a lot of cores and memory with minimal effort from developers. It has great tuning parameters for things like GC. We hit a cliff at about 150GB heap, tuned it, and now we're at 300GB. It's "good-enough" type safe. Java grows with you.

Re:Java's records, Lombok's data, and Kotlin's data classes by taftster on Friday May 07, 2021 @03:33PM (#27080000)
Try this list out:

https://projects.apache.org/projects.html?language#Java

There's a LOT of real interest in Java in many many industries. Saying this like "Most devs I know" just really is more of an observation of your local circle.

Big data, Finance, Government

Just to name three really big industries that are dominated by Java.

Re:Java's records, Lombok's data, and Kotlin's data classes by autodidacticon on Friday May 07, 2021 @01:27PM (#27078438)
It would seem that the world of data engineering is largely dominated by Java.
Re:Java's records, Lombok's data, and Kotlin's data classes by johnnycerberus on Friday May 07, 2021 @09:25PM (#27082755)
I share the same view, based on the jobs in my area, everyone is using Python to prototype and Java/Scala to productionize, I've also seen Node.js increasingly being used, probably for things that are I/O-intensive and not compute-bounded. Rust could change the landscape for Node/Deno, critical code which is memory/cpu-intensive could be exported to a WASM library or an external dependency that can be called through FFI (though that would be very slow and you introduce the 2-language problem that Julia is trying to fix for Python). Anyway, even if we are in a way better state today than, let's say, 5 years ago when it comes to picking tools for data engineering, I strongly believe that JVM is here to say for a long, long time.
Re:Java's records, Lombok's data, and Kotlin's data classes by throwpupper on Friday May 07, 2021 @03:31PM (#27079979)
Java? Not so much. JVM? Absolutely. The ecosystem, stability and performance is unmatched.
Re:Java's records, Lombok's data, and Kotlin's data classes by dboreham on Friday May 07, 2021 @02:04PM (#27078841)
Java has the nice advantage that it works.