this post was submitted on 05 Apr 2024
108 points (100.0% liked)

Programmer Humor

421 readers
1 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
 

Let's reinvent java bytecode but... different

top 28 comments
sorted by: hot top controversial new old
[–] agressivelyPassive@feddit.de 49 points 7 months ago (2 children)

I mean, hardly anyone complaining about Java does so because of JVM bytecode.

I'm not sure, where the wasm hate is coming from.

[–] anton@lemmy.blahaj.zone 20 points 7 months ago

It all comes from OP.

[–] onlinepersona@programming.dev 5 points 7 months ago

No hate, just a stupid meme. WASM has the possibility of replacing JS in the browser, however it had to reinvent the JVM 🤷 As long as it gets rid of the JS dominance in browsers, I'm all for it.

Anti Commercial AI thingyCC BY-NC-SA 4.0

[–] anton@lemmy.blahaj.zone 29 points 7 months ago (1 children)

The main difference is that WASM is an agnostic bytecode without a gc while the jvm is opinionated in a java way. It has a gc, focus on dynamic dispatch and it has knowledge of concepts like exceptions, classes and visibility.

All this leaking of abstractions means languages like java and kotlin are well suited, scala has hit problems and c couldn't be compiled to java bytecode.

[–] onlinepersona@programming.dev 3 points 7 months ago (1 children)
[–] arendjr@programming.dev 14 points 7 months ago (1 children)

Of course, technically you can compile anything to almost anything. But I don’t think linking to a project that’s unmaintained for 15 years really helps your argument.

[–] onlinepersona@programming.dev 2 points 7 months ago (1 children)

What is my argument exactly?

Anti Commercial AI thingyCC BY-NC-SA 4.0

[–] arendjr@programming.dev 12 points 7 months ago (1 children)

Good question! 😂 maybe I’m overthinking it, but you seem to be making the point that it’s silly for people to like WASM based on the argument the JVM already exists and people are not fond of it/Java. If that’s not the point, why did you make the meme at all?

[–] Iapar@feddit.de 1 points 7 months ago
[–] magic_lobster_party@kbin.run 24 points 7 months ago (1 children)

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 13 points 7 months ago* (last edited 7 months ago) (2 children)

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 10 points 7 months ago (1 children)

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 7 months ago (1 children)

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

[–] magic_lobster_party@kbin.run 2 points 7 months ago* (last edited 7 months ago) (1 children)

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 3 points 7 months ago* (last edited 7 months ago) (1 children)

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 7 months ago* (last edited 7 months ago) (1 children)

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 1 points 7 months ago

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

[–] JackbyDev@programming.dev 5 points 7 months ago (1 children)
[–] hydroptic@sopuli.xyz 3 points 7 months ago (1 children)

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 7 months ago

Glad you liked it!

[–] Dirk@lemmy.ml 20 points 7 months ago

There is an XKCD for that. Replace "standards" with "programming languages".

[–] Rikj000@discuss.tchncs.de 16 points 7 months ago* (last edited 7 months ago) (5 children)

WASM = WebAssembly,
this has nothing to do with Java,
but with JS (JavaScript).

JS works with JIT (Just In Time) compilation, meaning every user that requests a web page, will request the JS and your browser will compile that JS on the fly as you request it.

WASM on the other hand is pre-compiled once, by the developer, when he/she is making the code. So when a user requests a WASM binary, they don't have to wait for JIT compilation, since it was already pre-compiled by the developer.

They only have to wait for a tiny piece of JS,
which is still JIT compiled,
a tiny piece of JS to load in the WASM binary.

This saves the user from waiting on JIT compilation and thus speeds up requesting web pages.

WASM also increases security,
since binaries are harder to reverse engineer then plain text JS.

Due to those reasons,
I believe WASM will be the future for Web development.

No clue why people are hating on WASM,
but I guess they just don't grasp all of the above yet.

[–] Sekoia@lemmy.blahaj.zone 10 points 7 months ago

Having read a significant portion of the base WASM spec, it's really quite a beautiful format. It's well designed, clear, and very agnostic.

I particularly like how sectioned it is, which allows different functions to be preloaded/parsed/whatever independently.

It's not perfect by any means; I personally find it has too many instructions, and the block-based control flow is... strange. But it fills a great niche as a standard low-level isolated programming layer.

[–] onlinepersona@programming.dev 3 points 7 months ago (1 children)

Wasm code (binary code, i.e. bytecode) is intended to be run on a portable virtual stack machine (VM)

WASM wikipedia

Java bytecode is the instruction set of the Java virtual machine (JVM), crucial for executing programs written in the Java language and other JVM-compatible languages

java bytecode

Need I say more?

[–] hglman@lemmy.ml 6 points 7 months ago (1 children)
[–] onlinepersona@programming.dev 1 points 7 months ago

OK

Anti Commercial AI thingyCC BY-NC-SA 4.0

[–] madkarlsson 2 points 7 months ago

WASM is great and as it becomes more accessible it will likely take over more and more

OPs meme is just a sign of someone not understanding the softer parts around development. The meme also seems to forget that we tried java in the browser for two decades and it was just... Horrible from all perspectives, in all layers

load more comments (2 replies)