SlideShare ist ein Scribd-Unternehmen logo
1 von 68
GWT = Easy AJAX
L o r ra i n e J u g
7 / 1 2/ 20 09
Who am I?
Olivier Gérardin
Technical Director, Sfeir Benelux (groupe Sfeir)
Java / Web architect
13+ years Java
3 years GWT
gerardin.o@sfeir.lu
blog.gerardin.info
Agenda
Little GWT showcase
Why GWT?
How does it work?
Key features
Myths & misconceptions
Pointers, Conclusion, Q&A
GWT Showcase
Ext-GWT explorer
Piano Etudes
GWTUML
Clarity Accounting
ContactOffice
MyERP, Compiere
And more: Google Wave, Timetonote CRM
…
Why GWT?
The web 0.0
Or “The Link Era”
 A web page is just a bunch of images and text with links
 Links take you to a new page
 Click on link
 HTTP request is built (from static link URL) and sent
 Wait for server to reply
 Server replies with HTML page (usually from static storage)
 Response received  blank screen
 Wait for entire page to load
“Dynamic” web with forms (web 1.0)
Or “The Form Era”
 In addition to images and text, a web page can contain fields and other
widgets
 A designated button submits the form
 Fill in form
 Submit
 HTTP request is built (from form parameters and field values) and sent
 Wait for server to reply
 Server replies with HTML page (usually generated on server)
 Response received  blank screen
 Wait for entire page to load
An example of form-based web application: Squirrel
mail
Server side processing
CGI
 Basic bridge to OS commands
 Very ineffective (1 request = 1 process)
Web server with dedicated module (PHP, …)
 Scripted
 Usually interpreted
Application server with thread pool management (JSP, …)
 More effective
 JSPs are compiled at first invocation
ASP, perl, whatever
…still requires full page reload
Java Applets
Plain Java application inside a web page!
Server interaction without page reload!
Rich UI (Swing)!
But…
 No consistent JVM support (MS vs Netscape/Sun)
 Sloooooooow start
 Hard to interface with the rest of the page
 Mostly seen as a gadget for irritating animations
There comes JavaScript
Client-side scripting
First usage: server-side form validation
 Avoid server round-trip when invalid
 Instant feedback
With DHTML: polymorphic client page
 Menus, animations, etc.
Cross-browser (almost)
Still no server interaction without submit/reload 
XHTTPR and AJAX
MS introduces Office Web Access
 JavaScript “clone” of desktop client (Outlook)
 Fetches data from server without reloading page!
How is that possible?
 New class: XmlHttpRequest
 Allows server interaction without page reload
 Response received asynchronously
 Interface updated through DOM
AJAX is born!
The first AJAX app: Outlook Web Access
JavaScript frenzy
JS becomes hype…
Cool-looking, nice to use web UIs
Everyone wants to do JavaScript
Any serious web site must have dynamic content, auto-
completion or other AJAX goodies
Widget sets / frameworks begin to emerge
 Scriptaculous, YUI, dojo, jScript, …
Anything seems possible in JavaScript
 JavaScript OS, AjaxSwing (WebCream), …
JavaScript hangover
Serious JavaScript hurts…
 Cross-browser compatibility nightmare
 Fix in one, break in another
 JavaScript Guru required!
 Developing/Debugging nightmare
 Weird runtime errors
 No static typing
 No refactoring
 And..
 Memory leaks
 Heavy pages
 Security issues
JavaScript confusion
Source: BrowserBook © Visibone
What to do?
Change jobs?
Subcontract?
Give up dynamic pages?
 Back to web 1.0…
Target a single browser?
 Not an option for Internet apps
Give up AJAX and use other technology?
 Plugin required
 SEO unfriendly
 Proprietary environment / learning curve
 What server-side technology to match?
Use GWT !
GWT gives you AJAX without the pain of JavaScript
development
 Takes care of cross-browser issues
 Allows full debugging (breakpoints, step by step, inspecting/watching
variables)
 Strong static typing  early error detection
 Full refactoring options
 No browser plugin or mandatory IDE
 Short learning curve
 Simple RPC mechanism
 But can communicate with any server technology
Program in Java…
GWT allows developing client-side web apps in full Java
(with only a few restrictions)
 Leverage existing Java tools and skills
 Use any IDE (Eclipse, NetBeans, IntelliJ, …)
Program like a traditional graphical client (Swing, SWT, …)
 Widgets, containers, listeners, etc.
 Use OO patterns (MVC, MVP, observer, composite, etc.)
Test like any Java app
 Use standard Java debuggers
 Test with JUnit
… forget JavaScript!
JavaScript is only generated:
 For deployment
 To test in actual web mode
GWT’s promise is that the generated JavaScript app
behaves exactly like the Java app
 And it does (most of the time)
(forgetting JavaScript not mandatory)
How does it work?
4 easy pieces
1) Java-to-JavaScript compiler
2) JRE emulation library
3) Java libraries
4) Hosted Development mode
GWT compiler
Generates JS code from Java sources
Performs numerous optimizations
 In most cases better than hand coding
 Can generate obfuscated (ultra-compact) code
JS plays a role similar to bytecode for compiled Java
applications
JRE Emulation library
Provides a GWT-compatible version of Java core
classes
 Most of java.lang
 Most of java.util
 Some classes of java.io and java.sql
 For convenience only! No real I/O or JDBC!
Used when running in web mode
 Hosted mode runs in a JVM with standard JRE
GWT Java libraries
Utility classes
 RPC, I18N, …
