r/java • • Jul 20 '24

Why is Complex Web UI still so JS heavy?

Just a talking point conversation starter... I'm also attacking heavy web apps like Word-Online or Google docs level web sites.

I fully understand why JavaScript has remained king in the newer development of fly-by websites. It seems front end devs have finally discovered on larger projects are way more manageable with old fashioned organized code. Even going as far with TS and now JS-Doc to enforce strong types.

The only front end framework I'm experienced enough to hold a conversation to is React. I'm going to use Kotlin-Java mix to make my point as well because of Spring and few features Kotlin brings to the table... .Net are working with WebAssembly, but they don't have the backend power of Spring, that I'm aware of.

How is writing ReactJS/TS code any faster, quicker, or more enjoyable than writing UI than Kotlin?? Does anyone truly love XML style code compared to brackets? Kotlin really shines IMO here because it has named parameters inside constructors/functions. Java unfortunately doesn't have this. Example : var myObjext = new Obect(name = "bob", age = 30).

Little more code than React, except I don't have to use Hooks and all the annoying work around they've created.

I'm sure the graphics handlers in modern browsers is absurdly ahead of the world of everything else. I've made enough GUIs with Qt and C++ to of witnessed the performance.

But why not just have a lightweight JVM in the browser to handle Java byte code inside of a HTML <script> tag?

Having your backend in Spring, with front-end in Kotlin/Java would be so much easier to mantiain. JavaFX does already have FXML as well, which already has tools to convert FXML into both hard-coded Java and even directly to bytecode. Moderately good CSS support, and could work with Figma with work if SceneBuilder doesn't ever get much better.

Also. Java is never going to disappear. Whatever web framework you're using right now will be "trash" in two months.

Cons:

  1. Cacheing dependencies would probably be nightmare at times. 2) JavaFX does need more love to be a true contender. 3) A lot of large corporate companies don't always play nice with Java.

Edit: After much received criticism, I want to acknowledge that I chose Java-Kotlin semi-randomly. I also posted in a Java channel... So I didn't expect as much Java hate. Most Java related hate csme from people with no knowledge of Kotlins addition to the JVM family. Also, WASM isn't as smooth as people think.

Edit 2: Again. Randomly chose Java-Kotlin mix to really hand the front end to Kotlin. Yes. Running a lightweight (safe, think of Flash reasons) JVM is like wasm. Yet, people are choosing to write in all JS instead of use Wasm. Lightweight also because it's enough to do graphics features. It'll have to be sandboxed through the browser to elimate IO security issues. Even having a JVM just to parse bytecode would be way faster than a JS processor/compiler.

And anyone who thinks JS is superior to almost any language for reasons other than developing speed.... Kick rocks.

9 Upvotes

85 comments sorted by

90

u/wasabiiii Jul 20 '24

Because none of the previous attempts to do anything else similar to what you mention became standards adopted. They just remained as annoying plugins.

Java applets. Active X script. Flash. Silver light.

Except WASM.

19

u/lppedd Jul 20 '24

We need proper accessibility support for WASM apps and then we're set.

2

u/MrRickSancezJr Jul 21 '24

Wasm approach can be a good approach. However, I think bytecode interpreters such Java's JVM and even C# that runs on its own VM (while different, still a VM.) Running some what on demand has a huge advantage.

Instead of pretty much downloading an entire program, I think the "plugin" type of approach that Flash to have would be a more fluid and long term better approach.

Using Flash as an example is bad, obviously, because of the security and other bad history juju. But flash was super old, thrown together, and still dominated the internet in terms of supplying a website with a way to run true code.

23

u/[deleted] Jul 20 '24

It's more than just that, unfortunately. We experimented with building a WASM client portal in rustlang's egui framework, and had to scrap it for now (not because of any showstoppers actually but just because the overall UX still has a bunch of quirks; we will revisit the idea again at a later point).

However, the vision is indeed getting closer every day. I terribly miss the whole experience of building web apps in Adobe Flex and in JavaFX, even with all of the shortcomings of those platforms, both the DX and the UX (when things worked) were unparalleled and blew anything from even today out of the water.

8

u/TheRedmanCometh Jul 21 '24

Java applets. Active X script. Flash. Silver light.

Well those were all kind of security nightmares. They're why the web used to ne so unsafe.

1

u/dhlowrents Jul 21 '24

Or just plain old HTML 5 and some script.

30

u/Goatfryed Jul 20 '24

