GWT-Gears The Browser is the Platform The Browser is the Platform - - PowerPoint PPT Presentation

gwt gears the browser is the platform the browser is the
SMART_READER_LITE
LIVE PREVIEW

GWT-Gears The Browser is the Platform The Browser is the Platform - - PowerPoint PPT Presentation

GWT-Gears The Browser is the Platform The Browser is the Platform Didier Girard girard.d@sfeir.com Sfeir CTO Member of OSSGTP Before starting, some questions Who knows javascript ? Who is a javascript expert ? Who knows java ?


slide-1
SLIDE 1

GWT-Gears The Browser is the Platform The Browser is the Platform

Didier Girard – girard.d@sfeir.com Sfeir CTO Member of OSSGTP

slide-2
SLIDE 2

Before starting, some questions

  • Who knows javascript ?
  • Who is a javascript expert ?
  • Who knows java ?
2 Google Confidential
slide-3
SLIDE 3

Content

  • Ajax : the good, the bad and the coward
  • Demonstrations
  • GWT for Chief (whatyouwant) Officer
  • GWT for developers
  • Gears for early adopters
3 Google Confidential
slide-4
SLIDE 4

Content

  • Demonstrations
  • Why GWT ?
  • GWT features
  • Google Gears
slide-5
SLIDE 5

Ajax : Asynchronous updates

  • Fresh data without reload
slide-6
SLIDE 6

Ajax : Rich Widgets

  • Widgets : One more beautiful than the other
slide-7
SLIDE 7

Ajax : Partial update of the screen

  • No more « Blank page » effect
slide-8
SLIDE 8

Single Page Interface : Better scalability

  • Stateless Server
  • Stateful client
slide-9
SLIDE 9

At first, Ajax is really cool

  • So wonderful, incredible,

marvellous

  • So efficient
  • Customers love it
slide-10
SLIDE 10

Some boring comments about javascript

  • … cross-browser
  • … memory leak
  • … loading latency
  • … « Javascript PhD »
  • … ajax IDE
  • … bugs (javascript is a dynamic language)
  • … cross browser javascript debugger
  • … security
slide-11
SLIDE 11

The solution – First step

  • Build the prototype of the application

– It is really fun – Everybody will admire you

slide-12
SLIDE 12

The solution – Second step

  • Your customer purchases : leave the project :-)
slide-13
SLIDE 13

But I’m not a coward a coward

slide-14
SLIDE 14

Do something something else

slide-15
SLIDE 15

But What ?

slide-16
SLIDE 16

My manifest

  • I want a technology that

– helps to code stable, efficient and cross-browser

applications

– Is a friend to me as a developer

  • Compatible with IDE, support debugging,
  • Compatible with IDE, support debugging,

refactoring, strong typing…

  • The base line could be : « Good for the user, good for

the developer »

slide-17
SLIDE 17

That is what GWT what GWT is !

slide-18
SLIDE 18

Content

  • Demonstrations
  • Why GWT ?
  • GWT features
  • Google Gears
slide-19
SLIDE 19

Démonstrations

slide-20
SLIDE 20

Demonstrations

  • http://stuff.ongwt.com
slide-21
SLIDE 21

Content

  • Demonstrations
  • Why GWT ?
  • GWT features
  • Google Gears
slide-22
SLIDE 22
  • Developing a web application with GWT is as simple as

developing a Windows application with VB

slide-23
SLIDE 23

GWT is cheap

23 Google Confidential
slide-24
SLIDE 24
  • Building a GWT application is 5 times faster than

building a J2EE application

slide-25
SLIDE 25
  • Local computation, bandwidth optimization
slide-26
SLIDE 26
  • A GWT application doesn’t need a server
slide-27
SLIDE 27

Compatible with mobile

27 Google Confidential
slide-28
SLIDE 28
  • GWT applications could have windows residing under a

single parent window.

*MDI : Multiple Document Interface

slide-29
SLIDE 29
  • http://swissmiss.typepad.com/weblog/2007/11/task-clips.html

Web 1.0 GWT

slide-30
SLIDE 30

Content

  • Demonstrations
  • Why GWT ?
  • GWT features
  • Google Gears
slide-31
SLIDE 31

The approach

  • Code in java
  • Compile the java to Javascript
slide-32
SLIDE 32

Hello World

  • Demonstration
slide-33
SLIDE 33

How easy do you find GWT to use ?

Very Easy, Easy, Medium, Hard, Very Hard ?

33 Google Confidential

Source : http://www.ongwt.com/post/2008/02/21/How-easy-do-you-find-GWT-to-use

slide-34
SLIDE 34
  • Architecture
  • !"#$%#%#&

'(

  • )*

+,,-

slide-35
SLIDE 35

Content

  • Demonstrations
  • Why GWT ?
  • GWT features
  • Google Gears
slide-36
SLIDE 36

Widgets : « 100% java »

  • Demonstration (Kitchen Sink)

http://code.google.com/webtoolkit/examples/kitchensink/

slide-37
SLIDE 37

Third party GWT Widgets

  • It is really easy to build its own widget
  • Many libraries