Widget set
 Simple widgets (Button, TextField, …)
 Base building blocks
 In most cases map to native HTML object
 Composites = widgets built from other widgets
 Panels = widget containers
 Panels enforce a layout (vertical, horizontal, grid, …)
GWT widgets: Simple widgets
GWT widgets: Composites
GWT widgets: Panels
Hosted / Development mode
Allows running GWT apps without converting them to
JavaScript
 Code runs as Java bytecode in a standard JVM
 Embedded web browser emulates HTML rendering
 platform-dependant…
 Performs extensive checks to make sure the code is compilable to
JavaScript
Bottom line: if a GWT application performs as expected in
development mode, it will perform identically in web mode
 True 99,9% of the time
Key features
Easy development
During development, you are writing and running a
classic Java app
 Use your favorite IDE
 All IDE features available (code completion, code analysis,
refactoring, links, Javadoc, …)
 Plugins help GWT-specific tasks (launching, compiling,
creating RPC services, …)
Easy RPC
RPC mechanism based on Java servlets
Easy as:
1. Define service interface
int add (int x, int y);
3. Derive asynchronous interface
void add (int x, int y,
AsyncCallback<Integer> callback);
5. Implement service interface (server-side)
public int add (int x, int y) {
return x + y;
}
Easy JSON generation
Easy as:
JSONObject livre = new JSONObject();
livre.put("Titre", new JSONString("GWT"));
livre.put("Pages", new JSONNumber(123));
JSONArray chapitres = new JSONArray();
chapitres.set(0, new JSONString("Introduction"));
Easy JSON parsing
Easy as:
JSONObject livre = new JSONObject(json);
String titre = livre.get("Titre").isString().stringValue();
double pages = livre.get("Pages").isNumber().doubleValue();
JSONArray chapitres = livre.isArray();
String chap0 = chapitres.get(0).isString().stringValue();
Deferred binding
Appropriate code for user environment (browser, locale) is
chosen at application startup time
 ≠ dynamic binding (implementation chosen at runtime)
 ≠ static binding (implementation chosen at compile time)
Code for every combination is generated at compile time
Advantages:
 Allows app-wide optimizations
 Compensates for the lack of dynamic (runtime) loading
Disadvantages:
 Increases compilation time
Deferred Binding (explicit)
Deferred binding can be called explicitly:
Foo foo = GWT.create(Foo.class);
Implementation is provided by either:
 Substitution: an existing class is designated
 Generation: class is generated during compilation
Easy native JavaScript integration
Implement a method directly in JavaScript:
public static native void alert(String msg) /*-{
$wnd.alert(msg);
}-*/;
 Call back Java methods from JavaScript
 Pass objects back and forth
Useful to wrap legacy JavaScript libraries
Easy Widget reuse
Create your own widgets:
 Extend existing widget
 Works but not the most efficient
 Might expose unwanted methods from superclass
 Extend Composite
 Recommended method
 Use JSNI
 To wrap existing JavaScript widgets
Easy history support
AJAX app = single page
 “back” button  catastrophe…
GWT solution:
 Encode app state in URL as “fragment”
 E.g. http://myserver/myGwtApp#x=1;y=2
 Save state:
 History.newItem(token);
 React to state change (“back” button)
 History.addValueChangeHandler(…);
Easy i18n
Taking advantage of Deferred Binding
1. Define interface:
public interface AppConstants extends Constants {
String title();
}
3. “Implement” interface (AppConstants.properties):
title = Hello, World
5. Use:
AppConstants appConstants = GWT.create(AppConstants.class);
String title = appConstants.title();
Easy i18n
More advanced i18n
1. Define interface:
public interface AppMessages extends Messages {
String mailStatus(int n, String s);
}
3. “Implement” interface (AppMessages.properties):
mailStatus = You have {0} messages in folder {1}
5. Use:
AppMessages msgs = GWT.create(AppMessages.class);
String status = msgs.mailStatus(15, “Inbox”);
Easy debugging
In development mode, application runs as bytecode
(just like any old Java app…)
So you can debug it just like any classic Java app:
 Set breakpoints
 Step through code
 Inspect variables
 Change variables
 …
Easy client-server testing
Integrated application server for testing RPC
services
 Can be disabled to use external server
JUnit integration to run client-side test cases
 Hosted mode or web mode
 Full access to RPC services
 GWTTestCase, GWTTestSuite for automation
Selenium for automated GUI testing
Short dev cycle
Change client code:
 press “Reload”.. Done!
Change server code:
 Embedded server: press “Restart”.. Done!
 External server: hotswap /redeploy if needed
Easy scaling
All session data resides on client
 Similar to classic fat client
No session information on server-side
 Forget session affinity
 Add/remove servers on the fly
 Restart server without losing clients
“Easy” styling
Styling relies entirely on CSS
 Widgets have well-known styles
 Programmer can add custom styles
No shift from traditional HTML styling
 HTML/DOM build page “skeleton”
 Appearance tuned with CSS
Separate UI construction from styling
 With well thought styles, it’s possible to reskin completely an application without
changing one line of code
GWT styling has all the benefits of CSS with all problems of CSS
 Be careful with brower dependencies!
Easy Google APIs
Project gwt-google-apis
http://code.google.com/p/gwt-google-apis
 Libraries that wrap Google JavaScript APIs
 Gears,
 gadgets,
 AJAX search,
 Maps,
 Visualization,
 Language,
 AjaxLoader
 Standalone libraries (do not require JavaScript libraries)
