Friday, July 12, 2013

GWT for new project? No, thanks!

First of all, let me introduce myself briefly. I am a software engineer with more than 10 years java projects development experience. I am a software architect who pays attention to the common architecture NFQ stuff like dependency, code qualification, application maintenance, etc. And, last but not least, I am technology trend follower who sticks with the “moving” of modern software development.

Today I want to talk about GWT because I have done some researches while I am preparing a fresh new web application development. And I want to use this opportunity to give a new glass to some pure Java guy to let them know a little bit more about what is going on with JavaScript recently.

It is very interesting to read the discussion of using/ not using GWT:
  • Company behind the current GWT shows us a brilliant report and tells us “89% of respondents would use GWT on their next project”.

Today, almost one year later after Jochen Krause posted his blog, according to my personal research, I am afraid I have to agree with him and Guy Nirpaz.

Google has dumped GWT and GWT is dying.

I feel sorry to say that since the report from Vaadin has actually confirmed that GWT is a good choice for a new project. Well, the report is brilliant. But while I was reading it I could not stop asking myself why such a report should even exist. Ever see any similar report of JQuery, HTML5 or Hadoop recently? No? Why? Because it is not necessary! Such a report of GWT is trying to let the people calm down and remove the fear we have while considering using GWT on the next project. This is just my personal opinion, sorry about that.

GWT has left Google since 2012. Some people said it is good for GWT regarding the similar movement of Eclipse from IBM to open source community. But in my personal opinion they are not comparable. First, Eclipse is a platform while GWT is just a framework for web application. Second, after moving to the open source community, Eclipse is still heavily used in IBM. I don’t see the same thing happens in Google. Google has actually abandoned GWT and embraces pure JavaScript with HTML5 development and provided Angularjs and Polymer. The community is mad on Angularjs after they met it.

It was a great choice to choose GWT a few years ago while JavaScript was ugly and just toy language used for some fancy animation. Now JavaScript is mature enough for serious project development. It is in fact already used to build some amazing applications like Gmail, Blogger, Google+, etc. Let me show you why you should NOT use GWT for the new project anymore.

Google walks away and community is following

I haven’t seen any life signal of GWT for new project within the Google territory. People follow when Google walks away.

Enterprise application development environment

This is the most frequently talked reason for choosing GWT instead of an appropriate JavaScript framework like Angularjs. You will be benefit from mature development environment and java language itself. Well, that is correct. But recently JavaScript and its development environment become more and more mature:

            IDE – Webstorm
            Tools mamangement – NPM(Node Packaged Modules)
            Rapid development – Yeoman (Yo, Grunt, Bower)
            Build tool – grunt
            Dependency management – bower
            Unit test – Jasmin
            QA code analysis – jshint
            Test automationKarma
            Modular – RequireJS
            Framework - AngularJS
In some areas using JavaScript is even better than developing application in java. Consider what would be done if maven should be updated and what would be done if Yoeman should be updated? Much easier while using NPM right?

Object oriented programming

Many people have concern about JavaScript language itself. This is one reason why they consider using GWT. To be honest, just because JavaScript is a dynamic language does not mean it is not object oriented. You can find many JavaScript OOP tutorial, for example this one from MDN. There are many JavaScript designpatterns can be implemented in JavaScript, even beyond the GoF design patterns. Want to read some good books? Take a look at the post “Required JavaScript Reading”, Rey Bango did a really great work!

Short of JavaScript experience

GWT lets people work with java to build a web application running on the client side. Feel great right? But, look out! JavaScript code will be generated. We do not really get ride of JavaScript. We are end up with generated JavaScript code! It would be not true, if you think you don’t need to know JavaScript when GWT is used in your project. In fact, According to my personal experience, almost every GWT developer knows JavaScript. That makes me, as a software engineer, feel really bad. Why should you let GWT generate the JavaScript that you can write it on your own? In fact, the gap between Java and JavaScript is not as big as people image. It might take some time to understand some core dynamic language concepts like “closure” and “prototype inheritance”. The rest should be really easy for mature Java developer to understand. If you are confused at first glance, maybe you need to learn it three times.

