Question

The question Why should I use jQuery instead of GWT? may be outdated (as its answers). And most of the other SO related questions may also be outdated nowadays. So, let's update the state of the art about GWT relevance for new projects.

GWT is more mature nowadays

Since 2009 questions/answers, GWT has evolved and some JS frameworks are available in Java:

  • GwtQuery for jQuery (gQuery)
  • GXT for ExtJS (former ExtGWT)
  • Smart GWT has superseded GWT-ext
  • ... and surely more ... (please feel free to append)

And even more, Java code can be converted to standalone JS libraries: gwt-exporter

But low-level JS frameworks may be enough

But more I read, more I see web developers advising to turn his back on GWT and use directly JS frameworks (Firebug, IDE plugins for JS frameworks...).

Productivity

However I like the idea of developing and debugging using the same IDE (Eclipse, Netbeans, IntelliJ IDEA...). I think I will be more productive... I should also think about Documentation and Community (forum reactivity as for this SO question)...

Questions

  1. For what kind of new 2014 project GWT should be (or not) considered?
  2. Are there pertinent alternatives to GWT for easy AJAX web application development & deployment?
  3. What are the current mode and trend?

My specific case

I have just completed a POC (of an intranet web app) based on Python3 (http.server.HTTPServer) calling (POST) bash scripts (some processing in C++) and retrieving JSON data. Some JS (no framework) in the web page for rendering. So I am wondering the best option for next iteration.

But please answer this question about other cases too. I would prefer a general question/answer to be useful to many more people.


UPDATE October 2015

GWT looks less active because no new release since 11 month. But in the past until 13 months between versions 2.4 and 2.5. The Git repo mirror is still very active. Moreover GWT is extensible, and new features can come from GWT libraries without requiring new GWT framework release. See for example the most common mobile GWT libraries and there corresponding release cycles. In the mean time the trend is to use Node.js everywhere! Adoption of GWT for new projects really depends on developers skills/motivation and project lifetime (turnover/training/maintenance). Some other criteria as reuse of available source code and time-to-market may also be taken into account... See excellent below answers.

Was it helpful?

Solution

For point 1 I can give you some criteria that I would use:

When using JavaScript based frameworks you are typically very fast in the initial creation of the code. In my experience, you are much slower when it comes to maintenance (bug fixes, new features, refactorings) as tool support isn't that good as it is for statically typed languages. So for bigger or long running projects I would always choose GWT because of Java and it's compiler checks/ecosystem/tooling. I think you will benefit of better efficiency and scaling in development over time as you won't have strange problems due to dynamic typing. For smaller projects that won't live too long or won't need big refactorings, JavaScript Frameworks can be a big push in development speed.

Debugging needs in the context of your target platform are also a criteria for me. Debugging GWT Code is very nice as long as you have a browser that is supported by DevMode or at least can be used with the new source maps based SuperDevMode. E.g. Safari on MacOS X isn't supported. For mobile devices, you can remote debug JavaScript on Android Chrome but as far as I know this isn't possible for GWT.