[new in 2.0] in-browser development mode
Before: hosted mode uses customized browser
engine
 Heavily customized
 Only one supported browser per platform (IE on Windows, WebKit
on Mac, Mozilla on Linux)
 Platform-specific code (SWT)
 Difficult to keep up-to-date
 Browser and hosted application share the same process
 Most plugins don’t work (including Google Gears…)
[new in 2.0] in-browser development mode
After:
 Hosted mode shell runs outside browser
 Communicates with browser using plugin through TCP
[new in 2.0] in-browser development mode
Benefits
 Use any (supported) browser/version on any platform
 Behavior closer to web mode
 No interference with browser plugins
 No more platform-specific stuff in GWT (one jar for all!)
 Network protocol cross-platform possible
 Dev mode shell on machine X, slave browser on machine Y
 E.g. dev on Linux, test in IE on Windows…
[new in 2.0] code splitting
Before: monolithic download can become very big
 Slow startup times
After:
 Programmer can insert “split points” in code
 Hints for the compiler to place everything not required up to split point in
separate download
 Compiler divides code in several “chunks”, which are loaded on-demand
Benefits:
 Initial loading time reduced 50% on average with a single split point
 Allows on-demand module loading
[new in 2.0] declarative UI
Declarative construction of GUI using XML grammar
Allows automatic binding with Java code
 Assign widget references to Java fields
 Automatically attach methods as event handlers
Benefits:
 Clearly separate:
 Static UI construction (XML)
 Dynamic UI behavior (Java)
[new in 2.0] resource bundle
Download multiple heterogeneous resources from server in
a single request
 Images (already possible in pre-2.0)
 CSS
 Text
 Any binary resource
Benefits:
 Fewer round trips to the server
 Less overhead
 More responsive interface
Myths & misconceptions
Myth: GWT is a JS library/framework/widget set
GWT is not for JavaScript developers
Provides only Java classes
Myth: GWT is a framework
GWT is a toolkit (set of tools)
Frameworks may be built on top of it
Myth: GWT is applets
GWT app is full JavaScript
No runtime/plugin
No JRE required
Myth: GWT is only for Java programmers
Yes, GWT uses Java as programming language…
BUT you can also see it this way:
GWT lets you write/debug/test/refactor AJAX apps
with state-of-the-art IDEs and tools using a
statically-typed object-oriented language
GWT makes it worth learning Java!
Myth: GWT generates poorly performing JS
The GWT compiler generates highly optimized and
compact code
Hand written JavaScript might be marginally faster
in some cases, but it’s not worth the trouble
Myth: GWT only works with a Java backend
GWT includes a simple and efficient RPC
mechanism that relies on Java servlets
BUT it plays nice with any server-side technology that
can handle HTTP requests (even PHP)
 Includes XML encoding/decoding library
 Includes JSON encoding/decoding library
Myth: GWT has poor UI components
Yes, GWT’s builtin widgets are minimalistic…
BUT it’s not the point to provide a complete and
beautiful widget set
GWT provides the basis for rich and good-looking
components
Create your own or use 3rd party
 See Ext-GWT, SmartGWT
Myth: GWT apps have long startup times
Not longer than any JavaScript app
Obfuscation reduces size
Deferred binding loads just the necessary code for
the platform/language
GWT 2.0’s code splitting can split code in several
chunks
 Smaller initial download
 On-demand downloading
Myth: GWT doesn’t integrate with existing sites
GWT was designed from the beginning with the goal
to integrate well into existing sites
Very easy to add GWT to an existing page
 Only a few lines of HTML
 Can “hook up” to any DOM element
Myth: GWT has poor skinning possibilities
GWT uses CSS for styling
Can reskin a whole application without changing a
line of code (done that!)
Can split work between developer (behavior) and
designer (appearance)
Caution: CSS can introduce browser dependencies
Conclusion
Is GWT the future of web development?
GWT has passed reality check
Who wants to hand-write JavaScript for 6 different
browsers (and maintain it) ?
GWT = easy AJAX now !
=
Pointers
GWT home (downloads, docs, FAQs, guides, etc.)
 http://code.google.com/toolkit
Google groups “GWT” group
 http://groups.google.com/group/Google-Web-Toolkit
onGWT: fresh news about GWT
 http://www.ongwt.com
LinkedIn “GWT Users” group
 http://www.linkedin.com/groups?gid=129889
Shameless self-promotion
Thank you
Questions?

Weitere ähnliche Inhalte

Was ist angesagt?

learn mvc project in 7 day
learn mvc project in 7 daylearn mvc project in 7 day
learn mvc project in 7 dayQuach Long
 
Workshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsWorkshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsSami Ekblad
 
Hackathon - Building vaadin add on components
Hackathon - Building vaadin add on componentsHackathon - Building vaadin add on components
Hackathon - Building vaadin add on componentsJoonas Lehtinen
 
How To Build a Multi-Field Search Page For Your XPages Application
How To Build a Multi-Field Search Page For Your XPages ApplicationHow To Build a Multi-Field Search Page For Your XPages Application
How To Build a Multi-Field Search Page For Your XPages ApplicationMichael McGarel
 
HTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applicationsHTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applicationsJames Pearce
 
Tellurium At Rich Web Experience2009
Tellurium At Rich Web Experience2009Tellurium At Rich Web Experience2009
Tellurium At Rich Web Experience2009John.Jian.Fang
 
Vuejs getting-started - Extended Version
Vuejs getting-started - Extended VersionVuejs getting-started - Extended Version
Vuejs getting-started - Extended VersionMurat Doğan
 