The native language of web application is JavaScript. HTML is going to provide more and more API. People around the world are contributing great frameworks/libraries using JavaScript directly. It is difficult for GWT to follow these fast and flexible developments done by a more tremendous community. If you want to use them within GWT, you (or somebody else) have to make them available in the GWT way. Such a restriction makes me feel really bad. There is really no excuse anymore not to use JavaScript directly.


GWT is a mature framework which provides great features like MVP, data binding, etc. But now, thanks of AngularJS, you will have these features too while using JavaScript. And that is not enough, beyond these features, AngularJS provides some other excellent built-in features, e.g. dependency injection (like Guice does) and Directive which is the killer feature of AngularJS for customization and component integration.


Still think GWT is the only choice for building testable client side RIA? Now is the time to change your mind. You can test every thing by using AngluarJS, Jasmin, and Karma. For example: 

  1. it('should say hello', function() {
  2. var scopeMock = {};
  3. var cntl = new MyController(scopeMock);
  5. // Assert that username is pre-filled
  6. expect(scopeMock.username).toEqual('World');
  8. // Assert that we read new username and greet
  9. scopeMock.username = 'angular';
  10. scopeMock.sayHello();
  11. expect(scopeMock.greeting).toEqual('Hello angular!');
  12. });


The usage of scopeMock via DI and the expect() method looks really familiar for us Java guys, right? :-) 


Want to use some fancy widgets built by other guys? With GWT you have actually only one choice: GXT. Vaadin could be another one if the complete client-side API isavailable. With AngularJS the Directive feature make it possible and easy to integration any other JavaScript widget library. AngularJS co-creator Miško Hevery hasmentioned that AngularJS 2.0 will work with Polymer seamlessly. Is the trend now not clear enough to you?

Mobile app development

Hot topic. It looks like currently everybody wants a (web) mobile app. If you use GWT, you will have no other choice but mgwt teams up with gwt-phonegap. And the project gwt-phonegap shows us exactly the risk of using GWT for new project - You have no direct access to the generated JavaScript and it is painful for any extension and integration. Why I am saying that? Because PhoneGap provides its features only via JavaScript API and you are forced using gwt-phonegap to generate the appropriate JavaScript code, which can call phoneGap JavaScript API. This approach is painful. If you want to use a new xyz web technology built in JavaScript, you have to keep waiting until someone developed a gwt-xyz project or you must develop the gwt-xyz project on your own. Can you afford it? Some people might say you can use JSNI. Yes, you can! But please think about it, why use GWT if you want to call the JavaScript API directly? Using JSNI you will lose most benefits you have because your project is not a pure java application anymore.

If you have GWT project and consider build a mobile web app as a new client view, before you decide to use mgwt and gwt-phonegap, you should at least keep an eye on the development pulse of both projects:

Still don’t get it? Compare with the pulse of JQuery Mobile:

Have you seen the risk of using mgwt and gwt-phonegap in a serious project?

Please don’t get me wrong. Daniel Kurka did a great work. His work of the both projects makes a mobile app of GWT possible. He should get our full respect. But, business is business, you should think of your own benefit and risk.