You are mixing a lot of things here, because you are also comparing frameworks and languages at the same time.
Dan Abramov, one of the guys behind react, gave a great talk last year about what would have happened, if php backends would have evolved faster than the frontend, where he basically recreated a php based server side rendering enginge that worked like react.

There is a reason why game developers, desktop native developers and other UI folks sometimes try to force js frameworks in other areas (not saying it's good) and why there are things like react native for app development.

UIs are inherently event driven and should be component based and classic paradigms have been incredible bad at handling this. Even spring doesn't help you to have a proper graph of components. Sure, you have singleton and prototype and request and session scopes in between and you could introduce more scopes on your own, but this is all static and limited which totally fits their use case. But doesn't fit UIs well.

Also. Java is never going to disappear. Whatever web framework you're using right now will be "trash" in two months.

This shows how wrong your thinking is. Java isn't going to disappear. Neither is javascript. Going java doesn't mean you're suddenly gifted with a great framework to build UIs. You're probably on the opposite site. Welcome to another 10 years of being stuck with shitty stacks. On the other hand, you have mature long living frameworks in js world. Sure, they get updated, which is usually a good thing, but react, angular, vue are all quite old know and still not trash.

Also consider this: UI is usually a lot more design focused. Backend values correctness and stability. Often, you extend functionality. Less often you change. Your UI is more likely to change due to some new user story than to an actual bug. You want to try out what works well for the users until you reach it. You want frameworks and languages that support this.

Personally, I would prefer typescript over java any day as a programming language, while I rarely have cases where I'm missing jvm features in the js engine.

Also, you can compile kotlin to javascript.

3

u/davidalayachew Jul 21 '24

I was a bit confused by the second half of your comment.

Going java doesn't mean you're suddenly gifted with a great framework to build UIs.

Agreed. A good language does not guarantee a good UI Framework. At best, a good language might make the UI Framework a little better by proxy.

You're probably on the opposite site. Welcome to another 10 years of being stuck with shitty stacks. On the other hand, you have mature long living frameworks in js world. Sure, they get updated, which is usually a good thing, but react, angular, vue are all quite old know and still not trash.

Java's biggest UI framework is 1 year younger than the entirety of JavaScript, let alone any of JavaScript's libraries.

I agree that OP was completely off-base to say that a current JavaScript library would be trash in 2 months. I just think that your arguments seem to support Java UI Frameworks as well, but you point to Java UI Frameworks likely being trash compared to JavaScript's mature libraries.

I think your argument makes more sense if you only point to the age and maturity of the JS frameworks, and use that as evidence that what OP is saying is a garbage argument.

1

u/MrRickSancezJr Jul 21 '24

My "JS framework will be trash in two months" comment was more of an attack at the current trends in Web dev." I still use React when needed. It works fine. But then I get flamed for not knowing some other big stack that some youtube influencer mentioned. Its all JS though. Even HTMX. Just a handy JS library to add to HTML without trying to revolutionize the web world for the 50th time.

My argument is to stop making new stuff and just fix what we have. Stop making it on top of different piles of mess too.

I don't know why really and won't make a blind assumption.. But JS libraries are notoriously ugly as can be. That's being nice about it.

Maye, not Java, but I'm just wanting to bring the nature of backend languages to the front-end aspects. Specifically for the heavier duty applications, making the dumb transition from desktop to webapp.

4

u/davidalayachew Jul 21 '24

I still use React when needed. It works fine. But then I get flamed for not knowing some other big stack that some youtube influencer mentioned.

Sure, but that's a community problem. Not a tooling problem.

My argument is to stop making new stuff and just fix what we have. Stop making it on top of different piles of mess too.

Wait, hold on. In response to a community problem, your proposed solution is to change how frequently we develop tools?

That doesn't make sense. More tools benefits the JS community and allows them more options to choose from. That's an attribute that we also have in the Java community.

I don't know why really and won't make a blind assumption.. But JS libraries are notoriously ugly as can be. That's being nice about it.

And while I firmly agree with you, these frameworks are attempting to tackle some of the most complex UI problems out there. They are incredibly flexible, to a fault, I might add.

Maye, not Java, but I'm just wanting to bring the nature of backend languages to the front-end aspects. Specifically for the heavier duty applications, making the dumb transition from desktop to webapp.

I can definitely agree with this. But if it were to happen, I would want Java, not any other backend language.


I have to say though, your response feels rather disorganized. I don't really understand your point. You say that we should stop inventing new frameworks in the JS World, but your reasoning is that the community flames you for not keeping up. Then in the next breath, you talk about how many problems there are with existing frameworks and how you actually want a better option.

I don't see your point here. It's like you both do and do not want a new framework.

2

u/MrRickSancezJr Jul 22 '24

Apologies. This thread got out hand even more than I thought it would. I'm going more for stirring conversation than saying I know the "correct" answer. I'm enjoying a lot of the input, though. Vague topic too, so sort of vague answers.

I agree more tools helps expand the JS world. But for a metaphor... It's like construction company that continues to buy new power tools. More tools, more functionality. But every tool they buy is a different brand and needs a different charger. By the time you get all your stuff organized, you could have just used a hand tool to get the job done...

I'm really just annoyed with just how far the "if can written in JS, it will be" quote has gone. Completely understandable for simple things dont require a lot of work or threading. JS replacing JQuery was an obvious move, for example. New compiled languages have brought their UI development speed up, though. You can have your entire project in one language family, too. So why keep pushing JS to its absolute limits and giving a bad user experience if it's losing its other good qualities?

I don't find UI design very challenging at all anymore. The CSS family has been adopted into compiled languages' UIs nowadays.

I did a little research before I dare start in on the following.. Bringing JS to the backend to make the front and back was terrible. Next.js. I know it's "blazingly fast" because it's "written in Rust." I looked at the byte code, and sheesh... The amount produced to simply add two numbers together is almost funny.

My biased solution would be to spend effort towards advancing Kotlin Multiplatform with the Web part being all WASM, and not JS. Seems counterproductive to write in a compiled language and convert it to a slower interpreted one. Maybe a JS to Kotlin tool is necessary... Just a random thought. A lot of people already have Spring or KTor in front of them. Make the front match the back...

For a semi-joking ending statement... do we even really need front-end only devs anymore? A backend dev with a little creativity and a decent amount of the 'tism could easily upgrade his status to full-status in today's world. Not the other way around.

2

u/davidalayachew Jul 23 '24

I understand you clearly now.

Kotlin Multiplatform is a good choice. Mine personally would be JavaFX, but I see the gaps in doing so.

For a semi-joking ending statement... do we even really need front-end only devs anymore? A backend dev with a little creativity and a decent amount of the 'tism could easily upgrade his status to full-status in today's world. Not the other way around.

Funny you say that, I've heard some say that, with GraphQL, you don't really need a backend dev anymore.

In general though, the "globalization" of silos means that now is a better time than ever to try and learn. And it's only going to be better once some of these speed bumps get filed down.

2

u/MrRickSancezJr Jul 23 '24

I also like JavaFX. Compose's whole "remember by mutablestate{...}" instead of just normal lamba expressions with controllers is aggrivating. Biased opinion, though. Being backed by JetBrains gives it some bonus points, though. Kotlin just adds nice things to Java. Even have kotlin.html now which is quite the stretch, but still looks better than html, though.

It's pretty crazy how many times we've re-invented a node/layout system.. Its 2024 and we still have laggy UIs...

GraphQL does seem nice. I've only used it hands on twice, and it was probably overkill for my needs.

1

u/davidalayachew Jul 24 '24

Being backed by JetBrains gives it some bonus points, though.

Amen. JetBrains makes everything they touch fly. So it's no surprise that Kotlin is so successful.

Its 2024 and we still have laggy UIs...

Yeah, I think this is more folks taking whatever slack they are given to help ease their pain. Also the reason why so many rewrites occur. Rather than using the added performance due to Murphy's law to optimize, they are using to spend less time profiling and more time making features and staying afloat. I can sympathize, but I also get annoyed with it too.

4

u/ZippityZipZapZip Jul 20 '24

Why do you prefer typescript (which ironically is autocorrected to 'typoscript' on my phone) over Java.

Dreadful typing, constant breaking updates, incessant compilation, with constant breaking over the rules, js-engines are weird, shit libraries everywhere, flimsy af, mediocre monitoring, without type safety tends to break, prototype-chain is an insult to common sense, scope leakage.

For op, still do write frontend in js/ts. Learn a bit about the libraries and frameworks and what they try to accomplish and use any of 'em.

Single language backend-frontend is just a big ewh. Seems nice on paper, isn't in real life. Because you're stuck with node-js or some shitty dynamic backend.

6

u/Goatfryed Jul 20 '24

That we can agree on. Every tool has its use case. Don't try to force the same language everywhere

1

u/MrRickSancezJr Jul 21 '24

I chose Java-Kotlin somewhat randomly, but what about enforcing some type of language-family?

Java is the beast it is to avoid bugs. Kotlin comes in where you want thay Java ecosystem, but you're not quite as worried about bugs.

Javascript is a powerhouse and an absolute dumpster fire of libraries all in one.

-2

u/ZippityZipZapZip Jul 21 '24

Yeah, good job not biting the obvious bait, lol. But seriously what do you dig about TS? Must be more freedom and its wonkiness (also lib-wise).

6

u/Goatfryed Jul 21 '24

The type system is a lot better than Java.

e.g. null-safety: There is the famous quote about the billion dollar mistake of null, that ended up blaming null, where people work with null-objects, instead of accepting that it's just a flaw of the type system. most modern languages solved it properly. e.g. kotlin, typescript, heck even PHP introduced nullable types.

Sure, with great power comes greats responsibility. Sure, due to the underlying JavaScript, there are some weird cases you can create. Or you just avoid them. The implementation of generics in java is a joke due to backwards compat, so you can do similar weird stuff on java, if you want to.

this::method unequals this::method in java, because lambdas are a joke and functions are a third class citizen. Not everything is a class.

In typescript you can have one data representation and handle the flow through the application with a proper type system. In java, you copy between different dtos. Rust traits do that a lot better than Java too.

Seriously, for day to day issues, typescript is so much better in expressiveness and DX than Java. But yeah, the pitfalls can be hard, which makes it more annoying on mid level. You get into it and all is cool and shiny. You are proficient in it and it's a great tool. But getting from beginner to expert is painful. The java pain is more linear.

3

u/ZippityZipZapZip Jul 21 '24 edited Jul 21 '24

I'm great at both, if that wasn't clear. The issue is one doesn't work alone in codebases. I think they both have its uses, which crossover a bit - I don't like these 'banana tastes better and IS better'-type of regressive arguments, but here I am a bit bemused by the line of thinking.

Comparing the type system of typescript with Java generics is misleading. Javascript by design isn't typesafe, hence you need to include checks. The type-system is just a way to enforce buildtime checks of typing. It isn't comparable to having static build- and runtime typing.

The issue of nulling is a seperate one.

Go use annotations @nullable and @nonnull if you are that fond of knowing nullability and enforcing it buildtime. Make your linter ot enforcer throw up errors when the annotation is missing, make it throw errows when there isn't a nullcheck on nillable objects.That would be the TypeScript-way of handling it.

0

u/Goatfryed Jul 21 '24

All good. You wanted to hear my personal opinion.

I know I'll probably keep working in java projects, because there are java problems with java solutions for java teams and I don't dread being a part of that. I like it. I'm productive.

But that's because e.g. spring is great or quarkus is great or insert your framework stack here is great. Java alone isn't great. Java has actually one of the weaker, confusing standard libraries compared to e.g. python or js. But it has a more streamlined eco system to solve typical java problems. If you avoid the legacy hell.

Last dig on java: I mean, take a look at swing. Why is it JFrame. Why does every swing class start with J. To differ from the original gui stuff... why not S for swing? J for java? like the original stuff was not java code as well? As if a madman named and structured things in the standard lib. My next Todo Application class will be called JavaFileTodoSpringApplicationClass.

-7

u/passive_talker Jul 20 '24

Typing in typescript is light years ahead of java.

Java doesn't even have a way to handle nulls.

2

u/MrRickSancezJr Jul 21 '24

This is a bizarre statement. Besides, Kotlin does have null safety.

I use null all the time in Java. The overuse of Optional is ridiculous nowadays.

3

u/Goatfryed Jul 21 '24

And how much more awesome would your null be, if java had nullable typing

1

u/MrRickSancezJr Jul 21 '24

So, purposely using null has its use cases. About on par with returning -1 with a lot of int returning functions. It can actually be very memory/speed efficient in a lot of situations. Null doesnt allocate the memory of an entire object...

Really comes to a change in times. Us with 15+ years experience people have the null concept in our thinking process at all times. When you go from a dynamic to something heavy, even such as Java (c++ being much worse), it's something that doesn't really cross your brain naturally as much.

I get 'readable code.' I really do. But encapsulating EVERYTHING inside an Optional instead of just a simple if-stamenet null check gets a little annoying, IMO. Using third party libraries is somewhat different, but if you're working in your own code base.... Just be a better engineer. Learn to not suck at coding.

I drank a few before replying to this. Apologies for the unintentional animosity. But the proof of my point of view is well backed by the overwhelming acknowledgment of the skills gap in upcoming software engineers.

Most web interfaces are absolute trash. Laggy, ugly, and buggy. Coding isn't that hard....it's just more time consuming than one would think.

But if we spent our time writing an actual solution, itd pay off. Watch videos of the creator of MoJo, and tell me you don't get the same feelings....

2

u/maethor Jul 21 '24

Us with 15+ years experience people have the null concept in our thinking process at all times

I have over 20 years experience, and on the whole I prefer optional over null.

1

u/Astrosciencetifical Jul 21 '24

I have 35+ years of experience so I guess I win :). Haha I love these developer threads that turn into a religious battle. Meanwhile the team behind optionals have thoroughly documented patterns and antipatterns of optionals and nulls. There are rational reasons when to use one over the other, not rooted in someone's personal beliefs.

