[flagged]
Java 21 makes me like Java again
81–90 of 777 posts
Re: Java 21 makes me like Java again
#82[flagged]
so, which lang would you use personally? > you still have threadpools and os threads. why this is a bad thing exactly?
Java, whether it be spring, micronauts, jee, whatever, is wasting CPU and Memory in the cloud costing you and/or your enterprise money.
Re: Java 21 makes me like Java again
#83Earlier quoted context omitted.
> I rarely see inheritance used in practice in java code bases. That seems absurd to me and I have a hard time understanding it, honestly.
If you type everything with interfaces in your codebase, you are much less tied to inheritance. In fact, everyone could be written to be composed. However Java doesn’t support type union so you can get into some ugly and verbose situations but the JVM doesn’t really check type so this is more a compile-time issue and could be fixed in a future Java language revision.
Isn't the "sealed interface" described in the OP blog post a type union? Or you mean anonymous unions?
Re: Java 21 makes me like Java again
#84Earlier quoted context omitted.
This ... is how you make engineering choices?
At work, I have a different context. What is the common denominator of what people know. Personally, the “write once, run everywhere” notion of Java has been replicated with much more productive languages.
Re: Java 21 makes me like Java again
#85The 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.
Honestly, its way too early. Virtual Threads will need a a "killer app" (in this case a killer framework) to pull in devs.
Re: Java 21 makes me like Java again
#86The 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.
`Executor.newVirtualThreadPerTaskExecutor` versus `go` really gets to the heart of why I think that Go developers aren't going to be switching. edit: Sorry, it's actually: try (var executor = Executors.newVirtualThreadPerTaskExecutor()) { executor.submit(...) ) instead of `go`
Re: Java 21 makes me like Java again
#87Earlier 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 a more flexible type system with union types and other magical features, your example problem would be less of an issue.
However Java has an extremely limited type system so there is no middle ground between composition and inheritance. Once you choose one way, there is no “middle step” to migrate over.
Re: Java 21 makes me like Java again
#88Earlier quoted context omitted.
so, which lang would you use personally? > you still have threadpools and os threads. why this is a bad thing exactly?
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 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.
Re: Java 21 makes me like Java again
#89The 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.
`Executor.newVirtualThreadPerTaskExecutor` versus `go` really gets to the heart of why I think that Go developers aren't going to be switching. edit: Sorry, it's actually: try (var executor = Executors.newVirtualThreadPerTaskExecutor()) { executor.submit(...) ) instead of `go`
Re: Java 21 makes me like Java again
#90Earlier quoted context omitted.
Sorry, what? Is not java toghether with Ruby maybe the most hardcore OOP enthusiasts that uses inheritance for "most stuff". Has the java culture move so far the last decade ?
Effective Java, written by Joshua Bloch, and first published in 2001, had a very influential section called Favor composition over inheritance: https://books.google.co.nz/books?id=Ra9QAAAAMAAJ&q=inheritan... Why do you think DI is so prevalent in Java codebases? It's a great way of simplifying composition.
The GoF book (Design Patterns) had the same, somewhere early, like in the Introduction, in 1994: