Live data from Hacker News

Java Is Underhyped

jackson.sh

561–570 of 808 posts

Re: Java Is Underhyped

#561

Earlier quoted context omitted.

But you are not going to get higher performance in Rust/Go.

Rust can literally contain inline asm so yes, you will. But even without that, the startup time is always going to be faster. And for IO, you will get faster perf in Go more easily. Sure, you can finely tune your Java code to get there, but it's a lot harder. It in both cases it will eat up way more memory. There is a reason Google, that did use heavily Java internally, is now moving to Go, a language they custom des…

Well, project loom will make the JVM arguably a better platform for concurrency.

Basically every language is more expressive there (even Java), GC is much much better - in benchmarks it is not as obvious only because Go avoids creating garbage most of the time, but it can’t always be avoided; and the platform is incomparably richer on the JVM side.

Re: Java Is Underhyped

#562

Earlier quoted context omitted.

As a simple example, `x.equals(y)` accepts an arbitrary Object y. This one example has ramifications all over the place, e.g. I had a bug recently where I was checking if an element was in a collection, using `x.contains(y)`. That .contains method seems to use .equals, since it allows y to be any Object. In my case x was a collection of MyType values whilst y was a MyWrapper which I forgot to unwrap. Rather than givi…

Fun fact, this also happens in Scala - try to List.contains an object from a type different than that stored in the list. Compiles, returns false always.

I actually encountered this in Scala (my example originally had [square brackets] rather than ).

My `.has` method uses cats.Eq and is monkey-patched on to the Iterable interface:

    implicit final class IOps[A: cats.Eq](val i: Iterable[A]) {
      def has(x: A): Boolean = i.exists(_.eqv(x))
    }

Re: Java Is Underhyped

#563
post #112

> Java is fun to write, productive What the hell? I don't think we have the same definition for any of these words. I know Java has changed quite a bit since Java 8 (Java 9 being the last version I used professionally before switching completely to Go), but I just can't write Java again, it's physical. When I want to try a new Java feature and think about writing the scaffolding code, my stomach actually hurts. Not t…

"fun to write" give them IDE-driven-developers a text editor and see how much "fun" it is.

Give them text-driven-developers a magnetic needle and a hard drive and see how much "fun" it is!

Re: Java Is Underhyped

#564
post #494
post #408

Earlier quoted context omitted.

> Interfaces in TS are structural, but classes are nominal. Typeguards can be either. Is this true? I might be missing something, but this snippet to me suggests otherwise[0]. [0]: https://www.typescriptlang.org/play?#code/MYGwhgzhAECyCeBhcV...

Sorry, you're right. I was thinking about "instanceof" which is a native JS feature, and it matches classes nominally.

Got you. I was a little disappointed that TS only had structural type checking, but then it's still better than nothing.

Re: Java Is Underhyped

#565
I think the author just hasn't seen enough. There's not a single language that's better than every other language at everything. Java's type system is inferior to ML language's type system. Java's developer experience is laughable compared to Common Lisp's interactive development. A lot of languages have great package managers - Rust and Elixir comes to mind. Also sometimes smaller community with higher quality is better than huge community with average or below average quality. It always depends. I hope the author doesn't turn into a Java monoglot just because other languages are different. Well, problems also differ from one another.

Re: Java Is Underhyped

#566
post #222

The amount of vitriol Java receives in the game development space is rather strong. However, whenever people dismiss Java as being a bad language, I can't help but think of Minecraft. Yes, it's one of the few mainstream titles where Java has been successfully applied, but I believe Minecraft's success was specifically because it was written in Java. With no JVM, there would have been no Minecraft mods at the level of…

> The amount of vitriol Java receives in the game development space is rather strong. Java is a language with mandatory GC, tiny objects scattered around the heap (poor locality), and no value types or low-level memory access. This makes it very poor for games (you know, other very basic ones). But they're rapidly addressing these concerns.

For the great majority of your code base, it doesn’t matter (look at scripting languages inside game engines), and for the performance critical parts, you have excellent profilers and can easily pinpoint which function creates too much garbage and can write that part in an imperative way with arrays and that’s it. It will run plenty fast.

Especially now with ZGC, not even tiny freezes should happen.

Re: Java Is Underhyped

#567
post #334

Earlier quoted context omitted.

"Don't let them use the appropriate/preferred tool for the job and see how much fun it is" is a fairly nonsensical proposal for pretty much every profession.

I can't think of one other major programming language that relies so heavily on the IDE to do the development work, can you?

Let's assume it is. So what?

Re: Java Is Underhyped

#568
post #294
post #284

Earlier quoted context omitted.

> no value types or low-level memory access. i dont think you need value types at all, and you can simulate it by using byte buffers with an abstraction on top of it. After all, what's the difference between value types and a byte array? As for things like low level memory access - you also don't need that in most cases. Graphics libraries will give you enough access. And for any other case, you can always JNI into n…

> i dont think you need value types at all, and you can simulate it by using byte buffers with an abstraction on top of it. After all, what's the difference between value types and a byte array? The difference is a bit like coding in Java vs coding in assembler (more below in an example). > The only reason java gets poor performance is the coder doing java is too used to producing garbage (or is too inexperienced to…

Having thousand NPC objects around is no problem at all. The rendering part is the only thing critical/numerous enough that you may have to optimize to such a low level.

Re: Java Is Underhyped

#569
post #548

Earlier quoted context omitted.

The exact opposite is true. Scala's and Kotlin's syntactic sugar comes with tonnes of overhead and additional allocation. Java is pretty raw compared to them and allows you to stay closer to the C-spirit and thus retain more control over the side effects of the code you write.

You can write Scala to pretty much just look and run like old school Java if you want. I haven't seen any benchmarks, but I doubt a Scala app written idiomatic style would be any slower than the Java version written in idiomatic style. Also, what is this C spirit we are trying to stay close to? I'm certainly not interested in any "C spirit"

The C spirit I'm referring to is the raw, verbose and low-level-ish nature of writing code in C. For high-performance/low-latency Java apps it is absolutely crucial to have this level of control over code and resulting instructions emitted by the compiler. On the other hand - if you don't care about it and want to focus on domain-level stuff you absolutely can. This is what I find the most appealing about Java.

Re: Java Is Underhyped

#570

The amount of vitriol Java receives in the game development space is rather strong. However, whenever people dismiss Java as being a bad language, I can't help but think of Minecraft. Yes, it's one of the few mainstream titles where Java has been successfully applied, but I believe Minecraft's success was specifically because it was written in Java. With no JVM, there would have been no Minecraft mods at the level of…

>> The amount of vitriol Java receives in the game development space is rather strong. I think this is because of the way it handles memory. It's like the clunkiness of C++ without the power to optimize. Also, compared to python it is fast, but not compared to C or Rust. That said, for 99% of applications the Java garbage collector is safe and tends to produce reliable code. The article is right in that Java is an ex…

> Also, compared to python it is fast, but not compared to C or Rust.

It is comparably fast. Much more close to them than to python.

Post reply on HN