If you currently want to develop a new client side RIA, still using GWT might not be the best choice, even if you have GWT project experience. For your long term benefit you should consider using JavaScript directly. If I were asked to build an enterprise RIA now, I would use the following architecture and technology stack:

  •  Architecture: SOFEA 
  • Server side: Java & Restful API (I am still a Java guy and Java is still the first choice for the backend of enterprise application.)
  • Client side: AngularJS, RequireJS, HTML5, JQuery Mobile for mobile web, Cordova for hybrid app, some other JS libraries depends on the concrete requirement.
  • Development Tools: maven or Gradle for backend Java project. NPM & Yoeman for frontend JavaScript project.
  • Test: Junit & mockito for Java project. Karma, Jasmine, and PhantomJS for JavaScript project.
  • CI: Jenkins

    Just my two cents, any feedback will be appreciated.



    Avi Yafe said...

    Hi My name is Avi and i think you're probably right in all the things you have said.
    the only thing that you have missed is "strong types" which in large project still GWT has it advantages, refactoring of large project is something that you can't do easly.

    from guys how worked with java script the problem start with maintaining the project.

    NOTE:wirting new code is easier then reading (understanding) it!!!!

    The only thing that can help you with the point i mention is testing and testing agin and agian. which most of the programers realy hate!!!

    I think in few years when the JS projects will grow and the people who started them will leave them we see the real problems of using large JS projects.


    Unknown said...

    You have so many things wrong in this post that I dont even where to start to answer you.
    Please do some research about GWT again...

    Unknown said...

    Alain, could you please expand? your comment is vague and completely unhelpful.

    Unknown said...

    Soooo..... I have to say as a Java developer I love GWT. That said I am much interested in Node and Angular together on the client. One thing that really helped me at our organization was phone-gap. Not for the access to the device, but simply for wrapping code into an ipa. (we have a strict ios need)

    We also write apps in .js is there another way to get an app on the iPad springboard other than phonegap?

    I'm not aware of one, but that doesn't mean anything really.

    great post, and yes Google dropping GWT has worried me for that past three years.

    talsi said...

    IMHO, Daniel's work is just much better (by-far) than jqm framework (especially performace-wise thanks to gwt). I preffer using this "small"(mgwt & gwt-phonegap) framework rather than using the jqm life-cycle-crazy framework, even if the learning curve might be a little bit steeper. Once you get past the "hello world" samples of angular and copy pasting from Jqm docs it gets really hard maintaing large scale project in JavaScript.

    Tirthankar said...

    100% true...develop an application with 50 developers out of which 20 developers are constantly new ones because of churn rate in the industry and maintain an enterprise application on web. You will know it what pain JS brings in maintenance. The code keeps growing and so many functions and features get written more than once to avoid regression and then clean up is out of question, because no one knows what is going to break.

    Then you start looking for tools which can do goes on and on...Java script is a scripting language and for standing up a web page in a week with one or two developers project it sounds perfectly okay. For an enterprise application it is a NO NO

    Wendel said...

    Some comments.

    - Google most complex application has recently completely be rewritten in GWT. Google Apps Spreadsheet.

    - Gwt with a Java backend is must cheaper and easier to maintain than Angularjs with a Java rest backend.

    - Gwt business logic can be shared between the client and server.

    - Mgwt just released a new version. The library is complete. There is zero risk in using it even if they stop supporting it.

    - Gwt roadmap is very promising, with feature such as instant compile.

    - I have seen several Angularjs projects and they are slow, unreadable and for some reason the developers feel the need to write test units for every single bit.

    Unknown said...
    This comment has been removed by the author.
    Unknown said...

    There is an alternative tool similar to GWT called Dragome. But this one is about compiling bytecode to js, and it also has UI components support. Things like Incremental compiling, Java 8, HTML template are already supported. And there is no need to wait to ECMAScript 6 to be standardized because it already allows use of dynamic proxies continuation (js yield), classes, lambda (arrow functions).


    Emilio Bravo said...

    some clarification to what you mention in the post.

    " First, Eclipse is a platform while GWT is just a framework for web application." GWT is a SDK not web frameworks, There are many web frameworks built on GWT (GWTP, Errai, Vaadin, GXT, putnami ...).

    "I haven’t seen any life signal of GWT for new project within the Google territory. People follow when Google walks away.". False

    "Enterprise application development environment" You can use the same java tools for client and server development. If you are a full stack developer is more productive use one set of tools. Why not use javascipt at backend?

    "Object oriented programming", I guess we'll agree that java is much more powerful than javascript to place an object oriented programming.

    "if you think you don’t need to know JavaScript when GWT is used in your project" this is true.
    "According to my personal experience, almost every GWT developer knows JavaScript. That makes me, as a software engineer, feel really bad. Why should you let GWT generate the JavaScript that you can write it on your own?". javascript program that makes me feel insecure and I am more productive programming in java.

    "It is difficult for GWT to follow these fast and flexible developments done by a more tremendous community. If you want to use them within GWT, you (or somebody else) have to make them available in the GWT way" again false, JsInterop and Elemental 2.0, are being designed for safe integration with javascript and HTML5.

    Some advantages of GWT (if you have a java backend) over plain javascript obviated in the post:
    - type safe, for big projects this is pain killer.
    - Compiler optimization.
    - You can reuse java code between client and server.
    - Transparent logging integration (log4j or logback).
    - Java exceptions of client error.
    - jar for package.
    - Maven or gradle for complete construction of the project.

    GWT is a SDK !!!!!!, You can even use angularjs framework on GWT :-D

    You can use junit for testing cliente and server.

    You can use GWT widgets, Vaadin, GXT or HTML + CSS. We use Twitter Bootstrap + jquery.

    Architecture: SOFEA
    Server side: Java (Spring + JPA) & Restful API.
    Client side: GWT, twitter bootstrap, jquery and restygwt.
    Development Tools: eclipse, maven or Gradle.
    Test: Junit & mockito (gwtmockito).
    CI: Jenkins

    Unknown said...

    You said that you haven't seen any life signal in GWT. Well check out GWT.create 2015 and GWT 3.0. They're amazing!
    You asked why you should let GWT generate the javaScript. Here's the answer:
    -Optimize code: you'd be surprised at the amount of optimization it does. GWT is massively faster.
    -Add additional features to javaScript: in addition to javaScript GWT lets you do Java, and UiBinder.
    -Code Generators: Code generators let you specify what you want in an interface and then have the code generator generate the implementation at compile time. They let you do very powerful things:
    -Abstract stuff away
    -Abstract away browser differences by sending different code to different browsers. This is called permutations. This is much more efficient than jQuery's switch statements and allows GWT to optimize for each specific browser
    Bring Java code to the browser and reuse GWT code in JVM.

    Even js developers compile their code(google closure compiler).This is why so many people compile their code. There is an extraordinary amount of compilers to compile code to js. The other reason I don't write my own javaScript is that javaScript sucks. However if there is a js library I want to use I can use javaScript in GWT with JSNI. In fact, 62% of GWT projects use js.
    Your summary reveals the fundamental problem
    You said that you're only option for widgets is GXT but you have many options: mosaic, bootstrap, smart GWT, spiffy UI and much more

    Emilio Bravo said...

    More info about the future of GWT.

    GWT is at the core of new inbox's web client.

    Google is using GWT also in the new calendar and Sheets.

    Why compile to js?, perhaps the following projects will help answer that question:
    - GWT
    - TypeScript
    - FlowScript
    - AtScript
    - CoffeScript
    - Dart
    - scriptsharp

    jonas brothers said...

    Its useless even those guys see that gwt is almost dead around the world they refuse to acept the fact let this crap die.

    Unknown said...

    It is strange when author claims that google doesn't use GWT, please do the research again and bit properly this time. I won't be exaggerating if I say google uses GWT "heavily".

    Andyarok said...

    The author seems to be a person with no knowledge of GWT, neither the time to spend learning it. We have used in more than one project it is really good provided the architecture is setup well to start with.

    for ict 99 said...

    Angular 5 Resources

    | Angular 5 Training in Chennai.

    john said...

    Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me..
    I am a regular follower of your blog. Really very informative post you shared here.
    Kindly keep blogging. If anyone wants to become a Front end developer learn from Javascript Training in Chennai .
    or Javascript Training in Chennai.
    Nowadays JavaScript has tons of job opportunities on various vertical industry. ES6 Training in Chennai

    Nemco said...

    Thank you for posting such a nice useful and impressive content.
    angularjs development company

    Unknown said...

    Nice summary and prediction. Especially when you look 3-4 years back.

    I wonder what GWT proponents are to say now, a few years later, about their opinion.

    Disclaimer: I'm a former GWT developer, who'd chosen new at the time GWT/GXT over older dying Flex for rich web UI development. GWT was pretty good for what we've done with it, but I switched to SPAs for new projects once Angular and React have become more mature.

    gowsalya said...

    All the points you described so beautiful. Every time i read your i blog and i am so surprised that how you can write so well.
    python Training institute in Pune
    python Training institute in Chennai
    python Training institute in Bangalore

    priya said...

    I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own BlogEngine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.

    Data Science course in rajaji nagar
    Data Science with Python course in chenni
    Data Science course in electronic city
    Data Science course in USA
    Data science course in pune | Data Science Training institute in Pune

    ragul ragul said...

    Really you have done great job,There are may person searching about that now they will find enough resources by your post
    Best Devops online Training
    Online DevOps Certification Course - Gangboard

    service care said...

    Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    samsung mobile service center in chennai
    samsung mobile service center
    samsung mobile service chennai

    Priyanka said...

    Attend The Python training in bangalore From ExcelR. Practical Python training in bangalore Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Python training in bangalore.
    python training in bangalore

    Jagna Co Kalani said...

    Great Article
    B.Tech Final Year Projects for CSE in JavaScript

    FInal Year Project Centers in Chennai

    JavaScript Training in Chennai
    JavaScript Training in Chennai

    saketh said...

    cool stuff you have and you keep Python classes in pune overhaul every one of us

    shivam said...

    Flying Shift - Packers & Movers in Bhopal

    Priyanka said...

    Attend The Analytics Course in Bangalore From ExcelR. Practical Analytics Course in Bangalore Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Analytics Course in Bangalore.
    ExcelR Analytics Course in Bangalore

    Techy said...

    Visit for Python training in Bangalore :- Python training in Bangalore

    Venkatesh CS said...

    Thanks for sharing valuable information.
    Digital Marketing training Course in Chennai
    digital marketing training institute in Chennai
    digital marketing training in Chennai
    digital marketing course in Chennai
    digital marketing course training in omr
    digital marketing certification in omr
    digital marketing course training in velachery
    digital marketing training center in Chennai
    digital marketing courses with placement in Chennai
    digital marketing certification in Chennai
    digital marketing institute in Chennai
    digital marketing certification course in Chennai
    digital marketing course training in Chennai
    Digital Marketing course in Chennai with placement
    digital marketing courses in Chennai

    Customer relationship management said...

    Wow it is really wonderful and awesome thus it is veWow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your site.ry much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your site.python training in bangalore

    Customer relationship management said...

    Very interesting blog Thank you for sharing such a nice and interesting blog and really very helpful azure training in bangalore

    Customer relationship management said...

    Its really helpful for the users of this site. I am also searching about these type of sites now a days. So your site really helps me for searching the new and great stuff.python training in bangalore

    Customer relationship management said...

    Very useful and information content has been shared out here, Thanks for sharing cloud platform training in bangalore

    Customer relationship management said...

    I gathered a lot of information through this article.Every example is easy to undestandable and explaining the logic easily.mulesoft training in bangalore

    Customer relationship management said...

    These provided information was really so nice,thanks for giving that post and the more skills to develop after refer that prism training in bangalore

    Customer relationship management said...

    Your articles really impressed for me,because of all information so apps scm training in bangalore

    Customer relationship management said...

    inking is very useful have really helped lots of people who visit blog and provide them use full information.sccm training in bangalore

    Customer relationship management said...

    Being new to the blogging world I feel like there is still so much to learn. Your tips helped to clarify a few things for me as well as giving.vmware training in bangalore

    Customer relationship management said...

    Really it was an awesome article,very interesting to read.You have provided an nice article,Thanks for training in bangalore

    Customer relationship management said...

    I know that it takes a lot of effort and hard work to write such an informative content like science training in bangalore

    Datasciencecourse said...

    I have to search sites with relevant information on given topic and provide them to teacher our opinion and the article.
    Data science course
    Data analytics course
    Business analytics course
    Data science interview questions

    ss said...

    Excellent blog thank u sharing the useful info.....

    data analytics course

    data science course

    business analytics course