Another criteria for me is team size and turnover rate. Java based tools (IDE's, code quality checkers, ...) help developers, especially new ones to navigate through other developers' code. This is also true for other statically types languages, but you asked for GWT/Java.

The next one is the stack question ... GWT easily solves the client and remote communication part if use a servlet container on the server side. It's also easy to combine it with mature Java enterprise technologies (JPA, EJB, Spring framework, ...). This is a big strength if you need/want to have the stack. If you are going polyglot without JVM on your server side(as mentioned above), this one isn't for you.

Sure, there are more criteria for both, GWT and JavaScript frameworks.

And the big question is about preferences. JavaScript has really nice concepts (e.g. Closures) but is also a risk due to it's dynamic typing. Which one do you prefer?

Regarding point 2:

I'm not sure if there is a real alternative for GWT that provides similar features and tooling. Most other frameworks focus on one aspect only (Widgets, optimization, databinding, remote communication, browser support, I18n, ...). That doesn't mean, other frameworks are bad, but you typically need a combination of different frameworks to get the functionality that GWT provides.

Regarding point 3:

  • I would definitely have a look at TypeScript due to it's improved typing and interoperability with JavaScript
  • As far as I remember, Dart has a similar goal
  • The evergreen is JQuery but dependent on your needs there are good alternatives. But that is highly subjective
  • For widgets, Twitter Bootstrap (http://getbootstrap.com/) is nice if it's way to do things is ok for you. There's even a GWT version of it (http://gwtbootstrap.github.io/)

OTHER TIPS

Great answer by Steffen. I started typing it as comment to his, but found that I typed more than I expected, so making it a separate answer. Not hunting for points...

I just wanted to add 1 subjective point of mine. The reality is that majority of developers are so-called backend developers with no knowledge, experience and most importantly desire to develop web frontend. Reality of US IT market is that majority would prefer Java in their resume over JS, PHP, Python and other exotic languages. The reason is compensation. Java developers on average get paid more. Not sure about other countries.

So majority of developers in a company would be Java developers (or .NET, which is outside of this conversation). In order to make them work on UI you have to use a Java compatible technology, which would be JSP or GWT. JSP would require to learn JS libraries to make the frontend more or less presentable.

Obviously, if you want to impress public with unique UI you have to use JS libraries that allow for greater customization. Both JSP and GWT would work as majority of work is going to be done in JS. As I mentioned above, few companies would have experienced JS developers on staff.

Majority of applications though are written for internal use, not facing public. From what you described, your use case may fall under this category.

Internal non publicly facing tools often have a more complex functionality than public websites, but their design requirements are more relaxed as long as functionality is there and convenient for internal use.

In this case you can get away with GWT, which is less foreign for Java developers than jQuery and a high level library such as GXT with standard theme.

GWT with GXT for us was an easy and quick way to create a set of internal applications. With the team of Java developers our company has, we would never come close to the quality or even completeness of projects within the same period of time.

Just head off to: GWTs example page, showcasing real world examples of GWT applications

Just read about the super heavy weight nature of these examples.

GWT itself is not that light weight, and I doubt it was designed to create a datepicker. GWT is something completely else than jQuery as well. It is maybe more comparable to JSF2 than to jQuery. The question "should I use GWT or jQuery" could be answered like:

if you want to add datepickers, some effects, a sortable table, an autocomplete here and there. You should probably go with jQuery.

If you want to figure out if you want to use GWT as the frontend template / engine mechanism, you should consider other that are actually comparable. When discussing java, probably JSF2 is your only choice. And JSF learning curve is steep.

I am digging deeper and I found a sad post:

http://polygoncell.blogspot.mx/2013/07/gwt-for-new-project-no-thanks.html

I came to this page because I was reading about the upcoming projects like AngularJS, Backbone, single page applications (SPA): In short, google dropped GWT. GWT is now open source, because they just abandoned it. Now AngularJS gets a big push by google.

EDIT our dear andrew told me to "prove my point"

here is the algorithm to use to evaluate if a technic is competitive.

1) Go to your favorite job site

2) Search for {technology which interests you} jobs

3) Check out number of openings, related technology requirement etc

4) Repeat #2 & #3 for competitive technologies

5) Evaluate

today 19. may 2016, on upwork i searched for GWT jobs.

Jobs: 23.

I searched for angularjs jobs.

Jobs: 1338. That's right. one thousand three hundred thirty eight.

point proven?

I guess to answer point 1, you'd have to look at what your current situation is and what your goals are.

If you have a team of developers that have been using Java most of their careers, you can probably expect a good 6 months for them to learn the paradigms of JavaScript. If the have experience in languages like Groovy or Clojure, you could probably cut that time down some. So, if you aren't expecting the project to last more than a year or so, then GWT would probably be the way to go.

Conversely, if you have a team of JS developers, they may find the static typing system rather frustrating and learning to use it effectively could take half a year for them. So if this is the case, then you probably wouldn't want to use GWT for any new project where the learning curve outweighs the productivity.

I'm not really sure what point 2 is asking. If you are asking about whole stack frameworks, I'm guessing you could find something using nodejs, though I don't think I have enough experience to advise on that.

On point 3, where I work, we seem to be moving towards using JS frameworks (AngularJS in particular) with some (new) servers/services written in Python and Groovy, and the legacy systems still in Java. We also have a couple of services being written in Clojure.

GWT is pertinent. It has 130,000 developers using it. If you don't believe me just look at [GWT is coming back in .. in 2015][blog.xam.de/2014/02/gwt-is-coming-back-in-2015.html] and another stackexchange question which talks about this. GWT shouldn't be you're first option because it adds a lot of complexity.

What projects are GWT good for? GWT is much more complicated:

  • Java is a harder language that makes it hard to write bad code
  • Compiling to javaScript adds complexity
  • GWT was built from the ground up for extremely complicated web apps
  • the GWT community tends to prioritize user experience and performance over developer experience more than the javaScript community

However, the it's cleaner more maintainable code, it's java, it's faster, and you can reuse your code on the jvm and ios if you use J2ObjC

there are some very compelling reasons to use GWT - Java
- reuse your own code from other platforms. For example, google inbox reuses most of it's android code on the web using GWT and reuses it's code again on iPhone(thank J2ObjC) and the server(thank the JVM's ability to run on many different platforms). - use java libraries and tools, java developers - many developers prefer java to js and have good reasons to prefer it - built from the ground up for complicated, performant web apps. - Java code is cleaner and more maintainable

GWT has been going down according to google trends and indeed job trends but javaScript and jQuery are also going down. I don't know why these technologies are all going down. My theory is that there's a lot of new frameworks that are stealing developers from GWT and javaScript. I don't think this necessarily means that javaScript and GWT are dying yet though. This nothing more than the result of having a lot more competition.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top