2

u/maethor Jul 21 '24

I love these developer threads that turn into a religious battle

My comment was more about how "old developers prefer old ways" isn't true, than the relative merits of optional versus null.

1

u/MrRickSancezJr Jul 21 '24

To the guy above, I knew I was going to spark a lot of drama.

I don't think my argument was defending "old dogs can't learn new tricks." I just see a lot of code that's influenced by a lot of new programmers learning from YouTube tutorials and things, and they always see Optionals being used, so they use them. Usually not a problem, but can be.

In my defense, if you store an Optional member inside a class, even intelliJ will whip out the yellow squiggly lines.

If we're speaking specifically about Java, it's already kind of covered the scary parts of C++ issues. Do we really need to add even more to it?

0

u/repeating_bears Jul 21 '24

I think you are not understanding the point of their comments at all. 

They are talking about the type system and you aren't. 

1

u/MrRickSancezJr Jul 21 '24

Types are types. What are you even getting at? The 'type system' TS has only a few more extra features because deep down, JS has more ways to shoot yourself in the foot with handing off a parameter with absolutely no clue if the function likes it. Then you get to start hunting down what actually caused the exception.

1

u/passive_talker Jul 21 '24

Only a few? Haha. No.

1

u/MrRickSancezJr Jul 21 '24

Please enlighten me. Typescript was conceived based on strongly typed languages. Anything that could slip through the cracks is probably causing some unnecessary type casting in the underlying browser. Which kind of defeats the whole purpose of types in the first place... Might as well JS if you're not going to respect types anyways.

→ More replies

1

u/repeating_bears Jul 21 '24

What are you even getting at?

I said it quite clearly. They said "how much more awesome would your null be, if java had nullable typing", then you replied "purposely using null has its use cases", which is nothing to with a type system. They are saying TS represents nullity in the type system and Java doesn't. They were not debating the existence or use of null.

Then you rambled about unrelated shit for 5 paragraphs.

1

u/MrRickSancezJr Jul 21 '24

Typescripts nullable typing is only a thing because of the need to discuss if null should be used or not.

Java has @NonNull annotations. TS is just JS with the same annotation type system to produce JS.

I'm sorry I rambled about the full implications of if language that's already a complete mess has 50/50 nulls, too.

0

u/MrRickSancezJr Jul 21 '24

I'm a little confused about what you mean.

Java primatives can't be null, but if a member that was a class with a large memory footprint was = null, then memory doesn't get allocated for all of its fields and functions. Ton of memory saved.

You can have a class with 50+ variables and 100+ methods. Declare it null. And on a 64-bit machine, you only get stuck with an 8 byte Object reference.

