SlideShare a Scribd company logo
1 of 26
Google Web Toolkit
Houston Java Users Group      February 29, 2012
Peter Haynes, Derrick Bowen




                                                  The Business of IT®
                                                   The Business of
                                                    www.parivedasolutions.com
Agenda


►   Rich Internet Applications & AJAX

►   Google Web Toolkit

►   3rd Party Accelerators

►   Parting Thoughts




                                        2
Users now expect significantly more interactivity from websites


►   Desktop application experience in the browser

►   Very interactive, low latency

►   Rich Internet Application experience in the browser
    provided by technologies such as
     •    Silverlight
     •    Flash
     •    JavaFX
     •    AJAX
     •    Dart




                                                                  3
There are several options for providing interactivity in the browser



 Technology                          Description                                         Examples
    Flash       • Proprietary - Adobe                                • Hulu
                • Requires browser plugin                            • Dish Network
                • First released in 1996                             • YouTube
                • Ubiquitous - 98% install base                      • Disney
                • Many reported security vulnerabilities             • Toshiba


  Silverlight   • Proprietary - Microsoft                            • Netflix Movie Picker
                • Requires browser plugin                            • Bing Maps
                • Future is uncertain, as Microsoft is emphasizing   • Often used to stream video
                HTML5 & JavaScript for Windows 8 development               •   NBC Sunday Night Football
                                                                           •   2008 Summer Olympics
                                                                           •   2010 Winter Olympics
                                                                           •   Netflix streaming

    AJAX        • AJAX – Asynchronous JavaScript and XML             • Google Maps
                • Many open source & proprietary frameworks          • Gmail
                • More of a pattern than any particular product      • YouTube
                • Almost every modern website uses AJAX to some      • Facebook tabs
                extent                                               • Vimeo
                                                                     • Google Docs
                                                                     • SalesForce




                                                                                                           4
JavaScript combined with asynchronous XML requests to the server enable desktop style
interactivity on the web

►   AJAX stands for Asynchronous JavaScript and
    XML

►   JavaScript is an interpreted language supported
    by all modern browsers

►   Asychnronous background requests instead of
    waiting for a full page load
     •    XMLHttpRequest
     •    JSON
     •    RPC serialization


►   Reduces the apparent latency when sending
    requests to the server

►   Results in smaller but more frequent requests
    without blocking the user




                                                                                        5
Large-scale AJAX development can be challenging


►   Organizations typically have few resources with expertise in JavaScript, CSS, DOM

►   Cross browser quirks - Internet Explorer 6 is still the standard for many companies

►   Maintenance is difficult for large / complex applications
     •   Interpreted languages such as JavaScript often lead to long debug cycles
     •   Unit testing can be difficult in JavaScript
     •   Complex event-based programming model with a scripting language
     •   JavaScript has limited OO capabilities
     •   Managing asynchronous calls to the backend


►   Optimizing JavaScript performance is difficult




                                                                                          6
Agenda


►   Rich Internet Applications & AJAX

►   Google Web Toolkit

►   3rd Party Accelerators

►   Parting Thoughts




                                        7
Google Web Toolkit provides blazing fast performance and a rich development experience


                                       Google Web Toolkit (GWT) is a development toolkit for building and
                                       optimizing complex browser-based applications. Its goal is to enable
                                       productive development of high-performance web applications without
                                       the developer having to be an expert in browser
                                       quirks, XMLHttpRequest, and JavaScript. GWT.



                                  ► Write code in object-oriented java, and GWT compiles
                                    it into cross-browser compatible JavaScript
                                  ► Minifies and optimizes the resulting JavaScript – better
                                    than hand-coded in most cases
                                  ► Provides simple classes for programmatic interaction
                                    with the DOM, CSS, and browser events
                                  ► Manages asynchronous calls from the client to the
                                    server




                                                                                                              8
GWT provides tools for efficient development


►   Fast and easy code – deploy – test – fix cycle
    •   Test most code with normal, everyday jUnit tests
    •   GWT provides a jUnit extension allowing GUI components to be unit tested in the browser
    •   Development mode provides debugger support of the java code – eg, set break points, click a button in
        the browser, and step through code
► Good Eclipse integration, WYSIWYG editor, maven support
► Internationalization & localization support
► Integration with Google App Engine
► Speed Tracer profiler




                          Executing in Development Mode allows debugging java code in the IDE


                                                                                                                9
GWT provides a rich set of widgets and panels out of the box


►   See the Widget Gallery and Showcase sample application

►   Widgets
     Button PushButton RadioButton CheckBox DatePicker ToggleButton TextBox PasswordTextBox TextArea
     Hyperlink ListBox CellList MenuBar Tree CellTree SuggestBox RichTextArea FlexTable Grid CellTable
     CellBrowser TabBar DialogBox




►   Panels
     PopupPanel StackPanel StackLayoutPanel HorizontalPanel VerticalPanel FlowPanel VerticalSplitPanel
     HorizontalSplitPanel SplitLayoutPanel DockPanel DockLayoutPanel TabPanel TabLayoutPanel DisclosurePanel




                                                                                                               10
The development cycle in GWT is only slightly different than typical java development


►   Typical GWT development cycle
     1.   Write java unit tests – normal, everyday tests using jUnit
     2.   Implement the production classes in java
     3.   Compile and execute unit tests – normal, everyday java execution in the IDE or from command line
     4.   Compile java to JavaScript
     5.   Execute integration tests in the browser to verify functionality


►   If implementing GUI widgets, then the cycle changes a bit to run unit tests in the browser
     1.   Steps 1-3 as above, then for any classes that must run in the browser,
     2.   Implement a unit test extending GWTTestCase. Executing a GWTTestCase causes an embedded browser to spin up, so
          the test can execute in container
     3.   Once all unit tests pass, compile everything to JavaScript and integration test in the browser


