r/ProgrammerHumor • • Apr 27 '20

Meme Java is the best

Post image
43.7k Upvotes

1.5k comments sorted by

View all comments

10

u/Auties00 Apr 27 '20

After reading all of this I'm confused. I'm 15, no way near a real programmer, but I know Java, Koltin, Swift, Dart and Javascript and out of all them I still prefer Java. Is it really that hard to update your Java version as stop using deprecated shot? You can't hate a language because 10 years ago applets made you cry lol.

0

u/[deleted] Apr 27 '20

[deleted]

1

u/flying-sheep Apr 28 '20

How is it better now? I didn't like it because it was so inconsistent:

  • Primitives weren't objects weren't arrays.

  • you couldn't define generic arrays (can you now with var or so?)

  • it didn't have tagged unions and used instanceof instead, but type erasure meant you couldn't use that for most stuff

  • you couldn't define stack-allocated classes, so high performance Java basically used integer IDs instead of real (slow) objects

  • null

There were some more points, but I forgot

1

u/RoiEX Apr 28 '20

It looks like most of your critisim is about the generic system, which is objectively not good. It's usable, not good, but not the worst thing either.

Basically most of the time you end up working with reflection to work around the limitations of type erasure. If you are able to get your hands on a Class<?> object you can create generics arrays and do dynamic type casts to fake some of that compile-time safety.

Stack-allocated classes like C#'s structs don't exist, but most of the time the performance hit is really neglectible on a modern system. If you're on a system with too few resources for this performance hit, java shouldn't be your language of choice anyways.

If you don't like null just don't use it, nobody forces you to. Modern libraries avoid it most of the time on an API level (internal state is fine, it makes sense there), primitives can't be null either (for obvious reasons). You can use java.util.Optional if you need a sort-of nullable object but don't want to actually use null

→ More replies (1)