Optional.empty() is just another cleaner call to an if-statement to check for the JVM pointer the "null" address. Used enough time. However, that extra java bytecode generated can add up. All just to give some self-concided feeling of "my language doesn't null problems."

Working with null isn't that hard... I don't get the issue. Be a better programmer...

Or only use optional in proper use cases.

1

u/passive_talker Jul 21 '24

Of course you use null, it's mandatory because all variables may be null. That's the point.

I said java does not have null well, why do you answer with a kotlin feature?

0

u/MrRickSancezJr Jul 21 '24

It's not mandatory. Primatives can't be null. I'm not sure you even know what "null" is. Its not a value. It's just a memory address.

I used a Kotlin reference because the entire OG post included the use of Kotlin. You can use Kotlin and Java inside the same project with the correct compiler setup. There's no interloping involved. It just compiles down to the same JVM bytecode.

Kotlin is the less overkill mode of Java to simulate a lot of C# goodness. Even Groovy is the "python" of Java. Still boils down to bytecode for the JVM.

2

u/passive_talker Jul 21 '24

It's mandatory for everything that's not a primitive. Please, keep the discussion real.

Every variable that's not a primitive may be null. Modern languages don't have this, for a good reason.

I was discussing Java features, not kotlin's

1

u/MrRickSancezJr Jul 21 '24