►   There were a few more WTF moments than normal, as we all learned the limitations and quirks
     •    CellTable class had limitations we didn’t expect, so we coded a replacement
     •    Currency support was lacking


►   If things break beyond the abstraction layer, it can be difficult to debug
     •    Zero width table column IE crash
     •    Choosing which browser event handler to implement was sometimes difficult
     •    Interactions with non-GWT JavaScript


►   Short demo



                                                                                                                      11
Not all java classes can be compiled into JavaScript


►   Most commonly used classes and operations from the JDK will work on the client side
     •    java.lang
     •    java.lang.annotation
     •    java.math
     •    java.io – limited set
     •    java.sql – only date and time classes
     •    java.util – most classes are included, including generic Collections
     •    java.util.logging
►   Notable omissions include
     •    Reflection
     •    Calendar and its subclasses, Currency
     •    Threading, Concurrency, Timer
►   Some classes are translated into the JavaScript equivalent functions, with subtle differences from java
    behavior
     •    Regular expression classes can be used, but have minor differences from server to client side (z [end of String] not
          supported in JavaScript, had to use $ [end of line] )
     •    Care must be taken to test thoroughly in both client and server containers
►   In several instances, we coded different server and client implementations to work around limitations

                          Using Class                         Interface
                                                                                              Inject appropriate
                                                                                           implementing class into
                                                                                            using class, based on
                                                                                             where it is running


                                               Server-side                  Client-side
                                             Implementation               Implementation


                                                                                                                                  12
Demos are cool


►   Inheritance

►   Passing data between client and server (RPC)

►   MVP Pattern

►   Unit Testing

►   Internationalization

►   Back button

►   Widgets




                                                   13
Agenda


►   Rich Internet Applications & AJAX

►   Google Web Toolkit

►   3rd Party Accelerators
     •   Gin & Guice
     •   GWT presenter
     •   GWT dispatcher
     •   Widget Libraries


►   Parting Thoughts




                                        14
GIN and Guice provide dependency injection for GWT


►   GIN (Gwt INjection) brings automatic dependency injection to GWT client-side code

►   GIN is built on top of Google’s general purpose dependency injection framework,
    Guice, and uses a subset of Guice's binding language

►   GIN cannot provide the full set of Guice functionality mainly because GWT does not
    emulate reflection

►   Bindings direct GIN to inject a particular implementation, any time a constructor
    requires an interface
     •    Most cases are satisfied by this simple configuration
     •    Factory methods can also be implemented for more sophisticated bindings



bind(EventBus.class).to(DefaultEventBus.class).in(Singleton.class);
bind(PlaceManager.class).to(ZaastraPlaceManager.class).in(Singleton.class);
bind(TokenFormatter.class).to(ParameterTokenFormatter.class).in(Singleton.class);
bind(DateUtility.class).to(GuiDateUtility.class).in(Singleton.class);
bind(RpcExamplePlace.class).in(Singleton.class);
bind(I18nExamplePlace.class).in(Singleton.class);
bind(WidgetExamplePlace.class).in(Singleton.class);
bind(GreetingServiceAsync.class).in(Singleton.class);
bind(I18nExampleView.class);




                                                                                         15
GWT-Presenter is a popular implementation of the MVP pattern for GWT


►       Model-View-Presenter pattern is a variation of Model-View-Controller that allows more logic to be tested
          •       Widgets and logic that interacts with them are hard to unit test because widgets must be executed within the browser
          •       MVP addresses this challenge by reducing the responsibility of the View to merely wiring together the GUI components
          •       The Presenter is a controller that also takes on almost all of the logic from the view (enabling / disabling, hiding /
                  showing, setting focus, etc)
►       GWT-Presenter provides core MVP abstractions without dictating implementation of the View or Model
          •       Base Presenter interfaces and abstract classes
          •       Dependency injection helpers for GIN
          •       Abstractions for interacting with GWT’s browser history support classes
          •       The View implements an interface that limits the Presenter’s direct dependency on View implementation classes


                                                                                                          MVC            Action             MVP

                                                                                                                     Display to Screen      View
                                                                                                          View
                                                                                                                     Presentation Logic

                                                                                                                                          Presenter
                                                                                                        Controller   Application Logic




Note: Diagram from ―Design Patterns for ASP.NET Developers, Part 1: Basic Patterns‖, Alex Homer, Link    Model        Domain Objects       Model

                                                                                                                                                   16
GWT-dispatch simplifies the interaction between client and server


►   GWT-dispatch implements a reusable command pattern for communication with the server
     •   Creates a single servlet on the backend
     •   Client code instantiates an Action and passes it asynchronously to the DispatchServlet
     •   The DispatchServlet routes the Action to the appropriate Handler
     •   The Handler invokes server-side business logic to produce the Result, which is passed back to the client


►   Benefits
     •   Clean, simple pattern for remote request / response
     •   Limits the threat surface, because only one Servlet must be secured


►   We really liked this implementation, but had already implemented a similar pattern
     •   Our client did not want to lose time ripping it out to implement yet another third party framework
     •   We did lift a few ideas to improve our design, and migrating to GWT-dispatch is in the product backlog




                                                                                                                    17
GWT can be extended by creating custom widgets or using 3rd party widget libraries


►   SmartGWT http://www.smartclient.com/smartgwt/showcase/
     •   Slick looking widgets
     •   Thin GWT wrapper around existing JavaScript widgets
     •   Can be difficult to integrate plain GWT widgets with SmartGWT widgets
     •   LGPL & commercial licenses starting at $750
     •   Originally named GWT EXT


