114

Let's reinvent java bytecode but... different

you are viewing a single comment's thread
view the rest of the comments
[-] magic_lobster_party@kbin.run 32 points 5 months ago

Java is disliked because it’s designed around flawed OOP principles developed in the 80s and 90s. The code easily turn into a mess if you adhere to these principles, because they’re flawed. If you avoid using these principles, you will still get a mess, because that’s not how Java is supposed to be used.

[-] hydroptic@sopuli.xyz 16 points 5 months ago* (last edited 5 months ago)

Java was such a fractal of stupid design choices in its early years, and a lot of it is still there. OOP except when it's not (int vs Integer, [] arrays but also List et al), no unsigned number types, initially no way to do closures or pass methods around so everything had to be wrapped in super verbose bullshit, initially absolutely dogshit multiparadigm support and very noun-oriented, initally no generics either meaning everything's an Object, when it did get generics they had to do type erasure for backwards compatibility, etc etc etc

[-] magic_lobster_party@kbin.run 12 points 5 months ago

Also: everything is nullable. There are no safety guarantees to ensure you’ve done the necessary null checks. And if you miss your program will crash.

[-] hydroptic@sopuli.xyz 5 points 5 months ago

Oh yeah how did I forget the billion dollar mistake, definitely one of the worst misfeatures of Java

[-] magic_lobster_party@kbin.run 3 points 5 months ago* (last edited 5 months ago)

I think having null is great in some cases where you need to represent missing value. It’s just that there’s no good way to know for sure if you need to do null checks or not. The only way around it is to do null checks everywhere, which no one wants to do because fuck that. Nowadays there’s Optional which solves some of this, but it was introduced way too late.

If I were to redesign Java the first thing I would do is to add a nullable keyword or something.

[-] hydroptic@sopuli.xyz 2 points 5 months ago* (last edited 5 months ago)

I think having null is great in some cases where you need to represent missing value.

Option types or sum types would probably be a much less terrible choice for this, although I guess some sort of nullable keyword counts as a sum type

[-] magic_lobster_party@kbin.run 3 points 5 months ago* (last edited 5 months ago)

Well, anything that can be captured at compile time or by the IDE is infinitely better than the situation we have today.

[-] hydroptic@sopuli.xyz 0 points 5 months ago

Ha yeah, just about anything is better than the current status quo

[-] JackbyDev@programming.dev 5 points 5 months ago
[-] hydroptic@sopuli.xyz 2 points 5 months ago

Great article, thanks for the link! It makes good points that I hadn't really considered; I've probably just been cranky about it because I've preferred heterogenous translations

[-] JackbyDev@programming.dev 2 points 5 months ago

Glad you liked it!

this post was submitted on 05 Apr 2024
114 points (73.4% liked)

Programmer Humor

19138 readers
489 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS