Top Banner
GWT-Gears The Browser is the Platform Didier Girard – [email protected] Sfeir CTO Member of OSSGTP
86

GWT + Gears : The browser is the platform

May 18, 2015

Download

Business

Didier Girard

GWT and Gears : The browser is the platform
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: GWT + Gears : The browser is the platform

GWT-GearsThe Browser is the Platform

Didier Girard – [email protected] CTO Member of OSSGTP

Page 2: GWT + Gears : The browser is the platform

Before starting, some questions

• Who knows javascript ?

• Who is a javascript expert ?

• Who knows java ?

2 Google Confidential

Page 3: GWT + Gears : The browser is the platform

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

Page 4: GWT + Gears : The browser is the platform

Content

• Demonstrations

• Why GWT ?

• GWT features

• Google Gears

Page 5: GWT + Gears : The browser is the platform

Ajax : Asynchronous updates

• Fresh data without reload

Page 6: GWT + Gears : The browser is the platform

Ajax : Rich Widgets

• Widgets : One more beautiful than the other

Page 7: GWT + Gears : The browser is the platform

Ajax : Partial update of the screen

• No more « Blank page » effect

Page 8: GWT + Gears : The browser is the platform

Single Page Interface : Better scalability

• Stateless Server

• Stateful client

ApplicationApplication

GUI+BusinessGUI+Business

+ Session+ Session

Data BaseData BaseDataData

Page 9: GWT + Gears : The browser is the platform

At first, Ajax is really cool

• So wonderful, incredible, marvellous

• So efficient

• Customers love it

Page 10: GWT + Gears : The browser is the platform

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

• …

Page 11: GWT + Gears : The browser is the platform

The solution – First step

• Build the prototype of the application

– It is really fun

– Everybody will admire you

Page 12: GWT + Gears : The browser is the platform

The solution – Second step

• Your customer purchases : leave the project :-)

Page 13: GWT + Gears : The browser is the platform

But I’m nota coward

Page 14: GWT + Gears : The browser is the platform

Do something else

Page 15: GWT + Gears : The browser is the platform

But What ?

Page 16: GWT + Gears : The browser is the platform

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, refactoring, strong typing…

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

Page 17: GWT + Gears : The browser is the platform

That is what GWT

is !

Page 18: GWT + Gears : The browser is the platform

Content

• Demonstrations

• Why GWT ?

• GWT features

• Google Gears

Page 19: GWT + Gears : The browser is the platform

Démonstrations

Page 20: GWT + Gears : The browser is the platform

Demonstrations

• http://stuff.ongwt.com

Page 21: GWT + Gears : The browser is the platform

Content

• Demonstrations

• Why GWT ?

• GWT features

• Google Gears

Page 22: GWT + Gears : The browser is the platform

GWT is simple

• Developing a web application with GWT is as simple as developing a Windows application with VB

Page 23: GWT + Gears : The browser is the platform

GWT is cheap

23 Google Confidential

Page 24: GWT + Gears : The browser is the platform

GWT cuts costs

• Building a GWT application is 5 times faster than building a J2EE application

Page 25: GWT + Gears : The browser is the platform

GWT applications are efficient

• Local computation, bandwidth optimization

Page 26: GWT + Gears : The browser is the platform

GWT is offline compatible

• A GWT application doesn’t need a server

Page 27: GWT + Gears : The browser is the platform

Compatible with mobile

27 Google Confidential

Page 28: GWT + Gears : The browser is the platform

GWT is MDI compatible*

• GWT applications could have windows residing under a single parent window.

*MDI : Multiple Document Interface

Page 29: GWT + Gears : The browser is the platform

GWT, better ergonomically

http://swissmiss.typepad.com/weblog/2007/11/task-clips.html

Web 1.0

GWT

Page 30: GWT + Gears : The browser is the platform

Content

• Demonstrations

• Why GWT ?

• GWT features

• Google Gears

Page 31: GWT + Gears : The browser is the platform

The approach

• Code in java

• Compile the java to Javascript

Page 32: GWT + Gears : The browser is the platform

Hello World

• Demonstration

Page 33: GWT + Gears : The browser is the platform

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

Page 34: GWT + Gears : The browser is the platform

BrowserIE, Firefox, Safari, Opera

BrowserIE, Firefox, Safari, Opera

RWA in JavaRWA in Java

Java Runtime LibraryJava Runtime Library

Architecture

java.langjava.lang

java.utiljava.util

Java.ioJava.io

Application code

GWT GUI LibraryGWT GUI Library

Panels

PopupStack

AbsoluteVertical

WidgetsButton MenuBar

Radio TreeCheck Table

TextArea ….

Javascript Application

GWT Runtime100Ko

GWTCompiler

GWTCompiler

Page 35: GWT + Gears : The browser is the platform

Content

• Demonstrations

• Why GWT ?

• GWT features

• Google Gears

Page 36: GWT + Gears : The browser is the platform

Widgets : « 100% java »

• Demonstration (Kitchen Sink)

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

Page 37: GWT + Gears : The browser is the platform

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

Page 38: GWT + Gears : The browser is the platform

History support

• « Single Page Interface » with history support !

• Demonstration (Kitchen Sink)

• Code :

History.addHistoryListener(myCommand);

Page 39: GWT + Gears : The browser is the platform

RPC Support (JSON/XML-RPC)

• AJAX is a story of asynchronous request

– With GWT, it is simple !

Page 40: GWT + Gears : The browser is the platform

I18N/L10N support

• Simple and powerful

Page 41: GWT + Gears : The browser is the platform

GWT is compatible with unit testing

• Compatible with Junit

• Compatible with Selenium

41 Google Confidential

Page 42: GWT + Gears : The browser is the platform

Cross browser, cross platform

Page 43: GWT + Gears : The browser is the platform

CSS

• GWT widgets are CSS compatible

Page 44: GWT + Gears : The browser is the platform

Debugger

• Demonstration

Page 45: GWT + Gears : The browser is the platform

Javascript integration

• JSNI, a clever API

• Many javascript libraries are already wrapped : Dojo, Extjs,…

• Demonstration

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

Page 46: GWT + Gears : The browser is the platform

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

– Unused APIs are removed from the compiled javascript

Page 47: GWT + Gears : The browser is the platform

Good scalability

• GWT server could be stateless

• No more session affinity

Page 48: GWT + Gears : The browser is the platform

Tools

• GWT is supported by all the java IDE : Eclipse, NetBeans, IntelliJ IDEA, JDeveloper,…

• Advertisement : my favorite tool is GWT Designer

Page 49: GWT + Gears : The browser is the platform

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

Page 50: GWT + Gears : The browser is the platform

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

Page 51: GWT + Gears : The browser is the platform

Google Gadget with GWT

Page 52: GWT + Gears : The browser is the platform

Gadget definition

• <Module> <ModulePrefs title="Hello World” author=“Didier Girard” author_email=“[email protected]”> </ModulePrefs> <Content type="html"> <![CDATA[

Your application goes here ]]> </Content></Module>

Page 53: GWT + Gears : The browser is the platform

Gadget definition with GWT : 1 line

• <Module> <ModulePrefs title="Hello World” author=“Didier Girard” author_email=“[email protected]”> </ModulePrefs> <Content type="html"> <![CDATA[

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

</script> ]]> </Content></Module>

Page 54: GWT + Gears : The browser is the platform

Opensocial

Page 55: GWT + Gears : The browser is the platform

Who's Using It?

Page 56: GWT + Gears : The browser is the platform

Opensocial Definition with GWT :2 lines

• <Module> <ModulePrefs title="Hello World” author=“Didier Girard” author_email=“[email protected]”>

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

</script> ]]> </Content></Module>

Page 57: GWT + Gears : The browser is the platform

Simple, Efficient and Powerful ?

Page 58: GWT + Gears : The browser is the platform

Content

• Demonstrations

• Why GWT ?

• GWT features

• Google Gears

Page 59: GWT + Gears : The browser is the platform