►   Vaadin
     •   Widgets are native GWT
     •   Free to use under Apache Software License 2.0
     •   Paid support and commercial plugins


►   Sencha Ext GWT http://www.sencha.com/products/extgwt/examples/
     •   Native GWT
     •   GPL v3 & commercial licenses starting at $595


►   Several others…




                                                                                     18
Agenda


►   Rich Internet Applications & AJAX

►   Google Web Toolkit

►   3rd Party Accelerators

►   Parting Thoughts




                                        19
Pros & Cons


►   Cons
     •     Takes more time to started with than direct JavaScript coding
     •     Adds a number of dependencies and compile processes, more than you need for a simple project
     •     Many 3rd party java libraries cannot be used for client-side code, because they cannot be compiled to JavaScript
     •     Difficult to impossible to write native JavaScript code external to your GWT project that can interact with GWT
           components
     •     Abstraction away from HTML is not complete, so if you are doing anything fancy you will still need to understand
           web/http/browser fundamentals
     •     Not many public examples of GWT in production sites (apart from Google adsense/adwords and Angry Birds)
     •     Dart has created anxiety that Google may eventually phase out GWT


►   Pros
     •     Code is compiled and easily testable!
     •     Debugging support!
     •     Highly optimized JavaScript, minified to include only code required for a particular browser / locale combination
     •     Google takes care of the nastiest cross-browser support issues, so you don’t have to
     •     Leverage existing knowledge of java
     •     Open source & active community
     •     Does not require browser plugins
     •     Several highly optimized options for communicating between client and server
     •     Google Apps Engine integration




                                                                                                                               20
When would we recommend GWT?


►   When would we recommend
     •   Strong java team, with little experience with JavaScript, CSS, DOM coding
     •   Starting from scratch
     •   Building a real ―web application‖ not a content site with a few dynamic features
     •   Long term maintenance is expected
     •   Tight response time requirements
     •   Cross browser support is required


►   When would we not recommend
     •   Large existing web application already in place
     •   Simple, page based website, i.e. flashy consumer marketing site
     •   Small and quick addition to an existing application
     •   Many custom / 3rd party JavaScript widgets already in use
     •   Team has little java experience, or already has strong JavaScript, CSS or
         html experience




                                                                                            21
Questions and Contact Info


Questions?




Peter Haynes
Email: Peter.Haynes@parivedasolutions.com

Derrick Bowen
Email: Derrick.Bowen@parivedasolutions.com
Twitter: @derrickbowen
Website/Blog: http://derrickbowen.com




                                             22
So what about Dart?


►   What is Dart?
     •   Dart is a programming language built by Google to replace JavaScript in web development
     •   The goal is to create a structured yet flexible language that feels natural to programmers and is built for high
         performance
     •   There has been significant backlash from the web standards community accusing Google of trying to take over the web
     •   For now, programmers write client side code in Dart and a special compiler converts it to JavaScript to be included on
         the web page



