Live data from Hacker News

Java 21 makes me like Java again

wscp.dev

741–750 of 777 posts

Re: Java 21 makes me like Java again

#741
post #114

Earlier quoted context omitted.

In what language would that marvel be? I give you the less memory....

Go has goroutines which have better cpu and memory than threads which are commonly used in java. Java is now catching up with go and adding virtual threads which in september 2023 will have the same ease of use as go had in … 2007? But as I wrote above, it migh really get me to check java again.

Well is it correct that until 1.14 (so 2020) Go used cooperative scheduling? Because Java Threads, (before the new virtual threads) are preempted by the OS...Go was launched in 2009? Who is doing the catching up?

Re: Java 21 makes me like Java again

#742
post #708

Earlier quoted context omitted.

And if you want to configure the scope of `my_dep1` (singleton, transient, etc.)? What about nested dependencies? etc.

Why do I care about any of that while writing python? Those seem like artifacts of a Java based DI system.

It's a reality of any non-trivial program, regardless of the language.

Re: Java 21 makes me like Java again

#743
post #57

Earlier quoted context omitted.

What's dirty is trying to get a python project reliably running on all dev computers. Pyenv, venv, wheels, suddenly you need a complete rust or c toolchain etc. With java I haven't had those kind of issues the last decade, it just works. With python it's still a big hassle and everything breaks every update.

To be fair, getting all those scientific library binaries compiled and installed was a huge pain even before python came around. Python's toolchain made it better, but only marginally in some cases.

Sadly this isn't just the case for scientific Python. E.g. some widely-used web library (I forget which) recently switched to using a Rust implementation of TLS, and suddenly you needed a working Rust tool chain available to install it. This caused a lot of grief.

I love Python, and I've been experimenting with Rust and enjoying it so far, but this situation could have been better handled, I think.

I agree 100% about scientific Python though. It's a whole new level of horrible when it comes to dependency management.

Re: Java 21 makes me like Java again

#744

Earlier quoted context omitted.

It seems you conflate the tool and the education about the tool? Why is Java itself bad, because some people (maybe) teach it wrong? Also inheritance as a first lesson with OOP is not bad either, if the follow up is sound. But as far as I know, the concept composition > inheritance was already taught 15 years ago.

If we look at other modern programming languages, some don't even have inheritance. Lets take Rust for example. The language from the get go avoids the trap of deep inheritance hierarchies, by ... not having classes and inheritance! Instead it has structs and traits you can implement for the structs. Behavior separated from structure. They learned from the mistakes or design flaws of the past. Sure, Rust is not perfe…

Ok, you don't have to convince me that Java has many problems, as I intentionally avoided Java for some of those reasons for the last 15 years. But thanks for reminding me of some of them ..

But the concept of inheritance I like. And I use it succesful allmost daily. And like I said, I am aware of how you can use it in the wrong way. And my code surely is not perfect either, but the flaws I have, do not come from inheritance. Those parts are actually very clear, solid and stable. And still flexible.

And Rust is trendy I know. I have never used so far, so it was news to me, that they don't even have inheritance, but to convince me, that Rust has the superior concept, I would like to see it to be used as widely as inheritance languages first.

Re: Java 21 makes me like Java again

#746
post #476

Earlier quoted context omitted.

Yeah, you can list 100 such cases. Let me tell you the most common scenario. I have a fairly popular FOSS CLI tool written in Python. I cannot use the features from the latest version of Python or else I will alienate ~50% of the userbase. This problem does not exist with Rust or Go. This problem would have existed for Java on Android except Google took the burden of "desugaring" the Java 17 code -> Java 8 compatible…

Google dug their own grave here, Java is as backwards and forward compatible as it gets.

You cannot run Java 17 code on a Java 8 runtime without "desugaring."

Re: Java 21 makes me like Java again

#747

Earlier quoted context omitted.

It would be good for my job if learned go, but I've been having a hard time because it's just so boring.

You're doing it wrong if you think programming for work is about the code being a means of expressing your inner soul. The most successful professional programmers derive their enjoyment from achieving business objectives, like making products that users love and improve the world. If you want to express your soul in your code, do that on the weekend using whatever language you want. Trying to mix these motivations i…

> The most successful professional programmers derive their enjoyment from achieving business objectives, like making products that users love and improve the world.

Successful by what metric? Achieving business objectives? I don't necessarily disagree with the point, but this seems like a truism.

Re: Java 21 makes me like Java again

#748
post #708

Earlier quoted context omitted.

Why do I care about any of that while writing python? Those seem like artifacts of a Java based DI system.

It's a reality of any non-trivial program, regardless of the language.

No. Some languages don't require you to play cat and mouse games to get around artificial limitations put there by the language designers.

There was a talk at PyCon a while back about that patterns commonly used in Java were non-existent in Python.

Re: Java 21 makes me like Java again

#749
post #709
post #195

Earlier quoted context omitted.

> This is mostly because applications and libraries are so hard to reason about and understand due to inheritance, packaging, OOP, build tools ect compared to Go. You are just at the early phase of the project. > Go is simple. It's easy to understand, read, and maintain My opinion is that Go is too simple, to the point that it hinders understanding and readability. 4 nested loops with random mutability is much worse…

>>You are just at the early phase of the project. Nah. 99% of the code written out there doesn't need layers of indirection, responsibility tossing around, Code splitting across classes, design patterns, inheritance and the class jungle that is common in Java. Rise of languages like Go is simply majority of the people realising when they want X, they are better of writing just X. You don't have to write a generic ver…

> Most of the times, there are no dozen situations.

After 20 years of building all sorts of software, I know that this a fact, but the challenge is to make others aware of it.

Re: Java 21 makes me like Java again

#750
post #349

Earlier quoted context omitted.

> No, there's a lot wrong with inheritance. No, there is a lot wrong with bad code . No need to blame the language or any programming concept. Note that I say that for all programming languages, not just Java.

[..] a programming language designer should be responsible for the mistakes that are made by the programmers using the language. It's very easy to persuade the customers of your language that everything that goes wrong is their fault and not yours. I rejected that... - Tony Hoare

I feel like it often goes in the other extreme: "if a 2 years old cannot use it, it's too hard".

I am fine with requiring that professionals know their tools, even if I'm well aware that this is not the norm.

Post reply on HN