Professional Documents
Culture Documents
Bruce Johnson
Google, Inc.
bruce@google.com
Topics
2
What is Google Web Toolkit (GWT)?
What is GWT?
A set of tools for building Ajax apps in the Java language
3
Topics
4
What I Mean by "Ajax"
5
Why Ajax? Infrastructure Benefits
01100110
01111001
01101011
Ajax 0110
0111
6
Why Ajax? Usability Benefits
10
GWT Requirements Laundry List
11
Code Sample – Hello, Ajax
Demo time...
RootPanel.get().add(b);
}
12
Demo
Hello, Ajax
Wow, That’s So Much Easier
Demo
"Mail" is a desktop-style application
15
Usability: History and Bookmarks
Demo
"KitchenSink" shows history, bookmarking, and widgets
16
Adding GWT Incrementally
17
Simple & Powerful Client/Server: RPC
19
How Big is "Big"?
Startup time?
First run? Subsequent runs? How fast, exactly?
21
Low-Hanging Fruit: Caching
23
An Algorithm to Evolve Your Architecture
25
Additional Techniques
Create UI lazily
Fits naturally with history and MVC
Spread the cost of widget creation across user-time
See KitchenSink for an example
26
Topics
27
Open Source – w00t!
Great community
8,500+ members in the GWT Developer Forum
350+ members in the GWT Contributors Forum
Many external patches included in GWT 1.4
28
Documentation Included
29
Large and Growing GWT Community
Library enhancements
NumberFormat, DateTimeFormat
Benchmarking subsystem
RPC now supports non-servlet Java back ends
31
Summary
We will share our best work and ideas with you, and we
hope you will return the favor
32
Topics
33
Common Questions
34
Common Questions
36
Common Questions
37
Aggressive Size Optimizations
Tough decision not to support reflection and class loading
Worth it! Three words: Whole program optimization
For example, type tightening to eliminate polymorphism
Shape s = new Square(2); // side length of 2
int a = s.getArea();
can become
Square s = new Square(2);
int a = s.length * s.length;
which, if Square’s ctor has no side effects, can become
int a = 4;
Imagine those sorts of optimizations across your entire app
In JavaScript, reducing size and increasing speed are
complementary goals, which makes optimizations really fun
38
Compiled Script Size (bytes)
W
in
0
10,000
20,000
30,000
40,000
50,000
60,000
d ow Em
.a pt
ler y
t("
he
llo
Ve ")
r ti
ca
lP
an
el
B
ut
to
n
C
he
ck
Tr B
ox
ee
(3
ite
m
s)
La
be
l
Te
xt
B
ox
G
rid
(4
x
4)
H
TM
L
Ta Im
bP ag
an e
el
(3
Li ta
st bs
B )
ox
Additional Widgets
(3
ite
R m
ad s)
io
B
ut
to
n
(3
)
H
Compilation: Only Pay for What You Use
yp
H er
lin
or
iz k
on
ta
lP
an
el
Fl
ow
Pa
A ne
bs l
ol
ut
eP
an
el
39
Compilation: Getting Better All The Time
120,000
1.0
100,000
Script Size (bytes)
1.4
80,000
60,000
40,000 1.0
1.4
20,000
Uncompressed Compressed
40
Common Questions
41
Efficiency: Bandwidth and Startup Time
80,000
70,000
Bytes Transferred
60,000
50,000
40,000
30,000
20,000
10,000
42
Latency: Minimizing HTTP Requests
25
1.0
1.0
20
# HTTP Requests
15
10
1.4
1.4
5
43
Q&A