r/java • • Dec 29 '22

Could Java Applets have been done right? DOM is limiting [CrossPost Discussion]

/r/webdev/comments/zxel5o/could_java_applets_or_flash_have_been_done_right/
5 Upvotes

50 comments sorted by

View all comments

Show parent comment

1

u/vprise Dec 30 '22

This isn't a typical and common scenario. A browser rendering pipeline is a deep and complex process. A desktop app has a similarly (albeit simpler) complex pipeline. You need to integrate both and you need to do that efficiently.

Y2K browser plugins were in a different world. GPUs back then were much simpler. You would use them mostly for flipping buffers. So an "Embed" was pretty easy. It still flickered and caused problems. But it it was all just double buffering to a surface.

Modern rendering uses shaders to anti-alias your vectors with subpixel precision. This is nuanced and different for each platform. It can be impacted by small environmental changes (e.g. rotating the monitor vertically). Now QT etc. solve these things but they solve them differently from the way the browser solves it. They solve it on their own event dispatch thread with their own complexities. Even if you were OK to limit your app to "one square" which isn't enough in a modern browser. It would still look "weird" and different to the rest of the browser. It will pay an overhead for just being in the browser with no justification. Might as well deploy and install the app. In which case I would bring back Java Web Start which was a far better direction (albeit broken as hell).

1

u/Zardotab Dec 31 '22

It would still look "weird" and different to the rest of the browser.

Not if it's built with browser context in mind from the start.

GPUs back then were much simpler...So an "Embed" was pretty easy...[but] Modern rendering uses shaders to anti-alias your vectors with subpixel precision. This is nuanced and different for each platform.

The CRUD-friendly sub-system doesn't really need fancy graphics. It could use something like HTML FRAMESET/IFRAME to draw a pretty version in another (web) panel when needed, perhaps using SVG or Canvas.

1

u/vprise Dec 31 '22

Applets were built with browser context in mind. You can't say "use QT" when convenient and then move to an abstract "browser context" when convenient. You're either part of the browser which is a problem or a plugin on a surface which is a different problem. There are tradeoffs to be made in any approach you will take and unless Google chooses to bring Java into the browser it will always be a second class citizen.

For a simple SVG or IFrame style interface you have TeaVM right now. Works amazingly well. I doubt we can exceed it with "proper" Java.

1

u/Zardotab Dec 31 '22

I'm not sure what your claim is. Are you saying it's impossible to have "good browser context" and a decent GUI at the same time? If so, can you demonstrate a sample inherent tradeoff that will forever muck up all attempts?

If you agree that Java Applets did X decently and that Qt did Y decently, then either a tool can include both X and Y, -or- there is some fundamental tradeoff/limit of UI engine design that prevents X and Y from existing at the same time in such a kit.

For a simple SVG or IFrame style interface you have TeaVM right now. Works amazingly well.

Is there an existing CRUD/biz oriented online UI demo?

1

u/vprise Dec 31 '22

I'm saying that there are two ways to do this: build it into the browser like JS is built into the browser. That is a huge amount of work and nearly impossible without buy-in from google.

Or build it like a plugin (using QT or any other technology you want) in which case it will always be foreign.

The former is unlikely to happen. The latter will deliver sub-par results.

I don't know about demos for TeaVM. It's free. We use it for Codename One, here's one of our older demos: https://www.codenameone.com/demos/KitchenSink/

1

u/Zardotab Jan 03 '23

The former is unlikely to happen. The latter will deliver sub-par results.

If the solution gains enough momentum, one or the other or both will happen. Perhaps pioneer it as a separate GUI browser, Oracle Forms style, and if it catches on, make it a browser pluggin option.

If enough want it, it's technically possible to have such a tool. Oracle Forms (pre-Java) proved that. The big vendors will have to accept it if it gets usage traction.

here's one of our older demos:

That seems like mostly consumer-oriented UI's. That's not what I'm looking for. Your niche is probably different from mine and DOM may be "good enough" for your niche. But rank-and-file biz/admin CRUD is a big niche such that it deserves standards attention, rather than be bowled over by mostly consumer and mobile concerns.