SlideShare ist ein Scribd-Unternehmen logo
1 von 48
Downloaden Sie, um offline zu lesen
Google Web Toolkit: A technical overview
Chris Schalk

Con: Gabriel Praino


DevFest 2009
November 17th, 2009
Agenda

    •  AJAX: what it is and why it's important
    •  Introducing GWT
    •  GWT advantages
    •  GWT 2.0 features
    •  Who’s using GWT
    •  Q&A




3
AJAX... uh... what?

    •  Also known as Asynchronous JavaScript And XML
    •  JavaScript can issue asynchronous server requests
    •  JavaScript can manipulate the user interface




4
The AJAX architectural shift




5
The AJAX slippery slope

    •  Experiment with “a bit of script”
    •  Everybody loves it! More!
    •  When did we became an AJAX shop?
    •  Attempt to port to something other than Internet Explorer
    •  Wait... this is hard!
    •  Result: “A tangled mess!”




6
GWT’s Mission




     "GWT's mission is to radically improve
        the web experience for users by
      enabling developers to use existing
       Java tools to build no-compromise
        AJAX for any modern browser."



7
Google Web Toolkit at a glance
    •  Write code in the JavaTM language using your favorite Java
       IDE
    •  Debug as bytecode against a special browser (hosted mode)
    •  Cross-compile into standalone optimized JavaScript (web
       mode)
    •  No browser plugins / no obligatory server-side machinery
    •  Includes extensive cross-browser libraries
         •  User interface (DOM, widgets, ...)
         •  Client/server communication (XHR, RPC, JSON, ...)
         •  App infrastructure (history, timers, unit testing, i18n, a11y, ...)
         •  External services (Gadgets, Gears, Google Maps, ...)
    •  JavaScript integration
         •  JavaScript Native Interface (JSNI)
    •     Fully open source under Apache 2.0
8
What is GWT?




9
How it works




     Google Web Toolkit Weekly Report 09/01/2008 - 09/08/200
           Code against Java UI libraries




10
How it works




       Code against Java UI libraries




                                The compiler translates Java source to highly-optimized JS




11
How it works




                                                                               Generates browser-compliant JS + HTML files
       Code against Java UI libraries




                                The compiler translates Java source to highly-optimized JS




12
Key concepts




Productivity for you

                       Performance for your users
