Live data from Hacker News

Java 21 makes me like Java again

wscp.dev

131–140 of 777 posts

Re: Java 21 makes me like Java again

#132
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…

> This is not a fun situation to deal with and inheritance makes it a lot harder because the "is a" relationship is driving a ton of your logic.

Judicious OOP design allows others to change behavior based upon needs that perhaps the original coder never thought of.

I would not call most Java OOP design judicious. The control in Java is owned by the library writers and the language devs -- not the people using it.

Re: Java 21 makes me like Java again

#133
post #123

Earlier quoted context omitted.

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…

> you build a classification of all life and it is built upon the idea that everything "is a" plant or animal With all due respect, this and similar examples are just plain wrong, and I really can't take anyone seriously when that example is used. The point of programming, and its abstractions is to help you complete a task , and make the implementation maintainable and easy to reason about. I think grabbing the "is…

I think your post can be broken down into two main points.

1. That my point is bad for some reason

2. That inheritance is sometimes a great tool

We agree on (2). Inheritance is pretty amazing, even if I think that it's ultimately a terrible feature to build so ingrained into a language and to expand in power to such a degree.

As for (1), I don't really get your point. Abstractions help you complete a task - ok. Abstractions are to help you reason about stuff - ok. Something about "is a" being bad? None of that really explains why my example demonstrates the problems you run into when you try to build a classification of values using inheritance. But I also said that I wasn't going to really try to explain much, it's been written about plenty.

Re: Java 21 makes me like Java again

#134
post #72

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.

I wonder what will happen with these patterns now. They seem to have been invented to work around the problems with regular threads. Will new patterns emerge, or will the reactive patterns be ported to run on virtual threads?

The reactive patterns are now obsolete and will die. And good riddens I say.

Re: Java 21 makes me like Java again

#135

[flagged]

So which is the real programming language one should use in the God's year, 2023? (Will it change in 4 months also?)

> virtual threads but you still have threadpools and os threads

As opposed to what, quantum entanglement threads?

> No one really enjoys debugging your call stacks

Frankly, debugging has probably the very best tooling around the JVM -- so, what exactly is your chosen favorite that would be supposedly better? Or is objective reality not hyped anymore?

Re: Java 21 makes me like Java again

#136
post #14

Can you convince me to use Java? I’ve never used it (only C++, Python, CL) but it feels bloated and dirty.

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 programming, but are only familiar with C++98.)

> Thousands of high quality libraries a JVM that is a marvel of engineering after 20 years

I reluctantly have to agree. :)

Re: Java 21 makes me like Java again

#137
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.

they have generics now, but there are other conceptual shifts:

- no inheritance

- error codes with explicit handling everywhere

Re: Java 21 makes me like Java again

#138
post #19

Earlier quoted context omitted.

Going from 11 to 21 is a lot easier.

Depends- one of the hardest parts of the 11-20 upgrade for us was that cms gc was removed. If you run a bunch of different microservices with distinct allocation profiles, all with high allocation pressure and performance constraints, and you've accomplished this w/ the help of a very fine-tuned CMS setup, migrating that over to G1/ZGC is non-trivial

I can't help but think if you're teetering on a knife's edge, only holding on thanks to hyper tuned GC params, then you should take a step back and consider getting out of that predicament.

Re: Java 21 makes me like Java again

#139
post #95

[flagged]

It's not so bad. I might be an old masochist with Stockholm syndrome, but every language has its own special flavor of barely tolerable bullshit.

There is some truth to this. Every language I used had severe drawbacks. At this point, it's choosing the lesser of the evils.

Re: Java 21 makes me like Java again

#140
post #81

Earlier quoted context omitted.

Exactly what is enterprise? I think Java has a role to play in most professional settings, even if the company is quite small. It is not a sports car but I see it more as a truck or a cargo ship. Vehicles that underpin the world economy, but that only few think of as fun or exciting. Not pretty or nice to look at, but reliable work horses.

It is for sure the wagoneer when it comes to getting things done in the enterprise, if it was 2005. It’s not a sports car, it’s not a dune buggy, it’s not even pretty in its wood paneling and drab paint scheme. But it got your family to Wisconsin for the holidays. In 2023, we have better options.

Yeah, sure the thing that runs the whole of Apple, Alibaba infrastructure, many part of Google, most of that "cloud" infra is a wagoneer..
Post reply on HN