當ZK遇見Front-End
當ZK遇見Front-End當ZK遇見Front-End
當ZK遇見Front-End祁源 朱
 
Gwt.Create Keynote San Francisco
Gwt.Create Keynote San FranciscoGwt.Create Keynote San Francisco
Gwt.Create Keynote San FranciscoRay Cromwell
 
Unobtrusive JavaScript with jQuery
Unobtrusive JavaScript with jQueryUnobtrusive JavaScript with jQuery
Unobtrusive JavaScript with jQuerySimon Willison
 
CTS Conference Web 2.0 Tutorial Part 2
CTS Conference Web 2.0 Tutorial Part 2CTS Conference Web 2.0 Tutorial Part 2
CTS Conference Web 2.0 Tutorial Part 2Geoffrey Fox
 
Wakanda - apps.berlin.js - 2012-11-29
Wakanda - apps.berlin.js - 2012-11-29Wakanda - apps.berlin.js - 2012-11-29
Wakanda - apps.berlin.js - 2012-11-29Alexandre Morgaut
 
jQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesjQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesTeamstudio
 
How to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScriptHow to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScriptKaty Slemon
 
Vue js and Vue Material
Vue js and Vue MaterialVue js and Vue Material
Vue js and Vue MaterialEueung Mulyana
 

Was ist angesagt? (20)

learn mvc project in 7 day
learn mvc project in 7 daylearn mvc project in 7 day
learn mvc project in 7 day
 
Workshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsWorkshop: Building Vaadin add-ons
Workshop: Building Vaadin add-ons
 
Hackathon - Building vaadin add on components
Hackathon - Building vaadin add on componentsHackathon - Building vaadin add on components
Hackathon - Building vaadin add on components
 
How To Build a Multi-Field Search Page For Your XPages Application
How To Build a Multi-Field Search Page For Your XPages ApplicationHow To Build a Multi-Field Search Page For Your XPages Application
How To Build a Multi-Field Search Page For Your XPages Application
 
HTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applicationsHTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applications
 
Vaadin & Web Components
Vaadin & Web ComponentsVaadin & Web Components
Vaadin & Web Components
 
Introduction of React.js
Introduction of React.jsIntroduction of React.js
Introduction of React.js
 
Fast mobile web apps
Fast mobile web appsFast mobile web apps
Fast mobile web apps
 
Why Vue.js?
Why Vue.js?Why Vue.js?
Why Vue.js?
 
Tellurium At Rich Web Experience2009
Tellurium At Rich Web Experience2009Tellurium At Rich Web Experience2009
Tellurium At Rich Web Experience2009
 
Learn react-js
Learn react-jsLearn react-js
Learn react-js
 
Vuejs getting-started - Extended Version
Vuejs getting-started - Extended VersionVuejs getting-started - Extended Version
Vuejs getting-started - Extended Version
 
當ZK遇見Front-End
當ZK遇見Front-End當ZK遇見Front-End
當ZK遇見Front-End
 
Gwt.Create Keynote San Francisco
Gwt.Create Keynote San FranciscoGwt.Create Keynote San Francisco
Gwt.Create Keynote San Francisco
 
Unobtrusive JavaScript with jQuery
Unobtrusive JavaScript with jQueryUnobtrusive JavaScript with jQuery
Unobtrusive JavaScript with jQuery
 
CTS Conference Web 2.0 Tutorial Part 2
CTS Conference Web 2.0 Tutorial Part 2CTS Conference Web 2.0 Tutorial Part 2
CTS Conference Web 2.0 Tutorial Part 2
 
Wakanda - apps.berlin.js - 2012-11-29
Wakanda - apps.berlin.js - 2012-11-29Wakanda - apps.berlin.js - 2012-11-29
Wakanda - apps.berlin.js - 2012-11-29
 
jQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesjQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPages
 
How to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScriptHow to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScript
 
Vue js and Vue Material
Vue js and Vue MaterialVue js and Vue Material
Vue js and Vue Material
 

Ähnlich wie GWT

Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitIMC Institute
 
Introduction to Google Web Toolkit
Introduction to Google Web ToolkitIntroduction to Google Web Toolkit
Introduction to Google Web ToolkitDidier Girard
 
Google Web Toolkit Introduction - eXo Platform SEA
Google Web Toolkit Introduction - eXo Platform SEAGoogle Web Toolkit Introduction - eXo Platform SEA
Google Web Toolkit Introduction - eXo Platform SEAnerazz08
 
Writing and Testing JavaScript-heavy Web 2.0 apps with JSUnit
Writing and Testing JavaScript-heavy Web 2.0 apps with JSUnitWriting and Testing JavaScript-heavy Web 2.0 apps with JSUnit
Writing and Testing JavaScript-heavy Web 2.0 apps with JSUnitAlex Chaffee
 
Google Dev Day2007
Google Dev Day2007Google Dev Day2007
Google Dev Day2007lucclaes
 
Gwt session
Gwt sessionGwt session
Gwt sessionMans Jug
 
Building Ajax apps with the Google Web Toolkit
Building Ajax apps with the Google Web ToolkitBuilding Ajax apps with the Google Web Toolkit
Building Ajax apps with the Google Web Toolkitvivek_prahlad
 
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/2JooinK
 
Beyond HTML: Tools for Building Web 2.0 Apps
Beyond HTML: Tools for Building Web 2.0 AppsBeyond HTML: Tools for Building Web 2.0 Apps
Beyond HTML: Tools for Building Web 2.0 AppsMarcos Caceres
 
Developing For The Web
Developing For The WebDeveloping For The Web
Developing For The Webaleemb
 
