Is GWT the future of web development?

Pretty much most people who live in the technical world have seen, played with, or heard of GMail and all of the other applications like Google Wave.  Ever wonder how applications like these can be created?  Well, you should check out the Google Web Toolkit (GWT).  I started playing with this last week pretty heavily and I have to admit the concept is very intriguing and I think this stuff may have some legs.  The idea is you get all of the benefits of the Eclipse IDE (coding, type-ahead, debugging, etc) for your web applications but you actually write Java!  The cool thing about this is you get to continue coding in Java and the end compiled result is a slick Web 2.0 application based on JavaScript.  The GWT compiler supports the vast majority of the Java language[1].

You can check out the GWT API Reference guide to get a better feel for what kinds of UI are possible out of the box.  There is also a basic widget library available for immediate use and if you are not satisfied with those you can always create your own custom widgets.  What I really think has been done well (although I am not an internationalization expert) are the  different techniques you can use for internationalization.  Debugging is a huge bonus, you can now easily develop and debug your JavaScript applications right within Eclipse by debugging your application using the regular debugger.  The compiler’s generated output is simply a few JavaScript and HTML files, along with other public resources (css, images, etc…).   All you need to do to deploy your application is to put these resources on your web server[2].

So why is GWT so cool?  The key I believe is in attracting Java developers but also for the JavaScript optimizations it does for you in the JavaScript output.  You get obfuscated JavaScript files that are optimized for all of the major browsers – something you would have to first know how to do and then usually have to do it by hand.  You can also completely extend the GWT SDK with your own additions!  Creating custom services, UI controls, and extensions for your own products and developers.  Lastly, GWT is completely open source.  You can contribute to it or use it by adhering to the Apache 2.0 license model.

I am sure we will be hearing more of GWT and I would like to hear other opinions on this approach to Web 2.0 development.