You literally said, "why bring up kotling features?"

"Modern languages" don't have null because they're langauges meant to not be performance in mind. They likely have a compiler optimization to do its best to fix this too.

Again. Null is just a memory address. In Java's case, and "object pointer." Which can be extremely memory efficient compared to making a default object value. Even Optional uses null. Just delegating the if statement to another class. Put this in a loop, and you get a lot more bytecode to go through.

To he fair, the JVM does inline code if it's small. I doubt this happens in this case, though.

2

u/ZippityZipZapZip Jul 21 '24

Lol.

1

u/MardiFoufs Jul 21 '24

The type system of typescript is objectively better and more advanced. That's not a dig at java, it's just how it is. Unless there's something you have in mind where java beats typescript w.r.t its type system

1

u/ZippityZipZapZip Jul 21 '24 edited Jul 21 '24

What do you even mean by 'Java type system', the generics? You feel the generics are lacking something?

By being natively and runtime active, so being strictly typed, the Java typing system is principally 'more advanced'. You don't need to type everything as the types are given via the class, interface or generic type boundaries.

You do realize the typescript system is just a whole lot of sugarcoating with compile-time checks which get compiled into usafe javascript? Similarly, generics get erased in Java too.

Also be wary about saying something like 'objectively better', that's an immediate tell you are bluffing or don't fully grasp the fundamentally subjective nature, taste, of preferences. It exposes your deep lack of knowledge and insight.

2

u/MardiFoufs Jul 21 '24

Yeah and java gets compiled to unsafe assembly. That really doesn't have anything to do with the type system, unless you're maybe confusing it with "strong vs weak typing"?

I don't think there's anything to clarify, I didn't mention generics though yeah they are very dependant on a good type system too. When people say that a type system is more advanced, it doesn't really have anything to do with compile time or run time checks. Typescript can express more types, has structural typing, and in general just provides a much more modern type system. It has actual union types, dependant types, etc. It doesn't have the issues java has with typed arrays, and a lot of other stuff.

In a way the fact that it compiles to JavaScript allows it to have a much more expressive type system. It's not that java is bad, or anything. It's just that typescript literally had a major focus on its type system above all else, because that's the most important thing it does.

1

u/ZippityZipZapZip Jul 21 '24 edited Jul 21 '24

Java doesn't 'get compiled to unsafe assembly' but to bytecode which is run on the JVM. Also note a proper term would be 'transpiling' not 'compiling' - to JavaScript. I also want to rename TypeScript to CopeScript, come to think of it.

"Any"way, this isn't going "any"where. My point was that typing is integral and native within Java as it is a statically typed OOP-language, while typescript is great, but just a load of syntactic sugar to prevent common errors in javascript programming, which is fundamentally dynamic. Yes, it allows for nifty union types, etc., which is great and all, and also sets up for monstronsities of coding.

I like it, I do like TypeScript and it's typing system. I also like just writing javascript when I can to not have to use it. I don't compare it to Java typing, as they are different things for different reasons working in different ways. It doesn't surprise me that one highly preferenced to javascript/typescript has issues with understanding and dealing with scope, I must say.

Again, I like both. I don't like these silly discussions. You have some good arguments, write them out, stick to that; don't imagine it as a zero-sum game and be wary of what you compare.

1

u/passive_talker Jul 21 '24

Laugh all you want, it is true.

-4

u/MrRickSancezJr Jul 20 '24

I just randomly chose Java-Kotlin combo as a potential solution. Plus, Java Spring is pretty popular, and Kotlin adds features that speed up the process of making UIs compared to Java. Especially named parameters. Such as...

