GWT: The Good Bits
gwt.fr
gwt.fr
Good bits:
- abstraction from different browsers
- ability to set breakpoints and debug code running in browser (browser based tools were not so full featured as they are now)
- refactoring
- Java code organization (packages, classes, interfaces)
- could share validation logic between front end and back end
Bad bits:
- abstraction broke sometimes. I remember one bug that drove me crazy--only showed up when I deployed the optimized code (vs the detailed code which was human readable), and was due to a namespace collision with a global js variable.
- compilation was another build step and sometimes not a quick one.
- far better for full page applications than drop in js widgets (we used it in both ways)
Overall I think it was a great solution for its time. Now a lot of the JavaScript ecosystem has caught up or surpassed it.
The general idea was that you get the mature tooling and strong typing of Java, and abstract away all the browser nastiness. Best of both worlds right?
The problem with GWT is that you are only using the Java language, and so you are missing all the libraries that make Java such a rich ecosystem when run in the JVM. The abstraction layer it forms keeps your developers locked in a world that is neither Java, nor modern HTML5/ECMAScript. So instead of learning to use new browser features, your team is stuck fighting GWT's idiosyncrasies and waiting for it to finish compiling.
If you are considering frameworks for a new web application, go for Ember or Angular. GWT is obsolete and will hold you back.
Why not React?
That said, polymer with GWT is really nice and works as well as most web things. Stuff like Angular has so many problems of it's own that it's just plain false to say GWT is obsolete when it actually solves some of the problems Angular still has.
https://drive.google.com/file/d/0BwVGJUurq6uVR1Y5anV5TC1SQkk...
https://docs.google.com/document/d/10fmlEYIHcyead_4R1S5wKGs1...
GWT is for large codebases, if you are trying to make a small project with GWT - you won't find much benefit from it. As the development is Java based, there is a lot of cross-pollination of good ideas, practices and tools. For example, you could use familiar testing frameworks, DI frameworks and debugging tools.
Finally, you can share code between Server, Web Clients and (Native) Mobile Clients. This is one feature which is hard to beat in today's code multi-platform world. Checkout https://drive.google.com/a/vaadin.com/file/d/0B3ktS-w9vr8IS2...
- it's so complex and frustrating. A lot of time you find yourself just fighting GWT and spending an afternoon to get two nested DIVs right.
- it is slow to compile/run and way more verbose than just Java
- when opaque code generators break, it is a royal PITA to understand what goes on
- everything is just over-engineered. Using a CellTable requires way too many steps. Sometimes you just want to display 10 rows and that's it.
- using cells is opaque and leads to way too many little classes
- GWT templating (UiBinder) is very weak - no way for example to define the columns in a CellTable
- styling the UI is a project in itself!
- you cannot use in a shared class some "server" features, even if they are not used at all on the client. E.g., an Address class cannot reference a java.sql.Connection, even if you only use it on the server.
- Has anyone tried to use server Regexps vs client Regexps? or Calendar?
- It's a couple of years we are waiting for GWT v3, and it's always just around the corner.
It had some definite plusses, like dynamic loading, and very efficient JavaScript. And of course you can easily, and safely, refactor.
http://www.gwtproject.org/javadoc/latest/com/google/gwt/core...
Just in case anyone else is wondering I got this from wikipedia: Google Web Toolkit (GWT /ˈɡwɪt/), or GWT Web Toolkit, is an open source set of tools that allows web developers to create and maintain complex JavaScript front-end applications in Java.
I think they're the primary backers of the GWT project now that Google has dropped support of it.
If I recall, the problem was more about ExtJS using overly complicated DOM structures to build its widgets than about the barebones GWT components themselves.