Ask HN: Your opinion on GWT vs raw JS Im considering starting a new web app and want to know more about GWT vs just Javascript (GWT compiles Java to Javascript). Does GWT offer productivity gains over just using JS? Any tips on using GWT? |
Ask HN: Your opinion on GWT vs raw JS Im considering starting a new web app and want to know more about GWT vs just Javascript (GWT compiles Java to Javascript). Does GWT offer productivity gains over just using JS? Any tips on using GWT? |
IMHO that's the best of the options, because you can fall back to pure JS if you need extra flexibility or speed, and yet still don't have to deal with cross-browser bugs.
If you want to have the same code run on both the server and client, your only options (that I know of) are GWT, server-side JS like Rhino or V8 or Node.js, and Pyjamas. GWT's the most mature of those.
Also, a social reason to use GWT (and perhaps the real reason Wave uses it) is if you know Java and don't want to learn JavaScript. This doesn't hold much water with me - what sort of a programmer wouldn't want to learn a new language? and JS is a pretty nice one all things considered - but it's convincing for lots of other folks.
I think its a good idea if your web application is driven by the JS instead of just using it to add interactivity. As in, something like Gmail or wave which are basically "javascript applications" rather than "web applications", if you know what i mean.
JS can get a bit annoying when trying to impose the needed structure to write big applications. That structure is "built-in" when using something like Java.
Also, with a JS-heavy application, you'd need to take care of the different browser quirks(via library or otherwise). Apparently, GWT can take care of this for you.
Having said that, I don't typically like "generated" code. At least not code that I don't generate myself.
Your favourite text editor(I use vim) or you can be a bit more fancy and go with something like Netbeans or Eclipse(although I always go back to an editor). And firebug for debugging.
You can add a bunch of stuff to the mix, but that's all I need really.
(Oh, you might also want to throw in a mini-fier for when you're done.)
If we'd taken the time, we could have ironed out the klunkiness.
Might be worth building a vertical slice of you app, first with jquery (or another JS library) and then with GWT and see which one suits it better.
One of my developers is crazy about GWT, and has shoe-horned it into a number of apps that he's primed, and it's proven to be problematic for a number of reasons.
The main problem we have is that a lot of our apps fit into a larger portal, so we have to worry a LOT more about JavaScript and CSS collisions, and generated JS/CSS just doesn't work well for that. Outside of a portalized environment, it might not be THAT bad, but for us, it's proven painful.
In the event that you find yourself duplicating your server side code and client side code, or writing excessive form validation to match server-side constraints, something like GWT is probably the way to go.