WAD - WaveMaker tutorial
WAD - WaveMaker tutorial WAD - WaveMaker tutorial
WAD - WaveMaker tutorial marina2207
 
WaveMaker tutorial with Flash
WaveMaker tutorial with FlashWaveMaker tutorial with Flash
WaveMaker tutorial with Flashmarina2207
 
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
 

Ähnlich wie GWT (20)

GWT = easy AJAX
GWT = easy AJAXGWT = easy AJAX
GWT = easy AJAX
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
 
Introduction to Google Web Toolkit
Introduction to Google Web ToolkitIntroduction to Google Web Toolkit
Introduction to Google Web Toolkit
 
Gwt Presentation1
Gwt Presentation1Gwt Presentation1
Gwt Presentation1
 
Google Web Toolkit Introduction - eXo Platform SEA
Google Web Toolkit Introduction - eXo Platform SEAGoogle Web Toolkit Introduction - eXo Platform SEA
Google Web Toolkit Introduction - eXo Platform SEA
 
Writing and Testing JavaScript-heavy Web 2.0 apps with JSUnit
Writing and Testing JavaScript-heavy Web 2.0 apps with JSUnitWriting and Testing JavaScript-heavy Web 2.0 apps with JSUnit
Writing and Testing JavaScript-heavy Web 2.0 apps with JSUnit
 
Google Dev Day2007
Google Dev Day2007Google Dev Day2007
Google Dev Day2007
 
Gwt session
Gwt sessionGwt session
Gwt session
 
Gwt session
Gwt sessionGwt session
Gwt session
 
06 Javascript
06 Javascript06 Javascript
06 Javascript
 
Building Ajax apps with the Google Web Toolkit
Building Ajax apps with the Google Web ToolkitBuilding Ajax apps with the Google Web Toolkit
Building Ajax apps with the Google Web Toolkit
 
Google Web toolkit
Google Web toolkitGoogle Web toolkit
Google Web toolkit
 
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
 
Beyond HTML: Tools for Building Web 2.0 Apps
Beyond HTML: Tools for Building Web 2.0 AppsBeyond HTML: Tools for Building Web 2.0 Apps
Beyond HTML: Tools for Building Web 2.0 Apps
 
AJppt.pptx
AJppt.pptxAJppt.pptx
AJppt.pptx
 
Developing For The Web
Developing For The WebDeveloping For The Web
Developing For The Web
 
WAD - WaveMaker tutorial
WAD - WaveMaker tutorial WAD - WaveMaker tutorial
WAD - WaveMaker tutorial
 
WaveMaker tutorial with Flash
WaveMaker tutorial with FlashWaveMaker tutorial with Flash
WaveMaker tutorial with Flash
 
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
 

Mehr von Lorraine JUG

Milou fait un régime Guava Lombok
Milou fait un régime Guava LombokMilou fait un régime Guava Lombok
Milou fait un régime Guava LombokLorraine JUG
 
De Runnable & synchronized à parallele() et atomically()
De Runnable & synchronized à parallele() et atomically()De Runnable & synchronized à parallele() et atomically()
De Runnable & synchronized à parallele() et atomically()Lorraine JUG
 
Java Message Services
Java Message ServicesJava Message Services
Java Message ServicesLorraine JUG
 
Bonita Open Solution why, what, how?
Bonita Open Solution why, what, how?Bonita Open Solution why, what, how?
Bonita Open Solution why, what, how?Lorraine JUG
 
Stack Technologique Google
Stack Technologique GoogleStack Technologique Google
Stack Technologique GoogleLorraine JUG
 
The Java EE 6 platform
The Java EE 6 platformThe Java EE 6 platform
The Java EE 6 platformLorraine JUG
 
Comment concilier Agilité et projet au forfait ?
Comment concilier Agilité et projet au forfait ?Comment concilier Agilité et projet au forfait ?
Comment concilier Agilité et projet au forfait ?Lorraine JUG
 
Scrum, iceScrum et Rock'n Roll
Scrum, iceScrum et Rock'n RollScrum, iceScrum et Rock'n Roll
Scrum, iceScrum et Rock'n RollLorraine JUG
 

Mehr von Lorraine JUG (13)

Couchbase
CouchbaseCouchbase
Couchbase
 
Milou fait un régime Guava Lombok
Milou fait un régime Guava LombokMilou fait un régime Guava Lombok
Milou fait un régime Guava Lombok
 
De Runnable & synchronized à parallele() et atomically()
De Runnable & synchronized à parallele() et atomically()De Runnable & synchronized à parallele() et atomically()
De Runnable & synchronized à parallele() et atomically()
 
NIO 2
NIO 2NIO 2
NIO 2
 
Java SE 7
Java SE 7Java SE 7
Java SE 7
 
Java Message Services
Java Message ServicesJava Message Services
Java Message Services
 
Bonita Open Solution why, what, how?
Bonita Open Solution why, what, how?Bonita Open Solution why, what, how?
Bonita Open Solution why, what, how?
 
Stack Technologique Google
Stack Technologique GoogleStack Technologique Google
Stack Technologique Google
 
The Java EE 6 platform
The Java EE 6 platformThe Java EE 6 platform
The Java EE 6 platform
 
Tapestry
TapestryTapestry
Tapestry
 
Comment concilier Agilité et projet au forfait ?
Comment concilier Agilité et projet au forfait ?Comment concilier Agilité et projet au forfait ?
Comment concilier Agilité et projet au forfait ?
 
Fcitr public
Fcitr publicFcitr public
Fcitr public
 