Custom JavaScript per browser
Demo: Getting started building
GWT apps
GWT Advantages
GWT Advantages – Faster Ajax applications
       Faster-than-you-would-write-by-hand code
       •  The efficient code you wish you could write, but will get
         slammed by cross-browser issues for trying to run it

       E.g.
     public static void onModuleLoad(){
       Button b = (new Button()).Button();
       b.setText("Click me!");
     }


         –  a variation for IE6 would be:
      public static final void onModuleLoad(){
        final Button b = Button.$Button(new Button());
        DOMImplIE6.$setInnerText(b.element, ”Click me!");
      }



17
GWT Advantages – Faster Ajax applications

       Faster-than-you-would-write-by-hand code
         –  Another variation:
     function onModuleLoad(){
       var b;
       b = $Button(new Button());
       $setInnerText(b.element, 'Click me!');
     }




18
GWT Advantages – Faster Ajax applications

        Faster-than-you-would-write-by-hand code
           –  Another variation
      function onModuleLoad(){
        var b;
        b = $Button(new Button());
        $setInnerText(b.element, ’Click me!');
      }

     •  You could have written this by hand, but:
       –  You would have to change it for every other browser




19
GWT Advantages – Faster Ajax applications

      Deferred binding
       •  Why give the user more than they asked for?
       •  Users only download what they need to run your
        application
       •  Made possible through the technique of deferred
        binding




20
GWT Advantages – Faster Ajax applications

      Deferred binding


      •  A technique that lets the compiler make different
       bindings for your application at compile-time and choose
       the right one later
      •  The application bootstrap process selects the correct
       binding when loading your application




21
GWT Advantages – Faster Ajax applications

      Deferred binding illustrated




22
GWT Advantages – No more memory leaks

     Preventing memory leaks
     •  Provided you only code in GWT
     •  Chances are, you may need to write a small bit of
       JavaScript Native Interface (JSNI) or interoperate
       with JavaScript code
     •  In those cases, you can prevent memory
       leaks by being careful
       –  See Joel Webber’s
          article on “DOM events, memory leaks, and you”‫‏‬
       –  http://code.google.com/p/google-web-toolkit/wiki/DomEventsAndMemoryLeaks

     •  In every other case, GWT has got your back



23
GWT Advantages – History support

            History support for your GWT applications
            •  GWT offers History support (RSH implementation)‫‏‬
     E.g.
tabPanel.add(new HTML("<h1>Page 1 Content</h1>"), " Page 1 ");
tabPanel.add(new HTML("<h1>Page 2 Content</h1>"), " Page 2 ");
tabPanel.addTabListener(new TabListener() {
  @Override
  public void onTabSelected(SourcesTabEvents sender, int tabIndex) {
    // Push an item onto the history stack
    History.newItem("page" + tabIndex);
}

History.addHistoryListener(new HistoryListener() {
   public void onHistoryChanged(String historyToken) {
     if(tokenIsValid(historyToken)) {
       tabPanel.selectTab(getTabIndex(historyToken));
     }
   }
};
24
GWT Advantages – Faster development

      Faster development with IDEs and code support


      •  Code refactoring with IDE tools greatly improve
       developer speed!




     Google Plugin for Eclipse – Support both GWT and
     App Engine
25
GWT Advantages – Faster development

     Faster development with IDEs and code support


     •  You can also thoroughly test your Ajax application using
      a combination of:
       –  Standard JUnit TestCase
       –  GWTTestCase
       –  HTMLUnit tests
       –  Selenium tests




26
GWT Advantages – Debugging in bytecode

      Debugging with hosted mode

     •  Debugging in hosted mode allows for rapid testing
        •  Running against JS bytecode in memory




27
Summary of development advantages

     •  Optimized, high performance Ajax applications
     •  As a developer, you don’t have to worry about:
       –  Browser quirk headaches
       –  Memory leaks
       –  History support
     •  Code reuse through design patterns
     •  Faster development using IDEs and other Java tools
     •  Debugging in bytecode




28
GWT Tools and Widgets
Google Plugin for Eclipse




 http://code.google.com/eclipse/
Widget libraries


•  GWT (http://code.google.com/webtoolkit/)
•  Incubator (http://code.google.com/p/google-web-toolkit-incubator/)

•    Smart GWT (http://code.google.com/p/smartgwt/)
•    GWT-Ext (http://code.google.com/p/gwt-ext/)
•    IT Mill Toolkit (http://www.itmill.com/)
•    GWT mosaic (http://code.google.com/p/gwt-mosaic/)
•    Ext GWT (http://extjs.com/products/gxt/)
•    Advanced GWT Components
     (http://advanced-gwt.sourceforge.net/)
New features coming in GWT 2.0
GWT 2.0: More advantages

     •  Hosted mode becomes “development mode”
     •  Code splitting
     •  Client bundle
     •  Declarative UI in XML (UiBinder)
     •  … and much more




33
Code Splitting: Big scripts, big problems

     •  Problem: Initial download can be slooooow
        –  Some apps becomes bigger over time
        –  Parsing through initial script can cause UI to hang
        –  Current day browsers have a two connection limit
     •  Solution: Split up the script!




34
Developer-guided code splitting with runAsync

                         public void onMySettingsLinkClicked() {

       Split point        GWT.runAsync(new RunAsyncCallback() {




  Runs after a short
(but improbable) delay    public void onSuccess() {
                             new MySettingsDialog().show();
                           }




Runs if required script public void onFailure(Throwable ohNo) {
cannot be downloaded        // indicate that something went wrong,
                            // usually a connectivity or server problem
                          }



35
runAsync() Helps Apps Startup More
                                           Quickly
                                            1500
                                                                                                        1400 KB
Size of Initial JavaScript Download (KB)




                                            1125
                                            1125




                                             750
                                                                          7x Decrease In
                                                                          Initial Download Size
                                                                          with runAsync()
                                             375



                                                                                                        200 KB

                                               0
                                               26-Nov   29-Apr   18-Jun    28-Jul   12-Sep   27-Oct   24-Dec     16-Mar
ImageBundle revisited

     •  Each <img> tag is one HTTP roundtrip
     •  Bundle them up!




     •  11 HTTP roundtrips become 1




37
Declarative UIs with UiBinder

     •  Build your UI in declarative XML

<!-- UserDashboard.ui.xml -->
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
    xmlns:g='urn:import:com.google.gwt.user.client.ui'
    xmlns:my='urn:import:com.my.app.widgets' >

  <g:HTMLPanel>
    <my:WeatherReport ui:field='weather'/>
    <my:Stocks ui:field='stocks'/>
    <my:CricketScores ui:field='scores' />
  </g:HTMLPanel>
</ui:UiBinder>




38
Who's using GWT?
Google Wave
Google Health
Mobile
Large GWT Apps - Lombardi Blueprint




                  Google Web Toolkit
Large GWT Apps – ContactOffice




                 Google Web Toolkit
Large GWT Apps - scenechronize




                 Google Web Toolkit
Many more in the GWT App Gallery
http://gwtgallery.appspot.com/




                                                  46
                             Google Web Toolkit
Learn more
code.google.com/webtoolkit
Muchas Gracias!




      Q&A

Weitere ähnliche Inhalte

Was ist angesagt?

Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Andreas Koop
 
Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Engine
catherinewall
 
Supporting Hyper-V 3.0 on Apache CloudStack
Supporting Hyper-V 3.0 on Apache CloudStackSupporting Hyper-V 3.0 on Apache CloudStack
Supporting Hyper-V 3.0 on Apache CloudStack
Donal Lafferty
 

Was ist angesagt? (20)

DotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + reactDotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + react
 
Java script nirvana in netbeans [con5679]
Java script nirvana in netbeans [con5679]Java script nirvana in netbeans [con5679]
Java script nirvana in netbeans [con5679]
 
Forensic Tools for In-Depth Performance Investigations
Forensic Tools for In-Depth Performance InvestigationsForensic Tools for In-Depth Performance Investigations
Forensic Tools for In-Depth Performance Investigations
 
Dojo (QCon 2007 Slides)
Dojo (QCon 2007 Slides)Dojo (QCon 2007 Slides)
Dojo (QCon 2007 Slides)
 
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
 
Java EE 7 Soup to Nuts at JavaOne 2014
Java EE 7 Soup to Nuts at JavaOne 2014Java EE 7 Soup to Nuts at JavaOne 2014
Java EE 7 Soup to Nuts at JavaOne 2014
 
Node js for enterprise
Node js for enterpriseNode js for enterprise
Node js for enterprise
 
vert.x - asynchronous event-driven web applications on the JVM
vert.x - asynchronous event-driven web applications on the JVMvert.x - asynchronous event-driven web applications on the JVM
vert.x - asynchronous event-driven web applications on the JVM
 
Performance tuning the Spring Pet Clinic sample application
Performance tuning the Spring Pet Clinic sample applicationPerformance tuning the Spring Pet Clinic sample application
Performance tuning the Spring Pet Clinic sample application
 
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
 
Spring Boot Revisited with KoFu and JaFu
Spring Boot Revisited with KoFu and JaFuSpring Boot Revisited with KoFu and JaFu
Spring Boot Revisited with KoFu and JaFu
 
Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Engine
 
Java Tech & Tools | Grails in the Java Enterprise | Peter Ledbrook
Java Tech & Tools | Grails in the Java Enterprise | Peter LedbrookJava Tech & Tools | Grails in the Java Enterprise | Peter Ledbrook
Java Tech & Tools | Grails in the Java Enterprise | Peter Ledbrook
 
Full stack development with Node and NoSQL - Austin Node.JS Group - October ...
Full stack development with Node and NoSQL -  Austin Node.JS Group - October ...Full stack development with Node and NoSQL -  Austin Node.JS Group - October ...
Full stack development with Node and NoSQL - Austin Node.JS Group - October ...
 
Supporting Hyper-V 3.0 on Apache CloudStack
Supporting Hyper-V 3.0 on Apache CloudStackSupporting Hyper-V 3.0 on Apache CloudStack
Supporting Hyper-V 3.0 on Apache CloudStack
 
YaJUG: What's new in GWT2
YaJUG: What's new in GWT2YaJUG: What's new in GWT2
YaJUG: What's new in GWT2
 
Novalug 07142012
Novalug 07142012Novalug 07142012
Novalug 07142012
 
MySQL Aquarium Paris
MySQL Aquarium ParisMySQL Aquarium Paris
MySQL Aquarium Paris
 
Meetup Performance
Meetup PerformanceMeetup Performance
Meetup Performance
 
Bundling your front-end with Webpack
Bundling your front-end with WebpackBundling your front-end with Webpack
Bundling your front-end with Webpack
 

Andere mochten auch

Konsonan bergabung
Konsonan bergabungKonsonan bergabung
Konsonan bergabung
annachieng
 

Andere mochten auch (8)

Finnish Lessons WA NMI
Finnish Lessons WA NMIFinnish Lessons WA NMI
Finnish Lessons WA NMI
 
AVG Internet of Things Survey Oct 2014
AVG Internet of Things Survey Oct 2014AVG Internet of Things Survey Oct 2014
AVG Internet of Things Survey Oct 2014
 
Acceptance and Commitment Therapy for People with MS
Acceptance and Commitment Therapy for People with MSAcceptance and Commitment Therapy for People with MS
Acceptance and Commitment Therapy for People with MS
 
4Q16 Global ISG Index Infographic
4Q16 Global ISG Index Infographic4Q16 Global ISG Index Infographic
4Q16 Global ISG Index Infographic
 
KESIHATAN MENTAL
KESIHATAN MENTALKESIHATAN MENTAL
KESIHATAN MENTAL
 
Konsonan bergabung
Konsonan bergabungKonsonan bergabung
Konsonan bergabung
 
Tema 1 b 1 & 2 psk tingkatan 3
Tema 1 b 1 & 2 psk tingkatan 3Tema 1 b 1 & 2 psk tingkatan 3
Tema 1 b 1 & 2 psk tingkatan 3
 
AWS re:Invent 2016: Large-scale AWS Migrations (ENT204)
AWS re:Invent 2016: Large-scale AWS Migrations (ENT204)AWS re:Invent 2016: Large-scale AWS Migrations (ENT204)
AWS re:Invent 2016: Large-scale AWS Migrations (ENT204)
 

Ähnlich wie Devfest09 Cschalk Gwt

Introduction to Google Web Toolkit
Introduction to Google Web ToolkitIntroduction to Google Web Toolkit
Introduction to Google Web Toolkit
Didier Girard
 
T 0230 Google Wave Powered By Gwt
T 0230 Google Wave Powered By GwtT 0230 Google Wave Powered By Gwt
T 0230 Google Wave Powered By Gwt
supertoy2015
 

Ähnlich wie Devfest09 Cschalk Gwt (20)

Introduction to Google Web Toolkit
Introduction to Google Web ToolkitIntroduction to Google Web Toolkit
Introduction to Google Web Toolkit
 
GWT HJUG Presentation
GWT HJUG PresentationGWT HJUG Presentation
GWT HJUG Presentation
 
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
 
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
 
T 0230 Google Wave Powered By Gwt
T 0230 Google Wave Powered By GwtT 0230 Google Wave Powered By Gwt
T 0230 Google Wave Powered By Gwt
 
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
 
Developing High Performance Web Apps
Developing High Performance Web AppsDeveloping High Performance Web Apps
Developing High Performance Web Apps
 
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
 
Gwt.Create Keynote San Francisco
Gwt.Create Keynote San FranciscoGwt.Create Keynote San Francisco
Gwt.Create Keynote San Francisco
 
An introduction to Node.js
An introduction to Node.jsAn introduction to Node.js
An introduction to Node.js
 
qooxdoo - Open Source Ajax Framework
qooxdoo - Open Source Ajax Frameworkqooxdoo - Open Source Ajax Framework
qooxdoo - Open Source Ajax Framework
 
Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Building Web Apps Sanely - EclipseCon 2010
Building Web Apps Sanely - EclipseCon 2010Building Web Apps Sanely - EclipseCon 2010
Building Web Apps Sanely - EclipseCon 2010
 
Easing offline web application development with GWT
Easing offline web application development with GWTEasing offline web application development with GWT
Easing offline web application development with GWT
 
JBoss World 2010
JBoss World 2010JBoss World 2010
JBoss World 2010
 
Transforming the web into a real application platform
Transforming the web into a real application platformTransforming the web into a real application platform
Transforming the web into a real application platform
 
Introduction to Jquery
Introduction to JqueryIntroduction to Jquery
Introduction to Jquery
 
Extending GWT
Extending GWTExtending GWT
Extending GWT
 
The Java alternative to Javascript
The Java alternative to JavascriptThe Java alternative to Javascript
The Java alternative to Javascript
 

Mehr von Chris Schalk

Javaedge 2010-cschalk
Javaedge 2010-cschalkJavaedge 2010-cschalk
Javaedge 2010-cschalk
Chris Schalk
 

Mehr von Chris Schalk (20)

Google App Engine Overview and Update
Google App Engine Overview and UpdateGoogle App Engine Overview and Update
Google App Engine Overview and Update
 
Building Integrated Applications on Google's Cloud Technologies
Building Integrated Applications on Google's Cloud TechnologiesBuilding Integrated Applications on Google's Cloud Technologies
Building Integrated Applications on Google's Cloud Technologies
 
How to build Kick Ass Games in the Cloud
How to build Kick Ass Games in the CloudHow to build Kick Ass Games in the Cloud
How to build Kick Ass Games in the Cloud
 
Building Kick Ass Video Games for the Cloud
Building Kick Ass Video Games for the CloudBuilding Kick Ass Video Games for the Cloud
Building Kick Ass Video Games for the Cloud
 
Building Integrated Applications on Google's Cloud Technologies
Building Integrated Applications on Google's Cloud TechnologiesBuilding Integrated Applications on Google's Cloud Technologies
Building Integrated Applications on Google's Cloud Technologies
 
GDD 2011 - How to build kick ass video games for the cloud
GDD 2011 - How to build kick ass video games for the cloudGDD 2011 - How to build kick ass video games for the cloud
GDD 2011 - How to build kick ass video games for the cloud
 
Quick Intro to Google Cloud Technologies
Quick Intro to Google Cloud TechnologiesQuick Intro to Google Cloud Technologies
Quick Intro to Google Cloud Technologies
 
Intro to Google's Cloud Technologies
Intro to Google's Cloud TechnologiesIntro to Google's Cloud Technologies
Intro to Google's Cloud Technologies
 
Introduction to Google's Cloud Technologies
Introduction to Google's Cloud TechnologiesIntroduction to Google's Cloud Technologies
Introduction to Google's Cloud Technologies
 
Google App Engine's Latest Features
Google App Engine's Latest FeaturesGoogle App Engine's Latest Features
Google App Engine's Latest Features
 
Building Apps on Google Cloud Technologies
Building Apps on Google Cloud TechnologiesBuilding Apps on Google Cloud Technologies
Building Apps on Google Cloud Technologies
 
Google App Engine's Latest Features
Google App Engine's Latest FeaturesGoogle App Engine's Latest Features
Google App Engine's Latest Features
 
Building Multi-platform Video Games for the Cloud
Building Multi-platform Video Games for the CloudBuilding Multi-platform Video Games for the Cloud
Building Multi-platform Video Games for the Cloud
 
Building Enterprise Applications on Google Cloud Platform Cloud Computing Exp...
Building Enterprise Applications on Google Cloud Platform Cloud Computing Exp...Building Enterprise Applications on Google Cloud Platform Cloud Computing Exp...
Building Enterprise Applications on Google Cloud Platform Cloud Computing Exp...
 
Introduction to Google's Cloud Technologies
Introduction to Google's Cloud TechnologiesIntroduction to Google's Cloud Technologies
Introduction to Google's Cloud Technologies
 
Javaedge 2010-cschalk
Javaedge 2010-cschalkJavaedge 2010-cschalk
Javaedge 2010-cschalk
 
Introduction to Google Cloud Platform Technologies
Introduction to Google Cloud Platform TechnologiesIntroduction to Google Cloud Platform Technologies
Introduction to Google Cloud Platform Technologies
 
Google Cloud Technologies Overview
Google Cloud Technologies OverviewGoogle Cloud Technologies Overview
Google Cloud Technologies Overview
 
Introducing App Engine for Business
Introducing App Engine for BusinessIntroducing App Engine for Business
Introducing App Engine for Business
 
Introduction to Google Cloud platform technologies
Introduction to Google Cloud platform technologiesIntroduction to Google Cloud platform technologies
Introduction to Google Cloud platform technologies
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Kürzlich hochgeladen (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 

Devfest09 Cschalk Gwt

  • 1.
  • 2. Google Web Toolkit: A technical overview Chris Schalk Con: Gabriel Praino DevFest 2009 November 17th, 2009
  • 3. Agenda •  AJAX: what it is and why it's important •  Introducing GWT •  GWT advantages •  GWT 2.0 features •  Who’s using GWT •  Q&A 3
  • 4. AJAX... uh... what? •  Also known as Asynchronous JavaScript And XML •  JavaScript can issue asynchronous server requests •  JavaScript can manipulate the user interface 4
  • 6. The AJAX slippery slope •  Experiment with “a bit of script” •  Everybody loves it! More! •  When did we became an AJAX shop? •  Attempt to port to something other than Internet Explorer •  Wait... this is hard! •  Result: “A tangled mess!” 6
  • 7. GWT’s Mission "GWT's mission is to radically improve the web experience for users by enabling developers to use existing Java tools to build no-compromise AJAX for any modern browser." 7
  • 8. Google Web Toolkit at a glance •  Write code in the JavaTM language using your favorite Java IDE •  Debug as bytecode against a special browser (hosted mode) •  Cross-compile into standalone optimized JavaScript (web mode) •  No browser plugins / no obligatory server-side machinery •  Includes extensive cross-browser libraries •  User interface (DOM, widgets, ...) •  Client/server communication (XHR, RPC, JSON, ...) •  App infrastructure (history, timers, unit testing, i18n, a11y, ...) •  External services (Gadgets, Gears, Google Maps, ...) •  JavaScript integration •  JavaScript Native Interface (JSNI) •  Fully open source under Apache 2.0 8
  • 10. How it works Google Web Toolkit Weekly Report 09/01/2008 - 09/08/200 Code against Java UI libraries 10
  • 11. How it works Code against Java UI libraries The compiler translates Java source to highly-optimized JS 11
  • 12. How it works Generates browser-compliant JS + HTML files Code against Java UI libraries The compiler translates Java source to highly-optimized JS 12
  • 13. Key concepts Productivity for you Performance for your users
  • 15. Demo: Getting started building GWT apps
  • 17. GWT Advantages – Faster Ajax applications Faster-than-you-would-write-by-hand code •  The efficient code you wish you could write, but will get slammed by cross-browser issues for trying to run it E.g. public static void onModuleLoad(){ Button b = (new Button()).Button(); b.setText("Click me!"); } –  a variation for IE6 would be: public static final void onModuleLoad(){ final Button b = Button.$Button(new Button()); DOMImplIE6.$setInnerText(b.element, ”Click me!"); } 17
  • 18. GWT Advantages – Faster Ajax applications Faster-than-you-would-write-by-hand code –  Another variation: function onModuleLoad(){ var b; b = $Button(new Button()); $setInnerText(b.element, 'Click me!'); } 18
  • 19. GWT Advantages – Faster Ajax applications Faster-than-you-would-write-by-hand code –  Another variation function onModuleLoad(){ var b; b = $Button(new Button()); $setInnerText(b.element, ’Click me!'); } •  You could have written this by hand, but: –  You would have to change it for every other browser 19
  • 20. GWT Advantages – Faster Ajax applications Deferred binding •  Why give the user more than they asked for? •  Users only download what they need to run your application •  Made possible through the technique of deferred binding 20
  • 21. GWT Advantages – Faster Ajax applications Deferred binding •  A technique that lets the compiler make different bindings for your application at compile-time and choose the right one later •  The application bootstrap process selects the correct binding when loading your application 21
  • 22. GWT Advantages – Faster Ajax applications Deferred binding illustrated 22
  • 23. GWT Advantages – No more memory leaks Preventing memory leaks •  Provided you only code in GWT •  Chances are, you may need to write a small bit of JavaScript Native Interface (JSNI) or interoperate with JavaScript code •  In those cases, you can prevent memory leaks by being careful –  See Joel Webber’s article on “DOM events, memory leaks, and you”‫‏‬ –  http://code.google.com/p/google-web-toolkit/wiki/DomEventsAndMemoryLeaks •  In every other case, GWT has got your back 23
  • 24. GWT Advantages – History support History support for your GWT applications •  GWT offers History support (RSH implementation)‫‏‬ E.g. tabPanel.add(new HTML("<h1>Page 1 Content</h1>"), " Page 1 "); tabPanel.add(new HTML("<h1>Page 2 Content</h1>"), " Page 2 "); tabPanel.addTabListener(new TabListener() { @Override public void onTabSelected(SourcesTabEvents sender, int tabIndex) { // Push an item onto the history stack History.newItem("page" + tabIndex); } History.addHistoryListener(new HistoryListener() { public void onHistoryChanged(String historyToken) { if(tokenIsValid(historyToken)) { tabPanel.selectTab(getTabIndex(historyToken)); } } }; 24
  • 25. GWT Advantages – Faster development Faster development with IDEs and code support •  Code refactoring with IDE tools greatly improve developer speed! Google Plugin for Eclipse – Support both GWT and App Engine 25
  • 26. GWT Advantages – Faster development Faster development with IDEs and code support •  You can also thoroughly test your Ajax application using a combination of: –  Standard JUnit TestCase –  GWTTestCase –  HTMLUnit tests –  Selenium tests 26
  • 27. GWT Advantages – Debugging in bytecode Debugging with hosted mode •  Debugging in hosted mode allows for rapid testing •  Running against JS bytecode in memory 27
  • 28. Summary of development advantages •  Optimized, high performance Ajax applications •  As a developer, you don’t have to worry about: –  Browser quirk headaches –  Memory leaks –  History support •  Code reuse through design patterns •  Faster development using IDEs and other Java tools •  Debugging in bytecode 28
  • 29. GWT Tools and Widgets
  • 30. Google Plugin for Eclipse http://code.google.com/eclipse/
  • 31. Widget libraries •  GWT (http://code.google.com/webtoolkit/) •  Incubator (http://code.google.com/p/google-web-toolkit-incubator/) •  Smart GWT (http://code.google.com/p/smartgwt/) •  GWT-Ext (http://code.google.com/p/gwt-ext/) •  IT Mill Toolkit (http://www.itmill.com/) •  GWT mosaic (http://code.google.com/p/gwt-mosaic/) •  Ext GWT (http://extjs.com/products/gxt/) •  Advanced GWT Components (http://advanced-gwt.sourceforge.net/)
  • 32. New features coming in GWT 2.0
  • 33. GWT 2.0: More advantages •  Hosted mode becomes “development mode” •  Code splitting •  Client bundle •  Declarative UI in XML (UiBinder) •  … and much more 33
  • 34. Code Splitting: Big scripts, big problems •  Problem: Initial download can be slooooow –  Some apps becomes bigger over time –  Parsing through initial script can cause UI to hang –  Current day browsers have a two connection limit •  Solution: Split up the script! 34
  • 35. Developer-guided code splitting with runAsync public void onMySettingsLinkClicked() { Split point GWT.runAsync(new RunAsyncCallback() { Runs after a short (but improbable) delay public void onSuccess() { new MySettingsDialog().show(); } Runs if required script public void onFailure(Throwable ohNo) { cannot be downloaded // indicate that something went wrong, // usually a connectivity or server problem } 35
  • 36. runAsync() Helps Apps Startup More Quickly 1500 1400 KB Size of Initial JavaScript Download (KB) 1125 1125 750 7x Decrease In Initial Download Size with runAsync() 375 200 KB 0 26-Nov 29-Apr 18-Jun 28-Jul 12-Sep 27-Oct 24-Dec 16-Mar
  • 37. ImageBundle revisited •  Each <img> tag is one HTTP roundtrip •  Bundle them up! •  11 HTTP roundtrips become 1 37
  • 38. Declarative UIs with UiBinder •  Build your UI in declarative XML <!-- UserDashboard.ui.xml --> <ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g='urn:import:com.google.gwt.user.client.ui' xmlns:my='urn:import:com.my.app.widgets' > <g:HTMLPanel> <my:WeatherReport ui:field='weather'/> <my:Stocks ui:field='stocks'/> <my:CricketScores ui:field='scores' /> </g:HTMLPanel> </ui:UiBinder> 38
  • 43. Large GWT Apps - Lombardi Blueprint Google Web Toolkit
  • 44. Large GWT Apps – ContactOffice Google Web Toolkit
  • 45. Large GWT Apps - scenechronize Google Web Toolkit
  • 46. Many more in the GWT App Gallery http://gwtgallery.appspot.com/ 46 Google Web Toolkit