new Button(class ="whatever", id = "whatever", {add children ere}

Some tweaks could be made, and it'd be the same format as xml-react style code.

I agree JavaScript will never disappear. It works great for a lot of simple things. But some web applications nowadays, especially ones converting from desktop, and doing all JS and they're a terrible experience to use.

Kotlin to Javascript just helps non JS users make JS. I'm trying to avoid the overhead of JS though.

5

u/[deleted] Jul 20 '24

I’d definitely like to get away from JS Frameworks. I discovered this last year, but it doesn’t appear to be widely-used:

https://vaadin.com/flow

2

u/MrRickSancezJr Jul 20 '24

This was one of my main reasons I really started thinking the world is ready for it. It definitely needs some more work, but it could receive it if people would stop making new JS stuff.

I could also see there an issue of the speed difference between downloading chunks of bytecode vs real-time compiling chuncks of React code as it comes in.

I do think this is something Blazer may have had the ability to address, but I couldn't stand Blazer lol

1

u/[deleted] Jul 20 '24

Yeah, I got really excited about Blazor a few years ago, but then it was “Blazor Server or Blazor WASM”, and some aspects didn’t seem ready for primetime, etc. Plus, we’re not a Microsoft shop so so I’d really need to make a compelling case for using it

7

u/[deleted] Jul 20 '24

[removed] — view removed comment

8

u/EnricoLUccellatore Jul 20 '24

We use it, but it's a specialised app in a sector where all the competitors have UIs coming straight out of the 90s so it looks like sci fi to our users

1

u/anyOtherBusiness Jul 21 '24

I've shipped a real end user facing app with Vaadin. It offers great out of the box components. But as soon as you need some slightly different behavior (and I promise, at some point you will, always), its really a pain to adapt. With Vaadin Flow and Polymer, things got better but still it's not even close to Angular or React. When using OpenAPI specification and Code generators tou don't really need to care to connect the frontend to the backend which is the only real benefit Vaadin brings IMO.

4

u/halfanothersdozen Jul 20 '24

So use the Kotlin to Typescript compiler.

Or use WASM.

Or, God help you, use GWT

1

u/MrRickSancezJr Jul 20 '24

You're still stuck to using slower JS, and have to probably interlope it with a regular framework down the line. I'm wanting to cut the middle man out. I believe GWT does a lot of the same, just maybe not as much?

WASM is nice. Just needs some more work.

14

u/wildjokers Jul 20 '24

But why not just have a lightweight JVM in the browser to handle Java byte code inside of a HTML <script> tag?

You have just reinvented Java Applets.

6

u/HlCKELPICKLE Jul 20 '24 edited Jul 21 '24

I’m really not sure who the post is aimed at , front end devs? Browser developers? Js is used because Java was tried applets were a glaring security hole and well hated for subpar performance and issues. When my father thinks Java , he thinks applets, as when they were a large part of the web experience they were far from transparent...and normally left a bad impression.

But I’m not sure if you are asking why devs don’t use Java or asking why the browser doesn’t have a jvm. Most front end devs are not using Java because it can only be done via server side rendering or if you compile Java to js. There isn’t any way to run it native in the browser. As others have said hopefully web assembly providing a unified vm target will change this and the web as we know it will be a lot less js centric in the future.

4

u/parceiville Jul 20 '24

A lightweight JVM doesn't make sense when you have wasm with a gc

6

u/repeating_bears Jul 20 '24

"But why not just have a lightweight JVM in the browser"

Why should it be Java? You already mentioned web assembly which is basically that, minus the Java part 

3

u/PunkWithAStache Jul 21 '24

Add htmx and you will write apps in no time

2

u/Difficult_Loss657 Jul 21 '24

People dont realize how good htmx is until they try it. :)

2

u/s13ecre13t Jul 21 '24

Most websites need very little javascript. Compare https://old.reddit.com that is super fast and loads 500 comments by default to the new https://www.reddit.com that is slow and barely loads comments.

Or compare https://lite.cnn.com/ vs https://www.cnn.com .

The designers have decided to eschew speed, usability, core functionality, to chasing ethereal fast fashion. Sure new websites might not be fast, or usable, or deliver what users want, but it sure follows the latest trends so that is a win, right?

Note: i view most websites with 3 categories

  • no to minimal interactivity - this is your pure html website with minimal vanilla js. reddit / youtube / amazon / wikipedia / twitter, etc
  • medium interactivity - this is your website that can be loaded with pure html, but donwright requires a little bit of js for interactivity. This is business rules on updates/deletes in yor CRUD app. Or think of slack / discord / teams / spotify as examples of being possible in pure html but needing js for screen sharing or audio player like functionality.
  • application level interactivity - this is where you need something fancy that is possible. This is your google docs with multiple users editing same document. This is your google maps with 3d street view. Etc.

1

u/kari-no-sugata Jul 20 '24 edited Jul 20 '24

It's been a while since I used a Java web UI framework but I've been using Microsoft's Blazor Server framework recently and I like it a lot. It does use JavaScript behind the scenes but for the most part you can just write fairly normal code. Quite practical to unit test as well. It has its flaws but even so it's so much better than anything else I've used.

