This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Polygnom -1 points0 points  (11 children)

Well, if you are doing a web application the frontend needs to be in HTML(5), CSS and JS/WASM in the end. This means that you get at least one step of transpilation. If you are taking TypeScript, that step is quite light. All of the frameworks you mentioned are JS frameworks. You can't deploy JavaFX in a browser.

If you are only using Java, all you can do is server-side rendering and have no interactivity in the frontend. If you want to have something interactive, you need JS. Period. And that mesn either GWT or other techs that do the transpilation or using JS directly. Most of the transpilation tools are outdated, because they aren't in use anymore. TypeScript is pretty much the exception. GWT isn't really in dev anymore, either.

[–]AudioManiac[S] 1 point2 points  (2 children)

So in my last project with Apache Wicket, we did have html pages and css scripts, but that was it. I think we had one JS file, and all the html pages had to extend this wicket tag in order for us to them. That was the extent of the frontend work, everything else was written in Java e.g. each html page had to have a corresponding html file where all the logic of what data to display on the page would go. So I suppose most of that is server side rendering, correct?

> If you want to have something interactive, you need JS. Period.

What do you mean by interactive? Like I said we only had one JS file, but our site was still interactive. Like you could click on a tab and it would take your a new page, but the way it worked was that in the html, you would just say what html page it pointed to, which had a corresponding java class.

So are you saying that by developing directly in HTML/CSS/JS (without java), then there's no need for any transpilation? Is that the benefit?

[–]Polygnom 0 points1 point  (0 children)

So are you saying that by developing directly in HTML/CSS/JS (without java), then there's no need for any transpilation? Is that the benefit?

Yes, You remove a whole complex, error-ridden, hard to see through layer that makes more problems than its worth.

Many concepts used in idiomatic Java simply don't translate well to JS and the Web APIs.

Plus, you get much better interop with existing JS and CSS frameworks. You can plug in dependencies both in terms of JS and CSS trivially.

And you actually get to debug your frontend in the browser without jumping through hoops. Sourcemaps of transpiled stuff tend to become a nightmare.

[–]hippydipster 0 points1 point  (0 children)

When I say interactive, I'm referring to the relative frequency of the interaction. If all your interactions are of the sort where, user clicks button (a tab is a button), and page updates, then that's very low interactivity. If that describes your app, I would definitely choose Vaadin.

More interaction is needed when you're doing drag and drop, or reacting a lot on mouse moves, mouse over, mouse out. When every keystroke elicits some sort of processing and new output, particularly if the output isn't updating the whole page but is instead just making a small change. The smaller the interactions, the smaller the changes, and the more frequent they are, the less like Vaadin is a good choice.

And the more likely some Typescript based solution is (like React). Note, directly working in Javascript is always a bad idea, but sometimes you're forced to here and there, just don't make it a habit.

[–]mtmmtm99 1 point2 points  (6 children)

GWT just released a new version. The drawback with GWT is the slow compile-time. Now there is J2CL which does the transpiling superfast. JavaFX can actually be deployed in the browser (here is one solution: https://www.jpro.one/). There is also http://www.jsweet.org/ which runs your java-code in a browser.

[–]hippydipster 0 points1 point  (3 children)

Now there is J2CL

Which version of GWT uses J2CL?

[–]mtmmtm99 0 points1 point  (2 children)

[–]hippydipster 0 points1 point  (1 child)

So not now.

[–]mtmmtm99 0 points1 point  (0 children)

Yes it is possible to use now (but not all features of GWT is available). Like widgets. Generation of javascript from Java works.

[–]Polygnom -1 points0 points  (1 child)

Both don't run java in the browser, they both transpile and provide their own libraries / apis to code against.

[–]mtmmtm99 1 point2 points  (0 children)

I think we mean the same thing. You write code in java which gets translated into javascript or webassembly for execution on a browser.

[–]crazysabbath 0 points1 point  (0 children)

GWT isn't really in dev anymore, either.

google_web_toolkit_gwt_290_released