Scrum, iceScrum et Rock'n Roll
Scrum, iceScrum et Rock'n RollScrum, iceScrum et Rock'n Roll
Scrum, iceScrum et Rock'n Roll
 

Kürzlich hochgeladen

Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
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
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
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
 
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
 
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
 
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
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
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
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
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
 
"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
 
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
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 

Kürzlich hochgeladen (20)

Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
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
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
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
 
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
 
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
 
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
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
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
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
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
 
"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
 
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
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 

GWT

  • 1. GWT = Easy AJAX L o r ra i n e J u g 7 / 1 2/ 20 09
  • 2. Who am I? Olivier Gérardin Technical Director, Sfeir Benelux (groupe Sfeir) Java / Web architect 13+ years Java 3 years GWT gerardin.o@sfeir.lu blog.gerardin.info
  • 3. Agenda Little GWT showcase Why GWT? How does it work? Key features Myths & misconceptions Pointers, Conclusion, Q&A
  • 4. GWT Showcase Ext-GWT explorer Piano Etudes GWTUML Clarity Accounting ContactOffice MyERP, Compiere And more: Google Wave, Timetonote CRM …
  • 6. The web 0.0 Or “The Link Era”  A web page is just a bunch of images and text with links  Links take you to a new page  Click on link  HTTP request is built (from static link URL) and sent  Wait for server to reply  Server replies with HTML page (usually from static storage)  Response received  blank screen  Wait for entire page to load
  • 7. “Dynamic” web with forms (web 1.0) Or “The Form Era”  In addition to images and text, a web page can contain fields and other widgets  A designated button submits the form  Fill in form  Submit  HTTP request is built (from form parameters and field values) and sent  Wait for server to reply  Server replies with HTML page (usually generated on server)  Response received  blank screen  Wait for entire page to load
  • 8. An example of form-based web application: Squirrel mail
  • 9. Server side processing CGI  Basic bridge to OS commands  Very ineffective (1 request = 1 process) Web server with dedicated module (PHP, …)  Scripted  Usually interpreted Application server with thread pool management (JSP, …)  More effective  JSPs are compiled at first invocation ASP, perl, whatever …still requires full page reload
  • 10. Java Applets Plain Java application inside a web page! Server interaction without page reload! Rich UI (Swing)! But…  No consistent JVM support (MS vs Netscape/Sun)  Sloooooooow start  Hard to interface with the rest of the page  Mostly seen as a gadget for irritating animations
  • 11. There comes JavaScript Client-side scripting First usage: server-side form validation  Avoid server round-trip when invalid  Instant feedback With DHTML: polymorphic client page  Menus, animations, etc. Cross-browser (almost) Still no server interaction without submit/reload 
  • 12. XHTTPR and AJAX MS introduces Office Web Access  JavaScript “clone” of desktop client (Outlook)  Fetches data from server without reloading page! How is that possible?  New class: XmlHttpRequest  Allows server interaction without page reload  Response received asynchronously  Interface updated through DOM AJAX is born!
  • 13. The first AJAX app: Outlook Web Access
  • 14. JavaScript frenzy JS becomes hype… Cool-looking, nice to use web UIs Everyone wants to do JavaScript Any serious web site must have dynamic content, auto- completion or other AJAX goodies Widget sets / frameworks begin to emerge  Scriptaculous, YUI, dojo, jScript, … Anything seems possible in JavaScript  JavaScript OS, AjaxSwing (WebCream), …
  • 15. JavaScript hangover Serious JavaScript hurts…  Cross-browser compatibility nightmare  Fix in one, break in another  JavaScript Guru required!  Developing/Debugging nightmare  Weird runtime errors  No static typing  No refactoring  And..  Memory leaks  Heavy pages  Security issues
  • 17. What to do? Change jobs? Subcontract? Give up dynamic pages?  Back to web 1.0… Target a single browser?  Not an option for Internet apps Give up AJAX and use other technology?  Plugin required  SEO unfriendly  Proprietary environment / learning curve  What server-side technology to match?
  • 18. Use GWT ! GWT gives you AJAX without the pain of JavaScript development  Takes care of cross-browser issues  Allows full debugging (breakpoints, step by step, inspecting/watching variables)  Strong static typing  early error detection  Full refactoring options  No browser plugin or mandatory IDE  Short learning curve  Simple RPC mechanism  But can communicate with any server technology
  • 19. Program in Java… GWT allows developing client-side web apps in full Java (with only a few restrictions)  Leverage existing Java tools and skills  Use any IDE (Eclipse, NetBeans, IntelliJ, …) Program like a traditional graphical client (Swing, SWT, …)  Widgets, containers, listeners, etc.  Use OO patterns (MVC, MVP, observer, composite, etc.) Test like any Java app  Use standard Java debuggers  Test with JUnit
  • 20. … forget JavaScript! JavaScript is only generated:  For deployment  To test in actual web mode GWT’s promise is that the generated JavaScript app behaves exactly like the Java app  And it does (most of the time) (forgetting JavaScript not mandatory)
  • 21. How does it work?
  • 22. 4 easy pieces 1) Java-to-JavaScript compiler 2) JRE emulation library 3) Java libraries 4) Hosted Development mode
  • 23. GWT compiler Generates JS code from Java sources Performs numerous optimizations  In most cases better than hand coding  Can generate obfuscated (ultra-compact) code JS plays a role similar to bytecode for compiled Java applications
  • 24. JRE Emulation library Provides a GWT-compatible version of Java core classes  Most of java.lang  Most of java.util  Some classes of java.io and java.sql  For convenience only! No real I/O or JDBC! Used when running in web mode  Hosted mode runs in a JVM with standard JRE
  • 25. GWT Java libraries Utility classes  RPC, I18N, … Widget set  Simple widgets (Button, TextField, …)  Base building blocks  In most cases map to native HTML object  Composites = widgets built from other widgets  Panels = widget containers  Panels enforce a layout (vertical, horizontal, grid, …)
  • 29. Hosted / Development mode Allows running GWT apps without converting them to JavaScript  Code runs as Java bytecode in a standard JVM  Embedded web browser emulates HTML rendering  platform-dependant…  Performs extensive checks to make sure the code is compilable to JavaScript Bottom line: if a GWT application performs as expected in development mode, it will perform identically in web mode  True 99,9% of the time
  • 31. Easy development During development, you are writing and running a classic Java app  Use your favorite IDE  All IDE features available (code completion, code analysis, refactoring, links, Javadoc, …)  Plugins help GWT-specific tasks (launching, compiling, creating RPC services, …)
  • 32. Easy RPC RPC mechanism based on Java servlets Easy as: 1. Define service interface int add (int x, int y); 3. Derive asynchronous interface void add (int x, int y, AsyncCallback<Integer> callback); 5. Implement service interface (server-side) public int add (int x, int y) { return x + y; }
  • 33. Easy JSON generation Easy as: JSONObject livre = new JSONObject(); livre.put("Titre", new JSONString("GWT")); livre.put("Pages", new JSONNumber(123)); JSONArray chapitres = new JSONArray(); chapitres.set(0, new JSONString("Introduction"));
  • 34. Easy JSON parsing Easy as: JSONObject livre = new JSONObject(json); String titre = livre.get("Titre").isString().stringValue(); double pages = livre.get("Pages").isNumber().doubleValue(); JSONArray chapitres = livre.isArray(); String chap0 = chapitres.get(0).isString().stringValue();
  • 35. Deferred binding Appropriate code for user environment (browser, locale) is chosen at application startup time  ≠ dynamic binding (implementation chosen at runtime)  ≠ static binding (implementation chosen at compile time) Code for every combination is generated at compile time Advantages:  Allows app-wide optimizations  Compensates for the lack of dynamic (runtime) loading Disadvantages:  Increases compilation time
  • 36. Deferred Binding (explicit) Deferred binding can be called explicitly: Foo foo = GWT.create(Foo.class); Implementation is provided by either:  Substitution: an existing class is designated  Generation: class is generated during compilation
  • 37. Easy native JavaScript integration Implement a method directly in JavaScript: public static native void alert(String msg) /*-{ $wnd.alert(msg); }-*/;  Call back Java methods from JavaScript  Pass objects back and forth Useful to wrap legacy JavaScript libraries
  • 38. Easy Widget reuse Create your own widgets:  Extend existing widget  Works but not the most efficient  Might expose unwanted methods from superclass  Extend Composite  Recommended method  Use JSNI  To wrap existing JavaScript widgets
  • 39. Easy history support AJAX app = single page  “back” button  catastrophe… GWT solution:  Encode app state in URL as “fragment”  E.g. http://myserver/myGwtApp#x=1;y=2  Save state:  History.newItem(token);  React to state change (“back” button)  History.addValueChangeHandler(…);
  • 40. Easy i18n Taking advantage of Deferred Binding 1. Define interface: public interface AppConstants extends Constants { String title(); } 3. “Implement” interface (AppConstants.properties): title = Hello, World 5. Use: AppConstants appConstants = GWT.create(AppConstants.class); String title = appConstants.title();
  • 41. Easy i18n More advanced i18n 1. Define interface: public interface AppMessages extends Messages { String mailStatus(int n, String s); } 3. “Implement” interface (AppMessages.properties): mailStatus = You have {0} messages in folder {1} 5. Use: AppMessages msgs = GWT.create(AppMessages.class); String status = msgs.mailStatus(15, “Inbox”);
  • 42. Easy debugging In development mode, application runs as bytecode (just like any old Java app…) So you can debug it just like any classic Java app:  Set breakpoints  Step through code  Inspect variables  Change variables  …
  • 43. Easy client-server testing Integrated application server for testing RPC services  Can be disabled to use external server JUnit integration to run client-side test cases  Hosted mode or web mode  Full access to RPC services  GWTTestCase, GWTTestSuite for automation Selenium for automated GUI testing
  • 44. Short dev cycle Change client code:  press “Reload”.. Done! Change server code:  Embedded server: press “Restart”.. Done!  External server: hotswap /redeploy if needed
  • 45. Easy scaling All session data resides on client  Similar to classic fat client No session information on server-side  Forget session affinity  Add/remove servers on the fly  Restart server without losing clients
  • 46. “Easy” styling Styling relies entirely on CSS  Widgets have well-known styles  Programmer can add custom styles No shift from traditional HTML styling  HTML/DOM build page “skeleton”  Appearance tuned with CSS Separate UI construction from styling  With well thought styles, it’s possible to reskin completely an application without changing one line of code GWT styling has all the benefits of CSS with all problems of CSS  Be careful with brower dependencies!
  • 47. Easy Google APIs Project gwt-google-apis http://code.google.com/p/gwt-google-apis  Libraries that wrap Google JavaScript APIs  Gears,  gadgets,  AJAX search,  Maps,  Visualization,  Language,  AjaxLoader  Standalone libraries (do not require JavaScript libraries)
  • 48. [new in 2.0] in-browser development mode Before: hosted mode uses customized browser engine  Heavily customized  Only one supported browser per platform (IE on Windows, WebKit on Mac, Mozilla on Linux)  Platform-specific code (SWT)  Difficult to keep up-to-date  Browser and hosted application share the same process  Most plugins don’t work (including Google Gears…)
  • 49. [new in 2.0] in-browser development mode After:  Hosted mode shell runs outside browser  Communicates with browser using plugin through TCP
  • 50. [new in 2.0] in-browser development mode Benefits  Use any (supported) browser/version on any platform  Behavior closer to web mode  No interference with browser plugins  No more platform-specific stuff in GWT (one jar for all!)  Network protocol cross-platform possible  Dev mode shell on machine X, slave browser on machine Y  E.g. dev on Linux, test in IE on Windows…
  • 51. [new in 2.0] code splitting Before: monolithic download can become very big  Slow startup times After:  Programmer can insert “split points” in code  Hints for the compiler to place everything not required up to split point in separate download  Compiler divides code in several “chunks”, which are loaded on-demand Benefits:  Initial loading time reduced 50% on average with a single split point  Allows on-demand module loading
  • 52. [new in 2.0] declarative UI Declarative construction of GUI using XML grammar Allows automatic binding with Java code  Assign widget references to Java fields  Automatically attach methods as event handlers Benefits:  Clearly separate:  Static UI construction (XML)  Dynamic UI behavior (Java)
  • 53. [new in 2.0] resource bundle Download multiple heterogeneous resources from server in a single request  Images (already possible in pre-2.0)  CSS  Text  Any binary resource Benefits:  Fewer round trips to the server  Less overhead  More responsive interface
  • 55. Myth: GWT is a JS library/framework/widget set GWT is not for JavaScript developers Provides only Java classes
  • 56. Myth: GWT is a framework GWT is a toolkit (set of tools) Frameworks may be built on top of it
  • 57. Myth: GWT is applets GWT app is full JavaScript No runtime/plugin No JRE required
  • 58. Myth: GWT is only for Java programmers Yes, GWT uses Java as programming language… BUT you can also see it this way: GWT lets you write/debug/test/refactor AJAX apps with state-of-the-art IDEs and tools using a statically-typed object-oriented language GWT makes it worth learning Java!
  • 59. Myth: GWT generates poorly performing JS The GWT compiler generates highly optimized and compact code Hand written JavaScript might be marginally faster in some cases, but it’s not worth the trouble
  • 60. Myth: GWT only works with a Java backend GWT includes a simple and efficient RPC mechanism that relies on Java servlets BUT it plays nice with any server-side technology that can handle HTTP requests (even PHP)  Includes XML encoding/decoding library  Includes JSON encoding/decoding library
  • 61. Myth: GWT has poor UI components Yes, GWT’s builtin widgets are minimalistic… BUT it’s not the point to provide a complete and beautiful widget set GWT provides the basis for rich and good-looking components Create your own or use 3rd party  See Ext-GWT, SmartGWT
  • 62. Myth: GWT apps have long startup times Not longer than any JavaScript app Obfuscation reduces size Deferred binding loads just the necessary code for the platform/language GWT 2.0’s code splitting can split code in several chunks  Smaller initial download  On-demand downloading
  • 63. Myth: GWT doesn’t integrate with existing sites GWT was designed from the beginning with the goal to integrate well into existing sites Very easy to add GWT to an existing page  Only a few lines of HTML  Can “hook up” to any DOM element
  • 64. Myth: GWT has poor skinning possibilities GWT uses CSS for styling Can reskin a whole application without changing a line of code (done that!) Can split work between developer (behavior) and designer (appearance) Caution: CSS can introduce browser dependencies
  • 65. Conclusion Is GWT the future of web development? GWT has passed reality check Who wants to hand-write JavaScript for 6 different browsers (and maintain it) ? GWT = easy AJAX now ! =
  • 66. Pointers GWT home (downloads, docs, FAQs, guides, etc.)  http://code.google.com/toolkit Google groups “GWT” group  http://groups.google.com/group/Google-Web-Toolkit onGWT: fresh news about GWT  http://www.ongwt.com LinkedIn “GWT Users” group  http://www.linkedin.com/groups?gid=129889