– GWT Ext – MyGWT – GWT Rialto – Tatami – GWT Widget – GWTaculous – …

37 Google Confidential
slide-38
SLIDE 38

History support

  • « Single Page Interface » with history support !
  • Demonstration (Kitchen Sink)
  • Code :

History.addHistoryListener(myCommand);

slide-39
SLIDE 39

RPC Support (JSON/XML-RPC)

  • AJAX is a story of asynchronous request

– With GWT, it is simple !

slide-40
SLIDE 40

I18N/L10N support

  • Simple and powerful
slide-41
SLIDE 41

GWT is compatible with unit testing

  • Compatible with Junit
  • Compatible with Selenium
41 Google Confidential
slide-42
SLIDE 42

Cross browser, cross platform

slide-43
SLIDE 43

CSS

  • GWT widgets are CSS compatible
slide-44
SLIDE 44

Debugger

  • Demonstration
slide-45
SLIDE 45

Javascript integration

  • JSNI, a clever API

public static native void alert(String msg) /*-{ $wnd.alert(msg); }-*/;

  • Many javascript libraries are already wrapped : Dojo,

Extjs,…

  • Demonstration
slide-46
SLIDE 46

Optimization

  • Compiled javascript is optimized
  • Only the necessary javascript is downloaded by the

browser – IE downloads only javascript for IE, Firefox downloads only

javascript for Firefox javascript for Firefox

– Unused APIs are removed from the compiled javascript

slide-47
SLIDE 47

Good scalability

  • GWT server could be stateless
  • No more session affinity
slide-48
SLIDE 48

Tools

  • GWT is supported by all the java IDE : Eclipse,

NetBeans, IntelliJ IDEA, JDeveloper,…

  • Advertisement : my favorite tool is GWT Designer
slide-49
SLIDE 49

GWT 1.4 is fast

  • Example : ImageBundle, kind of database for images

– From 12 requests to 1 request…

ClippedImage timeIcon = new ClippedImage("icons.png", 22, 0, 22, 22); http://roberthanson.blogspot.com/2007/02/gwt-clippedimage-optimizing-image.html

slide-50
SLIDE 50

2008 : GWT 1.5

  • The Java 1.5 syntax is fully supported, including

generics, enums, nice "for" loops, autoboxing, static imports, annotations, and so on

  • The ability to subclass JavaScriptObject for very

straightforward JavaScript interop

  • Thurs, Mar 6 2008 : GWT 1.5 M1 is available for

download

50 Google Confidential
slide-51
SLIDE 51

Google Gadget with GWT

slide-52
SLIDE 52

Gadget definition

  • <Module>

<ModulePrefs title="Hello World” author=“Didier Girard” author_email=“Didier.Girard@gmail.com”> </ModulePrefs> <Content type="html"> <Content type="html"> <![CDATA[

Your application goes here

]]> </Content> </Module>

slide-53
SLIDE 53

Gadget definition with GWT : 1 line

  • <Module>

<ModulePrefs title="Hello World” author=“Didier Girard” author_email=“Didier.Girard@gmail.com”> </ModulePrefs> <Content type="html"> <![CDATA[ <![CDATA[

<script src="http://..../com.mycompany.project.ImageViewer-xs.nocache.js"> </script>

]]> </Content> </Module>

slide-54
SLIDE 54

Opensocial

slide-55
SLIDE 55

Who's Using It?

slide-56
SLIDE 56

Opensocial Definition with GWT : 2 lines

  • <Module>

<ModulePrefs title="Hello World” author=“Didier Girard” author_email=“Didier.Girard@gmail.com”>

<Require feature="opensocial-0.7"/>

</ModulePrefs> <Content type="html"> <![CDATA[ <script src="http://..../com.mycompany.project.ImageViewer-xs.nocache.js"> </script> ]]> </Content> </Module>

slide-57
SLIDE 57

Simple, Efficient and Powerful ?

slide-58
SLIDE 58

Content

  • Demonstrations
  • Why GWT ?
  • GWT features
  • Google Gears
slide-59
SLIDE 59

I need offline applications

  • Do you ever miss your application

Pubs

Trains

  • Are you sure that your user want its data in the

cloud ? cloud ?

slide-60
SLIDE 60

Classic web architecture

Browser Server

HTTP

Browser Server

DataBase

slide-61
SLIDE 61

My needs in offline mode

Browser Server Browser Server

DataBase DataBase

Server

slide-62
SLIDE 62

I need

Browser Server

Install

Browser Server

DataBase DataBase

Server

slide-63
SLIDE 63

The solution

  • Google Gears

Browser Plugin (FireFox, Internet Explorer)

Features:

  • LocalServer (“programmable cache”)
  • Database
  • Worker Threads for JavaScript
  • http://gears.google.com
slide-64
SLIDE 64

Content

  • Demonstrations
  • Why GWT ?
  • GWT features
  • Google Gears
slide-65
SLIDE 65

Architecture

Your GWT Application Your JS Application GWT

65 Google Confidential

Browser Gears

Javascript API Dojo GWT Wrapper

slide-66
SLIDE 66

Take Your App Offline

1. Server stateless application 2. Manifest file of your app’s resources 3. Download resources