32 thoughts on “Is GWT the future of web development?

  1. Hi,

    I played with it for a while and it looked like a very interesting concept. Really superior to just write everything in JavaScript.
    For XPages development on Lotus Domino, I am also preferring Java development instead of JavaScript hacking.
    The code is really much more reusable for other projects and can be debugged.
    With the right architecture you can even develop most of the XPages web application code completely separated from the Domino Designer IDE.
    In a project I’m currently working on, we’re producing a dual UI for an application, one UI for XPages on the web and in the Notes client 8.5.1 and one for a standalone Java application (at the moment as a tech preview in Swing, but planned for SWT later on). That’s something that you cannot really do with JavaScript development.


  2. I’m not so sure if it will be the future. Javascript frameworks like jquery are getting quite good now and remove a lot of the pain of doing client side javascript. This is further improved by the disappearance of IE 6 & 7 (finally). Basically, jquery is doing a lot of the same things that GWT is doing. Except it does it on the fly and hides browser specifics behind a pretty clean API.

    But more importantly, I believe the model of pre-compiling assets before deployment is going to disappear in the next few years. I saw this morning a nice demo of a new web development framework called play that basically throws out servlets, application servers and a lot of other stuff we are used to in server side Java and replaces it with something that resembles python django, including the server compiling your Java for you on the fly. In other words, edit java file, hit F5 in the browser. No compile, no deploy, nothing. Compilation happens on the fly, in the background in about a second. F5 does all the work, incrementally. In other words, I believe server side Java is going to (and needs to) become more interactive. Almost like a scripting language. This fits beautifully with stateless REST and AJAX server side code and rich client applications running in the browser. I don’t see how GWT fits in here since it assumes having some application server underneath and a complex compile time translation process.


  3. GWT is a Java source code to Javascript source code compiler. If they ever change that to a Bytecode to Javascript source code compiler, it will much more useful and it will get more traction from the other JVM languages.


  4. Pingback: uberVU - social comments

  5. I am using GWT now for a year in several customer-projects and in my opinion, it has changed developing Webpages with Java. Before GWT i used JSP, Struts and at last JSF/MyFaces. It is good for web 1.0 pages, but if you want to add web 2.0 features you have to embed a JavaScript-Framework (DWR, JMaki, or use a special framework like Icefaces. So you have a mixture of Java and JavaScript, but this is not the end, you have to add several CSS-tricks for the different browsers. Much work to do which is not cheap!

    Using GWT get you rid of JavaScript and CSS (mostly need it for styling) and you can concentrate your Skills on Java. I like it and i recommend it my customers.


  6. I’ve done some projects with GWT and for me the value is in these attributes:

    1) As mentioned, most of the time you are working in Java. There are some times that you may have to do something with JavaScript, or work with the DOM (even then you can usually do it in Java), but the value of being able to use Eclipse or Netbeans and their debuggers/environments in the Java language makes dev work with GWT a lot easier. You still have to test the resulting JavaScript because sometimes there are differences between hosted mode and deployed mode. You still have to be somewhat skilled with CSS and HTML.

    2) It abstracts away a lot (but not all) of the browser differences – as much or better than other frameworks. There are still times when you have to do something special for a given browser or environment, but even then GWT makes this easier with its built-in support for using binding/bundles/etc. on a per browser/environ basis.

    3) For people like me who have Swing experience, the GWT way of doing things is very familiar, much more so than trying to get something done in Dojo/etc. and JSP/JSF/etc.

    Things to consider:

    I have found that GWT is best for internet/intranet browser applications in the sense that the ‘application’ is in the browser. Apps like a mail browser, word processor, image editor, ledger, business apps – that kind of thing. If what you need to do is more of an application than a dynamic web page, then GWT should be considered. If you just need a page with a few dynamic elements, especially if then JSP/JSF/etc. might be a better choice – especially if the web page will be created dynamically on the server side. If you need a lot of user interaction, i.e., the more you approach an application, the more GWT makes sense.

    There are some things you can do in Java that you can’t in GWT, like threading and reflection, so some popular Java libs and maybe code you have written, may not be useful in GWT.

    So, is GWT the future of web dev? I think it will be a major part of the future. It isn’t the right tool for all web dev, but then nothing is. It makes sense for highly interactive web front ends, but there is a lot more to web dev than just that.

    Personally, I would have preferred Swing and Java for many of the web apps, but that is still too heavyweight for most needs, and there has been a lot of prejudice built up against such a deployment over the years (much of it undeserved) – but even with GWT there is and will be a lot of things you can’t do that you could do with Swing apps. However, the right tool for the right job – GWT works well for some things, JSP/JSF/etc. for others, and Swing for yet others. It depends on the use case.


  7. I think the most important aspect of GWT is not what it does, but WHO it brings to the table.

    Prior to GWT I was intimidated by web development. Sure I _wanted_ to be all cool and web2.0-y, but I had no idea where to start. I could code up a windows form app or a cocoa app very quickly and I had done some java programming, but I didn’t know the first thing about javascript or CSS.

    By allowing me to feel comfortable writing code I was familiar with, in an environment I was comfortable with, it lowered the bar for entry. Now all I had to do was figure out the specifics for designing CSS, and the few cases when I had to dig into javascript directly. Those cases are easily figured out with google searches.

    I think it is this method of bringing desktop developers to the web that is the real revolution here, not necessarily GWT as a technology. Cappuccino does essentially the same thing for Objective-C, and to some extent ASP.NET is attempting to do the same thing for windows developers.


  8. PJG,

    Agreed. I tried working in Tapestry and found the ‘now magic happens’ layer a bit difficult to understand. Spring MVC was better IMO. Even working with straight JSP is easier. Now maybe I could go back to Tapestry and grok it a bit better, but I prefer GWT.

    I think GWT also brings some UI best practices (and maybe people) to the table – from the desktop. This is a good thing because I think about 99% of the web pages/sites out there suck in one aspect or another (there are very few web sites I can’t go to and point out some major suckage from a UI best practice perspective, even just a web page design perspective). It is like everytime we get some new UI platform (including Java/Swing) the designers (of the platform and the apps) decide to throw out all the best UI practices learned over the years and make the same mistakes all over again. *sigh*


  9. I wish good luck to GWT, but that approach is not an effective solution architecture for Web 2.0. It may only help people who hate JavaScript, but in the end you would somehow touch it. I think both client-only and server-only approaches will not find widespread use. I think best solution would be mixed approach, server-side Java with client-side JavaScript.


  10. IL,

    I am not sure why you would say it isn’t effective for ‘Web 2.0’

    GWT is not client only. It talks to the server and is more ‘Web 2.0’ than something like Tapestry (at least the last version I used) and older frameworks (or at least older versions of those frameworks) in that it was designed from the outset to use Ajaxian communications mechanisms.

    I have written Swing apps that talk to a server. They didn’t use asynch comms, but they could have – they just didn’t need to. So I don’t know why being client oriented has any impact on the effectiveness of the framework. I also don’t know why it should be damned because it isn’t JavaScript until it is compiled as such.

    In that sense GWT is really no different from any other JS framework, it just allows those of us who are more comfortable and familiar with Java to mostly work in one language instead of two – thereby minimizing the need to work in JavaScript.

    I do know that some people who have no to little experience with Java and who work primarily in JavaScript have problems with the static nature of Java, the type safety and so on. But IMO that is their problem not mine. If they don’t like it then don’t use it. Personally, until the last couple of years, I have seen very little JS code that doesn’t make me shudder, and much of it still does – so I’ll stick with Java as much as possible.


  11. I agree Developer Dude, the API’s around connecting to the server are pretty impressive and give you a wide range of ways to connect to the server. I especially like the fact that most of it is “done for you” but you can always do some low level programming yourself to get around any limitations of the compiler.


  12. The company I work for is using GWT for a lot of large applications. Some years ago we wrote JSP/Struts/JS/J2EE applications but the UI layer was always a nightmare to manage because not many developers are capable of writing decent and portable Javascript.

    GWT fixes a lot of the issues that application developers are facing when they want to publish Web2.0 style applications and by focussing on Java it really brings a lot of code reuse and tool reuse to the table as well.

    One part is still lacking a bit: I would not use it for regular type of websites that need a bit of special effects. For that I would rather go to JS libs and let designers create the web pages in their tools.

    Saying the Javascript libraries are the only way for web2.0 apps is just ignoring the facts:
    – there are not that many good JS developers. Javascripts requires a lot more discipline than a statically typed language
    – a large codebase of Javascript created by a large set of mediocre developers is just a maintenance nightmare
    – supporting multiple browsers is just terrible in JS.
    – The GWT compiler improves with every version. The code optimisation are great and if the performance characteristics of browsers change, so can the generated code… without impact on your business logic.


  13. In the last year i used JSF to develop my web application using some extensions libraries to use AJAX. Now i started to study GWT and i found it very interesting framework. What i don’t like is that JSF is a specification and GWT is a framework. So, in the first case what i develop does not depends on the implementatione used (not really true when you strongly use extensions libraries). Starting a new big project using GWT is like a bet for me, because the future of GWT depends on Google community and how many users are in the world.


  14. Hi Bob, glad you found GWT to be an interesting project with potentials.

    I’ve been using GWT for almost 2 years (since 1.4 to 2.0-trunk). Some Java developers might call it the “SWING” for web-app. I felt that way too on my first year of GWT use. But if people were to apply their SWING experience to GWT, the DOM output will be a mess pretty quickly and you’ll have a bloated DOM that crash Safari inspector frequently.

    People mentioned that jQuery is good enough. Yes, it’s good enough if your requirement is to sprinkle a bit of animation and a bit of AJAX. But it’s not good enough if you want to make GMail like web-app or the recent Rational suite that IBM promotes.

    Don’t forget that jQuery is just a JS library while GWT is a platform. It has its own compiler optimization, code-splitting, client bundling (bundle CSS, Images and your JS as one package), code obfuscation, Compiler analysis tools (SYOC), debugging capability, i18n generator.

    Both jQuery and GWT do take care of browser incompatibility. But GWT solves it a bit different. If other JS library would sprinkle if-else branch here and there to avoid browser specific code, GWT would generate permutation of JS output for each browser target so GWT code will not have those ifs-elses. (Hence it’s faster).

    During development, GWT provides HostedMode so people can hit refresh and see the changes immediately. Just like “Play Framework”. No compilation needed. (I lie, currently you might have to compile it under corner-case situation if you have to test it in multiple browsers).

    All-in-all, GWT will be one major player in the future of Web Development if you need more than jQuery or if your JS files are getting larger and you’re having hard time to maintain it.

    Hope you try it more Bob 🙂


  15. I don’t know guys. For me you are talking: – i don’t know css, i don’t know dom, i don’t know javascript, but i pretend to be a web developer. GWT is just for guys who onlu knows java and believe they could build good web app.


  16. GWT writes bloated, heavy code. It might be a good option for Java developers that want to get into web development, but for anyone that’s serious about what they’re building you should look into writing code that uses web standards, good html, clean css and smart, simple javascript.

    GWT is NOT the future of web development. It’s a hack put together to make web apps look the same in all modern web browsers.


  17. I think most code generators write bloated code compared to code that you write on your own. It might also run slower, but for most situations the difference should not be relevant.
    The advantage of a system like GWT is that you can reuse your Java code in other (none-web) Java application – and maybe better debugging (I know there are also debug tools for web browsers available).
    Yes, and of course the type safety for people that do not like the ‘freedom’ that you have in Javascript.
    But I see a lot of people like writing their code that way.
    For me personally, JavaScript always felt like a hack, although I did a lot of coding in it in the past (e.g. something like that back in 2003 with a lot of fun writing for Firefox and IE: ).

    At the end the questions are:
    -which end user looks into the code of a web application?
    -how much time (and money) could the developer save by using a toolkit compared to writing the whole code manually?

    I think this is a developer discussion in this thread. End users do not care at all about it.


  18. I would rather qualify the statement a bit and say “GWT is the future of Java Web Application Development” , there is always going to be different tech stacks, Microsoft, LAMPs, Ruby etc.. with their own piece of developer community.

    But for Java developers I think Google has done a great job. Proving the quality of amazing Engineering happening there.

    – Javascript was/is always hacky
    – Is it even a language??!! Where the *#@! the objects went?! This is like taking eons to build the first working mobile phone, and then using it for SMS. Brain Dead?
    – Messing around the code to make it work for various browsers was/is hacky
    – This whole stateful-application shoved-up-the-stateless-protocol-behind was hacky
    – this whole series of translating what you see on the UI, all the way to the back end through a series of Parameters, Value Objects, DTOs , and the persistence layer was/is brainless
    – The business of makign the server in charge of “painting” the UI is plain stupid.
    -GWT has mopped up the whole mess in one smooth swish.

    Though some of the above stupidity will persist, GWT atleast erases them out of the developer’s drawing board.


  19. GWT is excellent for web based applications.

    Some things to consider

    1> design time – drag and drop based
    can we remove even the requirement to write java code

    2> lazy association fetches

    3> using hierarchical object structures such as sdo or xml ?

    4> a template engine like facelets or ftl should be natively supported.

    5> bloated js code is an issue as someone pointed out but I am fine with it since most client browsers run on good hardware now.

    6> cloud based applications using gwt.
    enterprises are likely to move on to cloud apps if not now in the near future.

    7> bookmarking and back button support. even if a gwt app is rich and intuitive people are too used to pasting urls in mails or clicking back buttons.

    these possibly more issues have to be considered.

    Having said that still recommend as I was able to get past most.



  20. IMHO, GWT is the best choice for Web and Netbooks platform.

    Plus for the Java developers the learning curve is… well – like nothing – you still code the Java 🙂

    Our developers without any experience in GWT were able to lunch the AnwaltMap project in very short time.


  21. Hey, I have used GWT and I agree it is good way of writing webapps if you don’t know how to do web development using JSP, HTML, CSS and JS in some well proven framework like STRUTS or SPRING. Otherwise it is quite inefficient, frustrating way of building webapps and debugging it is time-consuming.


  22. GWT just rocks! I’m an old man (okay: stone old), growing up with strongly typed languages. Never ever found access to Web dev prior to GWT. GWT enables me to do complex things type-safe with good abstraction from all (okay: most of) the browser-specific things. In short time I did medium-complex things, fully asynchronously, that run more robust than several (synchronous) desktops applications. Fully integrated into Eclipse it’s just a pleasure to do well-integrated, homogeneous (sharing classes between Server and CLient side) JEE/AJAX development.



  23. NO GWT! Seems more developers are seeing that the future of GWT is limited by being handcuffed to source code translation–and other weaknesses. It lacks fundamental expressiveness and an efficient development cycle. For these reasons we dropped GWT in spite of the heavy “its backed by Google” rhetoric. GWT buzz is mostly fueled by Java developers who need to deliver a RIA experience, but don’t want to write JavaScript…and haven’t done there homework on other Java frameworks. Take a look at ZK and Vaadin if server-centric can meet app requirements. Really, slick solutions. Otherwise look to JQuery, YUI, Atlas, and other solutions to ease your pain for client-side development. BTW, ZK does client-side too. Don’t bet your dollars on GWT unless they can solve their issues. Better, more mature solutions are available.


  24. Pingback: Why your blog isn’t getting enough hits, top 8 tips! | Bob's Blog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s