►   That sounds an awfully lot like GWT. What does that mean for GWT?
     •   Meanwhile, rest assured that GWT will continue to be a productive and reliable way to build the most ambitious web
         apps — and even games like Angry Birds. Key projects within Google rely on GWT every day, and we plan to continue
         improving (and open-sourcing) GWT based on their real-world needs.
           -   Posted by Bruce Johnson - Thursday, November 10, 2011 at 7:39:00 AM (http://googlewebtoolkit.blogspot.com/2011/11/gwt-and-
               dart.html)


     •   Your existing GWT/Java code shouldn't become useless any more than the gobs of such code inside Google would.
         That's really the key point of the blog post -- nothing precipitous is happening. That said, I feel a lot of momentum
         around Dart.
           -   Comment by Bruce Johnson – November 19, 2011 (https://plus.google.com/117487419861992917007/posts/6YWpsHpqMqZ)


     •   Many of Google's services are still being written in GWT and won't change anytime soon, for example AdWords and
         AdSense, from which Google derives the majority of their revenue, are written in GWT, so given that fact alone, GWT
         will be around for a long time and continue to be improved.
         […] Obviously, we want Dart to be a huge success, but even if it is, Java isn't going away anytime soon. :)
           -   Ray Cromwell – December 6, 2011 (https://plus.google.com/117487419861992917007/posts/6YWpsHpqMqZ)




                                                                                                                                            23
Other stuff


►   Security
     •    GWT makes it easy to deploy sophisticated logic to execute in the browser
     •    Code is obfuscated
     •    Avoid sending sensitive data to the client and validate all data received on the server side
          -    Users can bypass the code to view / manipulate data directly
          -    Even though the code is obfuscated, someone with time on their hands can hack it
►   Caching data on the client side
     •    Prior to GWT 2.3, GWT did not provide a built in mechanism for client-side persistence or caching
     •    GWT 2.3 includes support for the WC3 LocalStorage standard for persisting data between sessions




                                                                                                              24
Comparison vs other JavaScript frameworks


►   Table showing primary differences
►   Info from:
     •   Forester/gartner comparisons?
     •   http://google.wikia.com/wiki/Google_Web_Toolkit#Comparison_of_GWT_with_other_AJAX_frameworks
     •   http://aarendar.wordpress.com/2010/03/03/flex-vs-gwt-comparison-part-1/
     •   http://en.wikipedia.org/wiki/Comparison_of_JavaScript_frameworks
     •   http://stackoverflow.com/questions/394601/which-javascript-framework-jquery-vs-dojo-vs
     •   http://www.thoughtworks.com/sites/www.thoughtworks.com/files/images/26/radar-platforms-january-2011.jpg




                                                                                                                   25
Example of JavaScript compilation




                                    26

More Related Content

What's hot

Ad108 - XPages in the IBM Lotus Notes Client - A Deep Dive!
Ad108 - XPages in the IBM Lotus Notes Client - A Deep Dive!Ad108 - XPages in the IBM Lotus Notes Client - A Deep Dive!
Ad108 - XPages in the IBM Lotus Notes Client - A Deep Dive!ddrschiw
 
HTML5: An Introduction To Next Generation Web Development
HTML5: An Introduction To Next Generation Web DevelopmentHTML5: An Introduction To Next Generation Web Development
HTML5: An Introduction To Next Generation Web DevelopmentTilak Joshi
 
WebWorks Development for BlackBerry PlayBook and Smartphones
WebWorks Development for BlackBerry PlayBook and SmartphonesWebWorks Development for BlackBerry PlayBook and Smartphones
WebWorks Development for BlackBerry PlayBook and SmartphonesKyle McInnes
 
Netbeans
NetbeansNetbeans
Netbeansacosdt
 
Ad106 - XPages Just Keep Getting Better
Ad106 - XPages Just Keep Getting BetterAd106 - XPages Just Keep Getting Better
Ad106 - XPages Just Keep Getting Betterddrschiw
 
AD113 -- IBM Lotus Notes Discussion Template: Next Generation and Other OpenN...
AD113 -- IBM Lotus Notes Discussion Template: Next Generation and Other OpenN...AD113 -- IBM Lotus Notes Discussion Template: Next Generation and Other OpenN...
AD113 -- IBM Lotus Notes Discussion Template: Next Generation and Other OpenN...ddrschiw
 
HTML5DevConf 2013 (October): WebGL is a game changer!
HTML5DevConf 2013 (October): WebGL is a game changer!HTML5DevConf 2013 (October): WebGL is a game changer!
HTML5DevConf 2013 (October): WebGL is a game changer!Iker Jamardo
 
Google Dev Day2007
Google Dev Day2007Google Dev Day2007
Google Dev Day2007lucclaes
 
WebGL For Game Development 2012
WebGL For Game Development 2012WebGL For Game Development 2012
WebGL For Game Development 2012Tony Parisi
 
XPages and Java (DanNotes 50th conference, November 2013)
XPages and Java (DanNotes 50th conference, November 2013)XPages and Java (DanNotes 50th conference, November 2013)
XPages and Java (DanNotes 50th conference, November 2013)Per Henrik Lausten
 
Ad110 - Unleash the Power of Xpages
Ad110 - Unleash the Power of XpagesAd110 - Unleash the Power of Xpages
Ad110 - Unleash the Power of Xpagesddrschiw
 
Reusable Whiteboard Wicket Component for Apache Openmeetings
Reusable Whiteboard Wicket Component for Apache OpenmeetingsReusable Whiteboard Wicket Component for Apache Openmeetings
Reusable Whiteboard Wicket Component for Apache OpenmeetingsAndun Sameera
 
jQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesjQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesMark Roden
 
AD112 -- Development and Deployment of Lotus Product Documentation Wikis
AD112 -- Development and Deployment of Lotus Product Documentation WikisAD112 -- Development and Deployment of Lotus Product Documentation Wikis
AD112 -- Development and Deployment of Lotus Product Documentation Wikisddrschiw
 
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...ddrschiw
 
JavaScript Libraries (Ajax Exp 2006)
JavaScript Libraries (Ajax Exp 2006)JavaScript Libraries (Ajax Exp 2006)
JavaScript Libraries (Ajax Exp 2006)jeresig
 
Architecture of a Modern Web App - SpringOne India
Architecture of a Modern Web App - SpringOne IndiaArchitecture of a Modern Web App - SpringOne India
Architecture of a Modern Web App - SpringOne IndiaJeremy Grelle
 

What's hot (20)

Ad108 - XPages in the IBM Lotus Notes Client - A Deep Dive!
Ad108 - XPages in the IBM Lotus Notes Client - A Deep Dive!Ad108 - XPages in the IBM Lotus Notes Client - A Deep Dive!
Ad108 - XPages in the IBM Lotus Notes Client - A Deep Dive!
 
JavaME UI - JMDF 2007
JavaME UI - JMDF 2007JavaME UI - JMDF 2007
JavaME UI - JMDF 2007
 
HTML5: An Introduction To Next Generation Web Development
HTML5: An Introduction To Next Generation Web DevelopmentHTML5: An Introduction To Next Generation Web Development
HTML5: An Introduction To Next Generation Web Development
 
WebWorks Development for BlackBerry PlayBook and Smartphones
WebWorks Development for BlackBerry PlayBook and SmartphonesWebWorks Development for BlackBerry PlayBook and Smartphones
WebWorks Development for BlackBerry PlayBook and Smartphones
 
Netbeans
NetbeansNetbeans
Netbeans
 
Ad106 - XPages Just Keep Getting Better
Ad106 - XPages Just Keep Getting BetterAd106 - XPages Just Keep Getting Better
Ad106 - XPages Just Keep Getting Better
 
Web Components and PWA
Web Components and PWAWeb Components and PWA
Web Components and PWA
 
AD113 -- IBM Lotus Notes Discussion Template: Next Generation and Other OpenN...
AD113 -- IBM Lotus Notes Discussion Template: Next Generation and Other OpenN...AD113 -- IBM Lotus Notes Discussion Template: Next Generation and Other OpenN...
AD113 -- IBM Lotus Notes Discussion Template: Next Generation and Other OpenN...
 
HTML5DevConf 2013 (October): WebGL is a game changer!
HTML5DevConf 2013 (October): WebGL is a game changer!HTML5DevConf 2013 (October): WebGL is a game changer!
HTML5DevConf 2013 (October): WebGL is a game changer!
 
Google Dev Day2007
Google Dev Day2007Google Dev Day2007
Google Dev Day2007
 
WebGL For Game Development 2012
WebGL For Game Development 2012WebGL For Game Development 2012
WebGL For Game Development 2012
 
XPages and Java (DanNotes 50th conference, November 2013)
XPages and Java (DanNotes 50th conference, November 2013)XPages and Java (DanNotes 50th conference, November 2013)
XPages and Java (DanNotes 50th conference, November 2013)
 
Ad110 - Unleash the Power of Xpages
Ad110 - Unleash the Power of XpagesAd110 - Unleash the Power of Xpages
Ad110 - Unleash the Power of Xpages
 
Reusable Whiteboard Wicket Component for Apache Openmeetings
Reusable Whiteboard Wicket Component for Apache OpenmeetingsReusable Whiteboard Wicket Component for Apache Openmeetings
Reusable Whiteboard Wicket Component for Apache Openmeetings
 
jQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesjQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPages
 
AD112 -- Development and Deployment of Lotus Product Documentation Wikis
AD112 -- Development and Deployment of Lotus Product Documentation WikisAD112 -- Development and Deployment of Lotus Product Documentation Wikis
AD112 -- Development and Deployment of Lotus Product Documentation Wikis
 
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
 
The WebKit project
The WebKit projectThe WebKit project
The WebKit project
 
JavaScript Libraries (Ajax Exp 2006)
JavaScript Libraries (Ajax Exp 2006)JavaScript Libraries (Ajax Exp 2006)
JavaScript Libraries (Ajax Exp 2006)
 
Architecture of a Modern Web App - SpringOne India
Architecture of a Modern Web App - SpringOne IndiaArchitecture of a Modern Web App - SpringOne India
Architecture of a Modern Web App - SpringOne India
 

Similar to Google Web Toolkit Houston Java Users Group Presentation

Devfest09 Cschalk Gwt
Devfest09 Cschalk GwtDevfest09 Cschalk Gwt
Devfest09 Cschalk GwtChris Schalk
 
State of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront ConferenceState of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront Conferencedmethvin
 
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo Shift Conference
 
Developpement informatique
Developpement informatiqueDeveloppement informatique
Developpement informatiquebrokerslip0
 
Gwt overview & getting started
Gwt overview & getting startedGwt overview & getting started
Gwt overview & getting startedBinh Bui
 
GWT + Gears : The browser is the platform
GWT + Gears : The browser is the platformGWT + Gears : The browser is the platform
GWT + Gears : The browser is the platformDidier Girard
 
Introduction to Google Web Toolkit
Introduction to Google Web ToolkitIntroduction to Google Web Toolkit
Introduction to Google Web ToolkitDidier Girard
 
HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...
HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...
HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...Igalia
 
Introduction to node.js aka NodeJS
Introduction to node.js aka NodeJSIntroduction to node.js aka NodeJS
Introduction to node.js aka NodeJSJITENDRA KUMAR PATEL
 
GWT - Building Rich Internet Applications Using OO Tools
GWT - Building Rich Internet Applications Using OO ToolsGWT - Building Rich Internet Applications Using OO Tools
GWT - Building Rich Internet Applications Using OO Toolsbarciszewski
 
Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Stephen Chin
 
Talk Paris Infovis 091207132953 Phpapp01(2)
Talk Paris Infovis 091207132953 Phpapp01(2)Talk Paris Infovis 091207132953 Phpapp01(2)
Talk Paris Infovis 091207132953 Phpapp01(2)johnnybiz
 
Using Web Standards to create Interactive Data Visualizations for the Web
Using Web Standards to create Interactive Data Visualizations for the WebUsing Web Standards to create Interactive Data Visualizations for the Web
Using Web Standards to create Interactive Data Visualizations for the Webphilogb
 
Javascript as universal language
Javascript as universal languageJavascript as universal language
Javascript as universal languageRonald Harmsen
 
Rapid and Reliable Developing with HTML5 & GWT
Rapid and Reliable Developing with HTML5 & GWTRapid and Reliable Developing with HTML5 & GWT
Rapid and Reliable Developing with HTML5 & GWTManuel Carrasco Moñino
 
JavaFX Versus HTML5 - JavaOne 2014
JavaFX Versus HTML5 - JavaOne 2014JavaFX Versus HTML5 - JavaOne 2014
JavaFX Versus HTML5 - JavaOne 2014Ryan Cuprak
 
John Resig Beijing 2010 (English Version)
John Resig Beijing 2010 (English Version)John Resig Beijing 2010 (English Version)
John Resig Beijing 2010 (English Version)Jia Mi
 

Similar to Google Web Toolkit Houston Java Users Group Presentation (20)

Devfest09 Cschalk Gwt
Devfest09 Cschalk GwtDevfest09 Cschalk Gwt
Devfest09 Cschalk Gwt
 
State of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront ConferenceState of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront Conference
 
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
 
Developpement informatique
Developpement informatiqueDeveloppement informatique
Developpement informatique
 
20120802 timisoara
20120802 timisoara20120802 timisoara
20120802 timisoara
 
Gwt overview & getting started
Gwt overview & getting startedGwt overview & getting started
Gwt overview & getting started
 
20120306 dublin js
20120306 dublin js20120306 dublin js
20120306 dublin js
 
GWT + Gears : The browser is the platform
GWT + Gears : The browser is the platformGWT + Gears : The browser is the platform
GWT + Gears : The browser is the platform
 
Introduction to Google Web Toolkit
Introduction to Google Web ToolkitIntroduction to Google Web Toolkit
Introduction to Google Web Toolkit
 
HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...
HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...
HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...
 
Introduction to node.js aka NodeJS
Introduction to node.js aka NodeJSIntroduction to node.js aka NodeJS
Introduction to node.js aka NodeJS
 
GWT - Building Rich Internet Applications Using OO Tools
GWT - Building Rich Internet Applications Using OO ToolsGWT - Building Rich Internet Applications Using OO Tools
GWT - Building Rich Internet Applications Using OO Tools
 
Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5
 
SWTT 140407 session04
SWTT 140407 session04SWTT 140407 session04
SWTT 140407 session04
 
Talk Paris Infovis 091207132953 Phpapp01(2)
Talk Paris Infovis 091207132953 Phpapp01(2)Talk Paris Infovis 091207132953 Phpapp01(2)
Talk Paris Infovis 091207132953 Phpapp01(2)
 
Using Web Standards to create Interactive Data Visualizations for the Web
Using Web Standards to create Interactive Data Visualizations for the WebUsing Web Standards to create Interactive Data Visualizations for the Web
Using Web Standards to create Interactive Data Visualizations for the Web
 
Javascript as universal language
Javascript as universal languageJavascript as universal language
Javascript as universal language
 
Rapid and Reliable Developing with HTML5 & GWT
Rapid and Reliable Developing with HTML5 & GWTRapid and Reliable Developing with HTML5 & GWT
Rapid and Reliable Developing with HTML5 & GWT
 
JavaFX Versus HTML5 - JavaOne 2014
JavaFX Versus HTML5 - JavaOne 2014JavaFX Versus HTML5 - JavaOne 2014
JavaFX Versus HTML5 - JavaOne 2014
 
John Resig Beijing 2010 (English Version)
John Resig Beijing 2010 (English Version)John Resig Beijing 2010 (English Version)
John Resig Beijing 2010 (English Version)
 

Recently uploaded

Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 

Google Web Toolkit Houston Java Users Group Presentation

  • 1. Google Web Toolkit Houston Java Users Group February 29, 2012 Peter Haynes, Derrick Bowen The Business of IT® The Business of www.parivedasolutions.com
  • 2. Agenda ► Rich Internet Applications & AJAX ► Google Web Toolkit ► 3rd Party Accelerators ► Parting Thoughts 2
  • 3. Users now expect significantly more interactivity from websites ► Desktop application experience in the browser ► Very interactive, low latency ► Rich Internet Application experience in the browser provided by technologies such as • Silverlight • Flash • JavaFX • AJAX • Dart 3
  • 4. There are several options for providing interactivity in the browser Technology Description Examples Flash • Proprietary - Adobe • Hulu • Requires browser plugin • Dish Network • First released in 1996 • YouTube • Ubiquitous - 98% install base • Disney • Many reported security vulnerabilities • Toshiba Silverlight • Proprietary - Microsoft • Netflix Movie Picker • Requires browser plugin • Bing Maps • Future is uncertain, as Microsoft is emphasizing • Often used to stream video HTML5 & JavaScript for Windows 8 development • NBC Sunday Night Football • 2008 Summer Olympics • 2010 Winter Olympics • Netflix streaming AJAX • AJAX – Asynchronous JavaScript and XML • Google Maps • Many open source & proprietary frameworks • Gmail • More of a pattern than any particular product • YouTube • Almost every modern website uses AJAX to some • Facebook tabs extent • Vimeo • Google Docs • SalesForce 4
  • 5. JavaScript combined with asynchronous XML requests to the server enable desktop style interactivity on the web ► AJAX stands for Asynchronous JavaScript and XML ► JavaScript is an interpreted language supported by all modern browsers ► Asychnronous background requests instead of waiting for a full page load • XMLHttpRequest • JSON • RPC serialization ► Reduces the apparent latency when sending requests to the server ► Results in smaller but more frequent requests without blocking the user 5
  • 6. Large-scale AJAX development can be challenging ► Organizations typically have few resources with expertise in JavaScript, CSS, DOM ► Cross browser quirks - Internet Explorer 6 is still the standard for many companies ► Maintenance is difficult for large / complex applications • Interpreted languages such as JavaScript often lead to long debug cycles • Unit testing can be difficult in JavaScript • Complex event-based programming model with a scripting language • JavaScript has limited OO capabilities • Managing asynchronous calls to the backend ► Optimizing JavaScript performance is difficult 6
  • 7. Agenda ► Rich Internet Applications & AJAX ► Google Web Toolkit ► 3rd Party Accelerators ► Parting Thoughts 7
  • 8. Google Web Toolkit provides blazing fast performance and a rich development experience Google Web Toolkit (GWT) is a development toolkit for building and optimizing complex browser-based applications. Its goal is to enable productive development of high-performance web applications without the developer having to be an expert in browser quirks, XMLHttpRequest, and JavaScript. GWT. ► Write code in object-oriented java, and GWT compiles it into cross-browser compatible JavaScript ► Minifies and optimizes the resulting JavaScript – better than hand-coded in most cases ► Provides simple classes for programmatic interaction with the DOM, CSS, and browser events ► Manages asynchronous calls from the client to the server 8
  • 9. GWT provides tools for efficient development ► Fast and easy code – deploy – test – fix cycle • Test most code with normal, everyday jUnit tests • GWT provides a jUnit extension allowing GUI components to be unit tested in the browser • Development mode provides debugger support of the java code – eg, set break points, click a button in the browser, and step through code ► Good Eclipse integration, WYSIWYG editor, maven support ► Internationalization & localization support ► Integration with Google App Engine ► Speed Tracer profiler Executing in Development Mode allows debugging java code in the IDE 9
  • 10. GWT provides a rich set of widgets and panels out of the box ► See the Widget Gallery and Showcase sample application ► Widgets Button PushButton RadioButton CheckBox DatePicker ToggleButton TextBox PasswordTextBox TextArea Hyperlink ListBox CellList MenuBar Tree CellTree SuggestBox RichTextArea FlexTable Grid CellTable CellBrowser TabBar DialogBox ► Panels PopupPanel StackPanel StackLayoutPanel HorizontalPanel VerticalPanel FlowPanel VerticalSplitPanel HorizontalSplitPanel SplitLayoutPanel DockPanel DockLayoutPanel TabPanel TabLayoutPanel DisclosurePanel 10
  • 11. The development cycle in GWT is only slightly different than typical java development ► Typical GWT development cycle 1. Write java unit tests – normal, everyday tests using jUnit 2. Implement the production classes in java 3. Compile and execute unit tests – normal, everyday java execution in the IDE or from command line 4. Compile java to JavaScript 5. Execute integration tests in the browser to verify functionality ► If implementing GUI widgets, then the cycle changes a bit to run unit tests in the browser 1. Steps 1-3 as above, then for any classes that must run in the browser, 2. Implement a unit test extending GWTTestCase. Executing a GWTTestCase causes an embedded browser to spin up, so the test can execute in container 3. Once all unit tests pass, compile everything to JavaScript and integration test in the browser ► There were a few more WTF moments than normal, as we all learned the limitations and quirks • CellTable class had limitations we didn’t expect, so we coded a replacement • Currency support was lacking ► If things break beyond the abstraction layer, it can be difficult to debug • Zero width table column IE crash • Choosing which browser event handler to implement was sometimes difficult • Interactions with non-GWT JavaScript ► Short demo 11
  • 12. Not all java classes can be compiled into JavaScript ► Most commonly used classes and operations from the JDK will work on the client side • java.lang • java.lang.annotation • java.math • java.io – limited set • java.sql – only date and time classes • java.util – most classes are included, including generic Collections • java.util.logging ► Notable omissions include • Reflection • Calendar and its subclasses, Currency • Threading, Concurrency, Timer ► Some classes are translated into the JavaScript equivalent functions, with subtle differences from java behavior • Regular expression classes can be used, but have minor differences from server to client side (z [end of String] not supported in JavaScript, had to use $ [end of line] ) • Care must be taken to test thoroughly in both client and server containers ► In several instances, we coded different server and client implementations to work around limitations Using Class Interface Inject appropriate implementing class into using class, based on where it is running Server-side Client-side Implementation Implementation 12
  • 13. Demos are cool ► Inheritance ► Passing data between client and server (RPC) ► MVP Pattern ► Unit Testing ► Internationalization ► Back button ► Widgets 13
  • 14. Agenda ► Rich Internet Applications & AJAX ► Google Web Toolkit ► 3rd Party Accelerators • Gin & Guice • GWT presenter • GWT dispatcher • Widget Libraries ► Parting Thoughts 14
  • 15. GIN and Guice provide dependency injection for GWT ► GIN (Gwt INjection) brings automatic dependency injection to GWT client-side code ► GIN is built on top of Google’s general purpose dependency injection framework, Guice, and uses a subset of Guice's binding language ► GIN cannot provide the full set of Guice functionality mainly because GWT does not emulate reflection ► Bindings direct GIN to inject a particular implementation, any time a constructor requires an interface • Most cases are satisfied by this simple configuration • Factory methods can also be implemented for more sophisticated bindings bind(EventBus.class).to(DefaultEventBus.class).in(Singleton.class); bind(PlaceManager.class).to(ZaastraPlaceManager.class).in(Singleton.class); bind(TokenFormatter.class).to(ParameterTokenFormatter.class).in(Singleton.class); bind(DateUtility.class).to(GuiDateUtility.class).in(Singleton.class); bind(RpcExamplePlace.class).in(Singleton.class); bind(I18nExamplePlace.class).in(Singleton.class); bind(WidgetExamplePlace.class).in(Singleton.class); bind(GreetingServiceAsync.class).in(Singleton.class); bind(I18nExampleView.class); 15
  • 16. GWT-Presenter is a popular implementation of the MVP pattern for GWT ► Model-View-Presenter pattern is a variation of Model-View-Controller that allows more logic to be tested • Widgets and logic that interacts with them are hard to unit test because widgets must be executed within the browser • MVP addresses this challenge by reducing the responsibility of the View to merely wiring together the GUI components • The Presenter is a controller that also takes on almost all of the logic from the view (enabling / disabling, hiding / showing, setting focus, etc) ► GWT-Presenter provides core MVP abstractions without dictating implementation of the View or Model • Base Presenter interfaces and abstract classes • Dependency injection helpers for GIN • Abstractions for interacting with GWT’s browser history support classes • The View implements an interface that limits the Presenter’s direct dependency on View implementation classes MVC Action MVP Display to Screen View View Presentation Logic Presenter Controller Application Logic Note: Diagram from ―Design Patterns for ASP.NET Developers, Part 1: Basic Patterns‖, Alex Homer, Link Model Domain Objects Model 16
  • 17. GWT-dispatch simplifies the interaction between client and server ► GWT-dispatch implements a reusable command pattern for communication with the server • Creates a single servlet on the backend • Client code instantiates an Action and passes it asynchronously to the DispatchServlet • The DispatchServlet routes the Action to the appropriate Handler • The Handler invokes server-side business logic to produce the Result, which is passed back to the client ► Benefits • Clean, simple pattern for remote request / response • Limits the threat surface, because only one Servlet must be secured ► We really liked this implementation, but had already implemented a similar pattern • Our client did not want to lose time ripping it out to implement yet another third party framework • We did lift a few ideas to improve our design, and migrating to GWT-dispatch is in the product backlog 17
  • 18. GWT can be extended by creating custom widgets or using 3rd party widget libraries ► SmartGWT http://www.smartclient.com/smartgwt/showcase/ • Slick looking widgets • Thin GWT wrapper around existing JavaScript widgets • Can be difficult to integrate plain GWT widgets with SmartGWT widgets • LGPL & commercial licenses starting at $750 • Originally named GWT EXT ► Vaadin • Widgets are native GWT • Free to use under Apache Software License 2.0 • Paid support and commercial plugins ► Sencha Ext GWT http://www.sencha.com/products/extgwt/examples/ • Native GWT • GPL v3 & commercial licenses starting at $595 ► Several others… 18
  • 19. Agenda ► Rich Internet Applications & AJAX ► Google Web Toolkit ► 3rd Party Accelerators ► Parting Thoughts 19
  • 20. Pros & Cons ► Cons • Takes more time to started with than direct JavaScript coding • Adds a number of dependencies and compile processes, more than you need for a simple project • Many 3rd party java libraries cannot be used for client-side code, because they cannot be compiled to JavaScript • Difficult to impossible to write native JavaScript code external to your GWT project that can interact with GWT components • Abstraction away from HTML is not complete, so if you are doing anything fancy you will still need to understand web/http/browser fundamentals • Not many public examples of GWT in production sites (apart from Google adsense/adwords and Angry Birds) • Dart has created anxiety that Google may eventually phase out GWT ► Pros • Code is compiled and easily testable! • Debugging support! • Highly optimized JavaScript, minified to include only code required for a particular browser / locale combination • Google takes care of the nastiest cross-browser support issues, so you don’t have to • Leverage existing knowledge of java • Open source & active community • Does not require browser plugins • Several highly optimized options for communicating between client and server • Google Apps Engine integration 20
  • 21. When would we recommend GWT? ► When would we recommend • Strong java team, with little experience with JavaScript, CSS, DOM coding • Starting from scratch • Building a real ―web application‖ not a content site with a few dynamic features • Long term maintenance is expected • Tight response time requirements • Cross browser support is required ► When would we not recommend • Large existing web application already in place • Simple, page based website, i.e. flashy consumer marketing site • Small and quick addition to an existing application • Many custom / 3rd party JavaScript widgets already in use • Team has little java experience, or already has strong JavaScript, CSS or html experience 21
  • 22. Questions and Contact Info Questions? Peter Haynes Email: Peter.Haynes@parivedasolutions.com Derrick Bowen Email: Derrick.Bowen@parivedasolutions.com Twitter: @derrickbowen Website/Blog: http://derrickbowen.com 22
  • 23. So what about Dart? ► What is Dart? • Dart is a programming language built by Google to replace JavaScript in web development • The goal is to create a structured yet flexible language that feels natural to programmers and is built for high performance • There has been significant backlash from the web standards community accusing Google of trying to take over the web • For now, programmers write client side code in Dart and a special compiler converts it to JavaScript to be included on the web page ► That sounds an awfully lot like GWT. What does that mean for GWT? • Meanwhile, rest assured that GWT will continue to be a productive and reliable way to build the most ambitious web apps — and even games like Angry Birds. Key projects within Google rely on GWT every day, and we plan to continue improving (and open-sourcing) GWT based on their real-world needs. - Posted by Bruce Johnson - Thursday, November 10, 2011 at 7:39:00 AM (http://googlewebtoolkit.blogspot.com/2011/11/gwt-and- dart.html) • Your existing GWT/Java code shouldn't become useless any more than the gobs of such code inside Google would. That's really the key point of the blog post -- nothing precipitous is happening. That said, I feel a lot of momentum around Dart. - Comment by Bruce Johnson – November 19, 2011 (https://plus.google.com/117487419861992917007/posts/6YWpsHpqMqZ) • Many of Google's services are still being written in GWT and won't change anytime soon, for example AdWords and AdSense, from which Google derives the majority of their revenue, are written in GWT, so given that fact alone, GWT will be around for a long time and continue to be improved. […] Obviously, we want Dart to be a huge success, but even if it is, Java isn't going away anytime soon. :) - Ray Cromwell – December 6, 2011 (https://plus.google.com/117487419861992917007/posts/6YWpsHpqMqZ) 23
  • 24. Other stuff ► Security • GWT makes it easy to deploy sophisticated logic to execute in the browser • Code is obfuscated • Avoid sending sensitive data to the client and validate all data received on the server side - Users can bypass the code to view / manipulate data directly - Even though the code is obfuscated, someone with time on their hands can hack it ► Caching data on the client side • Prior to GWT 2.3, GWT did not provide a built in mechanism for client-side persistence or caching • GWT 2.3 includes support for the WC3 LocalStorage standard for persisting data between sessions 24
  • 25. Comparison vs other JavaScript frameworks ► Table showing primary differences ► Info from: • Forester/gartner comparisons? • http://google.wikia.com/wiki/Google_Web_Toolkit#Comparison_of_GWT_with_other_AJAX_frameworks • http://aarendar.wordpress.com/2010/03/03/flex-vs-gwt-comparison-part-1/ • http://en.wikipedia.org/wiki/Comparison_of_JavaScript_frameworks • http://stackoverflow.com/questions/394601/which-javascript-framework-jquery-vs-dojo-vs • http://www.thoughtworks.com/sites/www.thoughtworks.com/files/images/26/radar-platforms-january-2011.jpg 25
  • 26. Example of JavaScript compilation 26

Editor's Notes

  1. Peter to Derrick
  2. NEXT: Derrick To Peter
  3. Peter to Derrick for the Demo
  4. Derrick to Peter
  5. NEXT: Peter to Derrick
  6. NEXT: Derrick to Peter