slide-67
SLIDE 67

Manifest File

{ "betaManifestVersion": 1, "version": "Version 1.0", "entries": [ "entries": [ { "url": "index.html" }, { "url": "style.css" }, { "url": "resources/logo.gif" }, { "url": "gears_init.js"}, { "url": "go_offline.html"}, { "url": "go_offline.js"} ] }

slide-68
SLIDE 68

Load Resources

LocalServer localServer = new LocalServer(); final ManagedResourceStore managedResourceStore = localServer.createManagedResourceStore(MANAGED_STORE_NAME); managedResourceStore.setManifestURL(MANIFEST_URL); managedResourceStore.checkForUpdate();

slide-69
SLIDE 69

Gears Database

  • Based on SQLite
slide-70
SLIDE 70

As simple as

private Database m_database = null; try { try { m_database = new Database(“Test”); ResultSet rs = m_database.execute(“create table...”); rs.close(); } // try catch (Exception e) { // Gears not installed } // catch

slide-71
SLIDE 71

Queries

String sql = “select id, first_name, last_name from person”; ResultSet rs = m_database.execute(sql); while (rs.isValidRow()) { ….. rs.next(); } rs.close();

slide-72
SLIDE 72

Insert

String args[] = new String[3]; args[0] = Integer.toString(person.getID()); args[1] = person.getFirstName(); args[1] = person.getFirstName(); args[2] = person.getLastName(); ResultSet rs = m_database.execute(“insert into person (id, first_name, last_name) values (?,?,?)”, args); rs.close();

slide-73
SLIDE 73

Demo

slide-74
SLIDE 74

Perspectives of Gears : future APIs

  • Notification API
  • Crypto API
  • Factory API updates
  • Blob API
  • Logging API
  • Messaging API
  • Location API
  • Desktop Shortcut API
  • Image Manipulation API
slide-75
SLIDE 75

Content

  • Demonstrations
  • Why GWT ?
  • GWT features
  • Google Gears
slide-76
SLIDE 76

Think differently!

  • Rethink application ergonomic.
  • Forget browsing
  • MDI is possible
  • Stateless server, statefull client
76 Google Confidential
slide-77
SLIDE 77

Misc

  • DOM manipulation is costly

– Your user can have : « slow script message » – -> Use « IncrementalCommand » (DEMO)

  • No need to send tones of asynchronous request
  • Deal with RPC error by subclassing AsyncCallback
  • Forget javascript
  • Use Selenium (DEMO)
  • Use Maven
77 Google Confidential
slide-78
SLIDE 78

Content

  • Demonstrations
  • Why GWT ?
  • GWT features
  • Google Gears
slide-79
SLIDE 79

You must used java on the server

  • No, GWT is server free
slide-80
SLIDE 80

Compiled javascript is impossible to debug

  • It is possible to change compilation option
  • But you never need to it,
  • -> Demo
slide-81
SLIDE 81

GWT applications are heavy

  • Compiled javascript is light and gzippable

– KitchenSink is around 60Ko !

slide-82
SLIDE 82

GWT is HTML incompatible

  • Wrong

– It is possible to include GWT components in a standard

HTML page

slide-83
SLIDE 83

GWT applications are applets

  • Applets, no thanks :-)

– Java is compiled to javascript !

slide-84
SLIDE 84

Content

  • Demonstrations
  • Why GWT ?
  • GWT features
  • Google Gears
slide-85
SLIDE 85

Who are the challengers

  • Silverlight
  • AIR/Flex
  • Firefox with the XUL/Prism stuff
slide-86
SLIDE 86

GWT and Gears

86 Google Confidential
slide-87
SLIDE 87

GWT : THE Community

  • Millions of downloads
  • 12000 subscribers to the users forum
  • 700 subscribers to the contributors forum
  • Books
  • Tons of articles
  • Tons of tutorials
  • Blogs
slide-88
SLIDE 88

Faster and faster

  • GWT application are efficient
  • It is 5 times faster to build a GWT application
slide-89
SLIDE 89

This might surprise you but

  • This pair of tools is the least disruptive

– It is based on the most used langage : java – It doesn’t challenge the current web architecture which is

mainly based on browsers

slide-90
SLIDE 90
  • !"#$

No Future

slide-91
SLIDE 91

« GWT + Gears »

Reminder

The browser is the platform !

I thank the GWT Team, I thank the community!

slide-92
SLIDE 92

SFEIR

  • 6 projects with GWT

– 5000 days of coding – It is just fun – Clients are very happy with their applications – Our stack : GWT/Spring/Hibernate – Our stack : GWT/Spring/Hibernate

  • Jobs: girard.d@sfeir.com
92 Google Confidential
slide-93
SLIDE 93

Ressources

GWT : http://code.google.com/webtoolkit/ Forum : http://groups.google.com/group/Google-Web-Toolkit GWT Blog : http://googlewebtoolkit.blogspot.com/

  • nGWT, Tracking news on GWT :

http://www.ongwt.com/ GWT and GEARS : http://www.ongwt.com/post/2008/01/28/Presentation-%3A-Gears-and-GWT