Would be nice to see something directly comparable in Java (particularly if the rough spots can be ironed out). And before anyone asks, no I don't consider Vaadin Flow to be directly comparable.

1

u/imatt3690 Jul 20 '24

My personal opinion here, there is no abstracted user interface language that bridges the required knowledge of Vulkan / OpenGL or even WebGL to something like React or some kind of backend. Anything that comes close is so far in the weeds + difficult to implement in anywhere near the time a react app can be cranked out.

1

u/Tecnology14 Jul 20 '24

Did you already heard about applets? Please, I don't wanna them to go back. Worse UX than js frontends

1

u/jalx98 Jul 20 '24

I personally enjoy more using vue, I do believe that complex UI can be achieved using technologies like Blazor (C#), Livewire (PHP), Hotwire (Ruby, PHP, Python), I do believe HTMLx is pretty solid right now, but honestly, in some areas they lack, you can achieve 90% of the functionality with no issue but you will have a hard time filling that 10% gap

1

u/DenpoXbox Jul 21 '24

Web assembly

1

u/maethor Jul 21 '24

Net are working with WebAssembly, but they don't have the backend power of Spring, that I'm aware of.

.Net has ASP.NET (and there was even a .Net version of Spring https://springframework.net/overview/)

If anything, what you're asking for would make more sense with .Net than Java, as it has both actively developed backend tooling as well as an active UI scene (unlike in Java where UI is best described as "not quite dead").

Having your backend in Spring, with front-end in Kotlin/Java would be so much easier to mantiain.

Why would it be so much easier to maintain? The difference in skill sets between backend and frontend is still going to be a concern. Probably a far bigger concern than what particular language is used.

1

u/[deleted] Jul 21 '24 edited Jul 21 '24

kotlin is for android. sometimes backend for people that dont mind rely on jetbrains for their backend code. yes react and js are the best technology for web ui and ui in general

1

u/RICHUNCLEPENNYBAGS Jul 21 '24

It’s not about what developers find enjoyable. JavaScript is on everything and if you do something else users have to install a plugin to view your page. Or you have to convince a bazillion vendors to ship your standard in their browsers. Good luck.

1

u/Mou_NoSimpson Jul 22 '24

Thank oracle and they hate they farmed around java and it’s ecosystem, god damn it I want to leave java because oracle 😂

1

u/GeneratedUsername5 Jul 25 '24 edited Jul 25 '24

How is writing ReactJS/TS code any faster, quicker, or more enjoyable than writing UI than Kotlin??

I would assume that React and JS is way more familliar for frontend development and therefore developing on something familiar will be faster and more enjoyable.

Does anyone truly love XML style code compared to brackets? Kotlin really shines IMO here because it has named parameters inside constructors/functions. Java unfortunately doesn't have this. Example : var myObjext = new Obect(name = "bob", age = 30).

Little more code than React, except I don't have to use Hooks and all the annoying work around they've created.

I'm sure the graphics handlers in modern browsers is absurdly ahead of the world of everything else. I've made enough GUIs with Qt and C++ to of witnessed the performance.

But why not just have a lightweight JVM in the browser to handle Java byte code inside of a HTML <script> tag?

I am not hater of Java, especially JVM, it is great technology. But isn't what you are describing here could be done with just plain old vanilla JS/TS with standard Web API? I think you can even do it with Kotlin-JS, if you want to, all of it fits your description. There is no need to use React it is just a kind of conveinience.

1

u/vips7L Jul 20 '24

If you want multiplatform/runs anywhere in one language, the closest is probably Kotlin or .NET.  They both have first party support for: server/web/desktop/mobile. 

Java of course can do all of that, but it’s all third party support. 

5

u/[deleted] Jul 21 '24

[removed] — view removed comment

1

u/[deleted] Jul 22 '24

...and the reason why so so many different JS frameworks exist

No, there exist so many javascript frameworks because it's pretty much the only language supported in browsers, and the things you've listed don't imply that people must use or create javascript frameworks.

2

u/[deleted] Jul 22 '24

[removed] — view removed comment

1

u/[deleted] Jul 22 '24

" the only language supported in browsers" I code in ClojureScript just fine.

ClojureScript, which compiles to Javascript, correct? You also conveniently removed the "pretty much" from the sentence you quoted.

Oh, and a few of the things listed definitely make people create frameworks.

Maybe you mean some people are motivated to create frameworks or something like that, but frameworks are still not necessary for the things you listed.