Hinweis der Redaktion

  1. &amp;lt;number&amp;gt;
  2. &amp;lt;number&amp;gt;
  3. &amp;lt;number&amp;gt;
  4. MyERP: Mime_Inc, admin/9p5fJJ_AH Compiere: Server:    http://open.compiere.com User ID:    Olivier Gérardin Password:    20004098 &amp;lt;number&amp;gt;
  5. &amp;lt;number&amp;gt;
  6. A améliorer (dessin/anim) Exemple: http://web.archive.org/web/19961223105317/http://www.feedmag.com/ &amp;lt;number&amp;gt;
  7. A améliorer (dessin/anim) &amp;lt;number&amp;gt;
  8. Étayer les arguments &amp;lt;number&amp;gt;
  9. Origine du nom JavaScript: accord entre Netscape et Sun pour promouvoir la marque “Java” &amp;lt;number&amp;gt;
  10. &amp;lt;number&amp;gt;
  11. BrowserBpook: http://www.visibone.com/products/browserbook.html &amp;lt;number&amp;gt;
  12. Side discussion: high-level languages vs low-level languages. Make the point that although using GWT means giving up some JS idioms, the benefits are elsewhere. &amp;lt;number&amp;gt;
  13. GWT performs “Browser sniffing” (controversy) &amp;lt;number&amp;gt;