Live data from Hacker News

Java Is Underhyped

jackson.sh

291–300 of 808 posts

Re: Java Is Underhyped

#291
post #284
post #222

Earlier quoted context omitted.

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

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

Why even use a high language at all when you can just write the assembly directly? Clearly you can write "Java" that is patently unsafe in an effort to eke out some performance, but this is not what most people would consider reasonable or desirable. When writing Java, you almost always want to go with the flow, and that at the moment means creating objects. The general fix for this is to have good abstractions for places where heap allocations can be elided, not dropping down to lower-level primitives in an ad-hoc way.

Re: Java Is Underhyped

#292

Earlier quoted context omitted.

Yes, but that's my point. If I don't need performance, Python is ok. If I do, I won't go Java, I will choose something that is built for performance. Python is good enough for 99% of my performances need. The last 1%, jumping to java is not a big difference, I'll use rust or go. I won't use go for the ecosystem, but it's unique characteristics: easy concurrency, dead simple binary production. Java can't beat that. IF…

Java is orders of magnitude faster than Python for code that doesn't spend all of its time waiting for IO. Java perf and Go perf are about the same.

Even IO heavy code, it is much easier to write multithreaded async code for the jvm than it is for python

Re: Java Is Underhyped

#293
post #256

Earlier quoted context omitted.

I think of Java as hitting an 'anti-sweet-spot': - It forces us to go through the ceremony and verbosity of static typing, yet blows away lots of the benefit by pervasive use of `null` and `Object`. Compare this to ML or Haskell, where there's less ceremony (Hindley-Milner type inference) yet more safety (no `null` or down-casting) - Checked exceptions have a similar ceremony and verbosity problem, yet the pervasiven…

> pervasive use of `null` and `Object` Who is pervasively using Object? You are talking about a language that hasn't existed for a decade.

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 giving a type error, this check was always returning false.

Since then I've defined a .has method which requires the argument to have the same type as the collection, which completely avoids such problems.

Re: Java Is Underhyped

#294
post #284
post #222

Earlier quoted context omitted.

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

> 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 write high performance java code).

Read about Entity Component Systems, the leading architecture of high-performance game engines these days.

To do this in Java, with the implied memory locality, would basically mean storing your entire game state in bytebuffers, and constantly unpacking and packing them to do any operation on them. And when you unpack them if you unpack them to a random object in heap, you negate the entire purpose of the locality of a bytebuffer. So you somehow need to do the job raw, reading everything inline and putting it back inline, so you can stay on the stack.

I also doubt that the get/put calls you'd need to do to get/set every number would be free. So performance would probably end up quite terrible.

> you can easily avoid most performance problems in memory by pre-allocating and reusing memory by pooling.

If you make an object pool in Java you'll save on memory alloc/dealloc. You won't achieve memory locality, so your code will be much slower than languages where you can do that.

Re: Java Is Underhyped

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

I used to feel like you, but I have come back to Java.

Other languages have other pains, for example I have physical revulsion against the version management hacks for python or ruby (rbenv and stuff like that - somehow hacking environment variables on the fly to manage multiple installations of the language).

Two years ago I wrote a small web app in Python and I found hosting very complicated, compared to Java. PaaS exist but are very expensive.

Re: Java Is Underhyped

#296
post #29

Earlier quoted context omitted.

You can write verbose code in any language, but most other languages don't consider it normal to name a class LangDetectLanguageIdentifierUpdateProcessorFactory. (Random example from an open source framework.)

Eh, any sufficiently large or complex codebases will get ridiculously long names at some point. Here are some from a famous C API (Windows): CoMarshalInterThreadInterfaceInStream D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE_UNGUARDED_VALIDATION RtlWriteDecodedUcsDataIntoSmartLBlobUcsWritingContext Or how about: GtkColorSelectionChangePaletteWithScreenFunc The alternative is things having names that aren't actually de…

Or have a good package system... If you use a language with import with aliases, you don't need all that noise.

Re: Java Is Underhyped

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

> Java simply feels good to write. A lot of this is due to the craftsmanship JetBrains puts into IntelliJ IDEA.

You can put it another way and say it doesn't feel good to write Java without JetBrains.

Re: Java Is Underhyped

#298
post #288

Earlier quoted context omitted.

Well, if we create a desktop app, the Python + C bindings will be a better choice for my own project. Easier to dev, equivalent perfs, equivalent libs (and the QT Rad is excellent). Java does have android right now, although it has to share with ReactNative, Xamarin and flutter. Again, for different compromises.

So apparently Rust isn't that better than. Java also has the IDE ecosystem between Netbeans, Eclipse and all JetBrains offerings, with exception of Apple and Microsoft offerings.

It's not a matter of better. The original comment is all about what compromises work for me, and why I don't have a use case for Java.

You are trying to move the debate toward the quality of java, which is was never my point.

Re: Java Is Underhyped

#299

Earlier quoted context omitted.

I write software in Java. I can't stand python - too wishy-washy. But my main complaint about Python is trying to use someone else's software. Then it degenerates into a maze of twisty little passages of trying to install the correct set of dependencies, not knowing where those files are installed (which makes it difficult on a cluster, as you may need to do the install on every node separately). Then you try using p…

Java is so much worse on this front. > with Java, you just dump the necessary jars into a directory, include them in the classpath, and it works. Ant, maven, or gradle, and then some jars, somewhere? What's the classpath and whats $JAVA_HOME for this project? Oh and now I have to make it work in the IDE too, click through a billion menus and dialogs, sync the build system, sync the dependencies, configure runtimes an…

Nobody has started a project with Ant in the last decade. Of all the Java projects on Github Ant is probably not even 1%.

> Oh and now I have to make it work in the IDE too, click through a billion menus and dialogs,

You click "Project from existing sources" in IntellIJ and it will recognize both Maven and Gradle projects and just work?

Sync the dependencies? configure runtimes and classpaths? What? With Maven and Gradle? Your talking Ant here.

Re: Java Is Underhyped

#300
I have programmed in Python, Ruby, JS, C, Go and Java. The main reason Java receives so much flak is because it's setup is not beginner friendly. JS, Python, Ruby make it so much easier to just write a program and run it. Naturally, any novice programmer would quit Java in the setup process itself. It's not easy in Java to just write a program and run it instantly.

But once you are through that painful process, there is no other ecosystem more stable than Java. Things don't move too fast and that's a good thing for production applications.

I do dislike the verbosity sometimes while doing something that would take just a few lines in python or ruby. But IntelliJ more than makes up for it.

Post reply on HN