There are a number of posts on GWT vs javascript but I couldn't find any on GWT vs typescript.
I have about 20,000 lines of code in Java I need to move over to the browser client. However, it's not just recompile in GWT if I go that route. There's a bunch of objects referenced in that code that I need to remove (the existing code is part of a much larger program).
In addition, some low-level classes that are widely used are changing. It's not a big change but these classes are used in a lot of places. So it's really a rewrite either way. A bit smoother rewrite if I got to GWT, but a rewrite nonetheless.
This code also has no GUI or I/O component. It's called by javascript on the client and is used solely to process the javascript objects created and used by the javascript code.
Which leads to my question. What are the advantages and disadvantages of GWT vs typescript?
Well if I correctly understand you, you want to run Java
code that was previously run on the Server/Java Applet in the browser without GUI.
I haven't used Typescript
so I will highlight the advantages of GWT
(maybe some of them also apply to Typescript
):
Java
code, so GWT
is a naturally fit (with Typescript
you have to rewrite everything). Browser
. This is huge because you will end up with more or less one code base that's capable of running on Browsers, Servers, Java Apps, etc. For example the new google drive spreadsheet (web-app, Android app, etc) is built using this technique. tree-shaking
and thus the cost you play is only for what you really useThe biggest advantage is that most of your code, can be tested in "plain Java". Only those classes that need emulation have to be tested in the browser. You can use SuperDevMode
and SourceMaps
to debug them directly in the browser.
The recently held GWT.create conference highlighted also some interesting future improvements to GWT
.
There are plans to optimize the compiler so that it produces javascript code that is optimized for the javascript engines (object layout, etc).
There are also some ideas to use typed arrays
which would benefit performance, especially for computational intense tasks.
Possibly GWT
could target asm.js which could give you native like performance.
If you and your developers are more comfortable in Java, then GWT is probably the better option. Also, that allows you to at reuse at least some of your existing Java code without changes, whereas if you port to TypeScript, you'll have to rewrite it all.
Unfortunately, I don't know much about GWT, but can offer the following selling points of TypeScript:
Here are some disadvantages of TypeScript that I have observed:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With