Live data from Hacker News

Java 21 makes me like Java again

wscp.dev

141–150 of 777 posts

Re: Java 21 makes me like Java again

#142
post #40

Earlier quoted context omitted.

Please ELI5 what is wrong with inheritance and/or how Java have it wrong. Do we need to go back to a new object oriented undegraduate course? Genuinely asking.

Inheritance provides "is a" relationships between classes. At a time when people would spend months designing their software upfront, building big diagrams of classes, etc, this was not so bad. You'd have a very clean system design that maps directly to your class design. The problem is when things change. A simple example - you build a classification of all life and it is built upon the idea that everything "is a" p…

In cases of refactoring, inheritance seriously sucks.

But it is quite advantageous when, as you say, your model is well thought out and stable.

Re: Java 21 makes me like Java again

#143

Earlier quoted context omitted.

Golang or Rust. If it’s a web service or microservice: Golang hands down. If it’s a desktop software or game engine, rust. If you just want to typescript your way to success, deno and vite. If you’re too introverted for Rust, Zig. Java, whether it be spring, micronauts, jee, whatever, is wasting CPU and Memory in the cloud costing you and/or your enterprise money.

> Golang golang is probably a good contender for business logic code where Java is widely used, but I feel ecosystem (libs, integrations) is not comparable to Java, so you take some risks while choosing golang.

And it is much more verbose, it is not even comparable in observability and on real world big applications (especially enterprise) you can't get away with value types and slowing down the threads to let the GC keep up with them -- Java definitely shines in these kind of conditions (GC-wise the only competition Java has is different Java GCs, really).

Re: Java 21 makes me like Java again

#144
post #121

Earlier quoted context omitted.

I have not used Go generics, but it's viability as a business logic language would depend on that.

they have generics now, but there are other conceptual shifts: - no inheritance - error codes with explicit handling everywhere

Yes those are also drawbacks

Re: Java 21 makes me like Java again

#146
post #136
post #14

Earlier quoted context omitted.

None of the memory problems of C++, the speed of C++ most of the time. Thousands of high quality libraries, a JVM that is a marvel of engineering after 20 years, tooling for development, monitoring and introspection of exceptional quality. Many of the internal tools at the largest Cloud developed in Java. Most enterprise level software. NASA extensive use of Java. A team behind the development who has stunning common…

> None of the memory problems of C++ Every time I see something like this I roll my eyes... C++ doesn't have any "memory problems". There are sometimes human problems, such as thinking one is capable of coding without understanding the (basic programming) concept of a pointer. But that's because the human's dumb, not a language problem. (This argument also sometimes comes from those who do understand basic programmin…

"But that's because the human's dumb, not a language problem."

If everything is the programmer's fault for being dumb, then Brainfuck is an excellent system language.

Re: Java 21 makes me like Java again

#147

The biggest feature in Java 21 is the release of Virtual Threads: https://openjdk.org/jeps/444 For some reason, this is missing from the article. If there was any feature that would sway existing Golang developers to switch to Java, it would be this. It would perhaps also convince the haters of the reactive-style concurrency patterns.

Java 21 also previews structured concurrency (https://openjdk.org/jeps/453), which uses the virtual thread implementation. It seems really nice, at least from reading the examples, and removes a number of pain points when dealing with thread-based concurrency.

Re: Java 21 makes me like Java again

#148
post #121

Earlier quoted context omitted.

> Golang golang is probably a good contender for business logic code where Java is widely used, but I feel ecosystem (libs, integrations) is not comparable to Java, so you take some risks while choosing golang.

I have not used Go generics, but it's viability as a business logic language would depend on that.

Wait, what?

Generic programming is a perfectly valid style, but are you saying it's essential to implement business logic?

Because, like, the last 3 languages that got adopted as the default business logic language didn't have them (Java pre 1.5, C, and Cobol).

Re: Java 21 makes me like Java again

#149
post #14

Earlier quoted context omitted.

None of the memory problems of C++, the speed of C++ most of the time. Thousands of high quality libraries, a JVM that is a marvel of engineering after 20 years, tooling for development, monitoring and introspection of exceptional quality. Many of the internal tools at the largest Cloud developed in Java. Most enterprise level software. NASA extensive use of Java. A team behind the development who has stunning common…

What would be a modern IDE for Java? I remember programming Java in Eclipse. And it was powerful for the time, but everytime I read bloated, I automatically think Eclipse since then..

Another rather new option is VSCode + the Java plugin

Re: Java 21 makes me like Java again

#150
post #136
post #14

Earlier quoted context omitted.

None of the memory problems of C++, the speed of C++ most of the time. Thousands of high quality libraries, a JVM that is a marvel of engineering after 20 years, tooling for development, monitoring and introspection of exceptional quality. Many of the internal tools at the largest Cloud developed in Java. Most enterprise level software. NASA extensive use of Java. A team behind the development who has stunning common…

> None of the memory problems of C++ Every time I see something like this I roll my eyes... C++ doesn't have any "memory problems". There are sometimes human problems, such as thinking one is capable of coding without understanding the (basic programming) concept of a pointer. But that's because the human's dumb, not a language problem. (This argument also sometimes comes from those who do understand basic programmin…

> Every time I see something like this I roll my eyes... C++ doesn't have any "memory problems".

You can choose which report you would prefer: Microsoft's, Google's 65%, ... I'm sure they just hired bad developers that don't understand pointers.

Sure, human problem, but if no human can use the tool correctly, then surely there is some problem with it. And no, that doesn't mean that memory unsafe languages don't have a place, but we really should have a very good reason for going down that road.

Post reply on HN