I need offline applications

• Do you ever miss your application

– Pubs

– Trains

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

Page 60: GWT + Gears : The browser is the platform

Classic web architecture

BrowserBrowser ServerServer

DataBaseDataBase

HTTP

Page 61: GWT + Gears : The browser is the platform

My needs in offline mode

BrowserBrowser ServerServer

DataBaseDataBaseDataBaseDataBaseServerServer

Page 62: GWT + Gears : The browser is the platform

I need

BrowserBrowser ServerServer

DataBaseDataBase

Install

DataBaseDataBaseServerServer

Page 63: GWT + Gears : The browser is the platform

The solution

• Google Gears

– Browser Plugin (FireFox, Internet Explorer)

– Features:

• LocalServer (“programmable cache”)

• Database

• Worker Threads for JavaScript

• http://gears.google.com

Page 64: GWT + Gears : The browser is the platform

Content

• Demonstrations

• Why GWT ?

• GWT features

• Google Gears

Page 65: GWT + Gears : The browser is the platform

Architecture

65 Google Confidential

BrowserBrowser GearsGears

Javascript API

Javascript API

Your GWT ApplicationYour GWT Application

Your JS Application

Your JS Application

DojoDojoGWT Wrapper

GWT Wrapper

Page 66: GWT + Gears : The browser is the platform

Demo

• Live coding

Page 67: GWT + Gears : The browser is the platform

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

Page 68: GWT + Gears : The browser is the platform

Content

• Demonstrations

• Why GWT ?

• GWT features

• Google Gears

Page 69: GWT + Gears : The browser is the platform

Think differently!

• Rethink application ergonomic.

• Forget browsing

• MDI is possible

• Stateless server, statefull client

69 Google Confidential

Page 70: GWT + Gears : The browser is the platform

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

70 Google Confidential

Page 71: GWT + Gears : The browser is the platform

Content

• Demonstrations

• Why GWT ?

• GWT features

• Google Gears

Page 72: GWT + Gears : The browser is the platform

You must used java on the server

• No, GWT is server free

Page 73: GWT + Gears : The browser is the platform

Compiled javascript is impossible to debug

• It is possible to change compilation option

• But you never need to it,

• -> Demo

Page 74: GWT + Gears : The browser is the platform

GWT applications are heavy

• Compiled javascript is light and gzippable

– KitchenSink is around 60Ko !

Page 75: GWT + Gears : The browser is the platform

GWT is HTML incompatible

• Wrong

– It is possible to include GWT components in a standard HTML page

Page 76: GWT + Gears : The browser is the platform

GWT applications are applets

• Applets, no thanks :-)

– Java is compiled to javascript !

Page 77: GWT + Gears : The browser is the platform

Content

• Demonstrations

• Why GWT ?

• GWT features

• Google Gears

Page 78: GWT + Gears : The browser is the platform

Who are the challengers

• Silverlight

• AIR/Flex

• Firefox with the XUL/Prism stuff

Page 79: GWT + Gears : The browser is the platform

GWT and Gears

79 Google Confidential

Page 80: GWT + Gears : The browser is the platform

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

Page 81: GWT + Gears : The browser is the platform

Faster and faster

• GWT application are efficient

• It is 5 times faster to build a GWT application

Page 82: GWT + Gears : The browser is the platform

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

Page 83: GWT + Gears : The browser is the platform

No Future

PHP, Struts, JSF, ASP.NET,…

Page 84: GWT + Gears : The browser is the platform

« GWT + Gears »

The browser is the platform !

I thank the GWT Team,I thank the community!

Reminder

Page 85: GWT + Gears : The browser is the platform

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

• Jobs: [email protected]

85 Google Confidential

Page 86: GWT + Gears : The browser is the platform

Ressources

GWT :http://code.google.com/webtoolkit/

Forum :http://groups.google.com/group/Google-Web-Toolkit

GWT Blog : http://googlewebtoolkit.blogspot.com/

onGWT, Tracking news on GWT : http://www.ongwt.com/

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