4 points · by dewanto · 6y ago · 10 comments
This is my full story:
http://bit.ly/TypeScriptVsJavaGWT
Would like to hear your voice, Java developers...
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.)
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.
Agree, that at the end the our target should be the users and they don't care about the technology you use in the implementation. But from my point of view, we also don't have unlimited resources. So it plays a role whether you have a full stack which you can use from client (web browser) to the server and this is where GWT / J2CL / Spring Boot have their "power".
Just the same as debugging in TypeScript or JavaScript.
Very comfortable...
Better is to use a native Java debugger[1], but there are still a lot of pitfalls.
[1] https://gist.github.com/hpehl/bd00b22586d0c75d37d5fe7f0cfcd8...