5 ms·
Why Don't You Use Java for Programming the Client-Side Web Browser?
I would like to know, what are the obstacles for you as Java developers not using Java as programming language for writing Web browser apps. Web browser apps are client-side and not server-side Web apps. For running Web browser apps you mostly don't need a Web server, you just need your HTML, CSS and JavaScript files.
This is my full story:
http://bit.ly/TypeScriptVsJavaGWT
Would like to hear your voice, Java developers...
- PaulHoule 6y agoI used GWT years ago when somebody was paying for it. It was cool. Today people are paying for React apps.
- vegegoku 6y agoThey are not paying the right tool then. ;-).
- jfengel 6y agoI honestly didn't realize that GWT was still available. When I last tried it, a long time ago, it was really cumbersome. I've never heard of J2CL, but I don't see myself even giving it a try. I'm just not a huge fan of transpilers. The Web browser runs on Javascript, which is an insanely bad choice but the one that got made. If/when WASM happens, maybe that will enable better interoperability between source languages, but until then I find it easiest to speak the most native language on whatever platform I'm using. That will be the one with the best debugging tools, the broadest set of questions answered on StackOverflow, and the UX that feels most familiar to the user. I don't especially love Typescript, but I'll grudgingly admit that it's actually pretty good, especially given that it has to be Javascript. (It actually does some null safety better than Java.) It requires a transpiler but one that's universally supported and is only a very thin gloss on the underlying language, so I move swiftly back and forth. I can integrate plain Javascript toolkits, debug with the native JS debugger, and can quickly translate back and forth from answers written for JS to TS and vice versa. I'd much rather be writing Java -- or Kotlin, where again I'm happy despite the transpiler since it's so closely linked to the native tongue. But overall it's easier for me to adapt my language than to force a computer, and a community, to use my favorite. Even when that language is Javascript, a simply terrible language -- a thing I will say about very few mainstream languages. (After writing Haskell they're all pretty much the same to me.)
- dewanto 6y agoActually debugging on Web browser with sourcemaps is very easy and transparent, also with Java see this screenshot: https://miro.medium.com/max/1400/1*zeTE0robP4_HQ2gc6WAVUQ.png https://miro.medium.com/max/1400/1*zeTE0robP4_HQ2gc6WAVUQ.pn... Just the same as debugging in TypeScript or JavaScript. Very comfortable...
- jfengel 6y agoThe view on the right is obfuscated: you're looking at the Javascript names of the variables, not the original. If you want to use them on the console, you need to write Javascript, not Java. Better is to use a native Java debugger[1], but there are still a lot of pitfalls. [1] https://gist.github.com/hpehl/bd00b22586d0c75d37d5fe7f0cfcd823 https://gist.github.com/hpehl/bd00b22586d0c75d37d5fe7f0cfcd8...
- dewanto 6y agoThanks for the tip, I actually could always understand the variable names although they are not "original" ;-)
- dewanto 6y ago... If you are coming from JavaScript is TypeScript surely much "nearer" than Java... but if you are from Java why not stay in Java (with transpiler)?
- jfengel 6y agoI come from both. I find that learning a new language is much less difficult than learning the new ecosystem. If I'm going to write front-end code, learning the front-end idioms is more effort than the differences between Java and Javascript. If I want to use somebody's widget from NPM I'm going to have to learn Javascript anyway. That said, the best reason to continue to write Java is that I can share business objects between front and back end. That fact is what led to node.js, which is an abomination upon the earth. It's the worst of both worlds and yet its existence is inevitable. Similarly, I've been writing Javascript lambdas because that's what Netlify supports easily, and the horror overwhelms me. I am so sorry Java didn't win on the browser side. In a slightly different world the JVM accessed the DOM natively, but in the end Javascript felt like "native" webapps to users where Swing and AWT didn't. In the end, that's what I wish to produce: apps that the users feel comfortable with, no matter what terrible language I have to do it in.
- Asmat78 6y agomy fone is android