LOGO SPEAKER‘S COMPANY Google Web Toolkit Real-World ...

unalaskaweepingInternet and Web Development

Jul 19, 2012 (5 years and 3 months ago)

291 views

LOGO SPEAKER‘S COMPANY
Google Web Toolkit
Real- World Experience
Dmitry

Buzdin
C.T.Co
4221

LOGO SPEAKER‘S COMPANY
2
AGENDA
>
GWT
s
hort
i
ntroduction
>
GWT
a
dopt ion
>
Technology p
rototyping
results
>
Development
with GWT
>
Project e
xperience
>
Summary
LOGO SPEAKER‘S COMPANY
GWT Short Introduction

LOGO SPEAKER‘S COMPANY
4
What is G
oogle
W
eb
T
oolkit
?
>
Toolkit, which makes building
portable
and
scalable

AJAX
applications
easier

LOGO SPEAKER‘S COMPANY
5
Why
GWT
is Different
?
>
Presentation layer
is written in Java

Widget
/Component
model

Leveraging
e
xisting
e
xperience

Design Patterns
and OOP

Static
t
yping

Java
p
ackaging
support
(JARs)

Java IDE
s
upport
>
D
evelopment model
similar to
Swing
>
Ajax- oriented

LOGO SPEAKER‘S COMPANY
6
What is Provided
?
>
Java to JavaScript compiler
>
Cross- browser support
>
Widget library
>
Remote Procedure Call mechanism
>
Debugging in hosted mode

LOGO SPEAKER‘S COMPANY
7
What is Provided
?
>
Java to JavaScript compiler
>
Cross- browser support
>
Widget library
>
Remote Procedure Call mechanism
>
Debugging in hosted mode
Code Base
class3
Module B
class1
Module A
class2
class4

LOGO SPEAKER‘S COMPANY
8
What is Provided
?
>
Java to JavaScript compiler
>
Cross- browser support
>
Widget library
>
Remote Procedure Call mechanism
>
Debugging in hosted mode
Internet Explorer 6
Internet Explorer 7
Firefox
Mozilla
Safari
Opera

LOGO SPEAKER‘S COMPANY
9
What is Provided
?
>
Java to JavaScript compiler
>
Cross- browser support
>
Widget library
>
Remote Procedure Call mechanism
>
Debugging in hosted mode
HTML Inputs
Panels
File Upload
Text Widgets
Tables

LOGO SPEAKER‘S COMPANY
10
What is Provided
?
>
Java to JavaScript compiler
>
Cross- browser support
>
Widget library
>
Remote Procedure Call mechanism
>
Debugging in hosted mode

LOGO SPEAKER‘S COMPANY
11
What is Provided
?
>
Java to JavaScript compiler
>
Cross- browser support
>
Widget library
>
Remote Procedure Call mechanism
>
Debugging in hosted mode

LOGO SPEAKER‘S COMPANY
12
What E
lse
?
>
Java t o JavaScript compiler
>
Remot e Procedure Call mechanism
>
Cross- browser support
>
Debugging in host ed mode
>
JavaScript optimization
>
Int ernat ionalization
>
Widget library
>
JRE Emulat ion
>
Unit
t
esting
support
>
JavaScript obfuscat ion
>
Java Script Native Interface
>
XML Parsing
>
Rich Text Editor
>

LOGO SPEAKER‘S COMPANY
GWT Adoption

LOGO SPEAKER‘S COMPANY
14
Who W
e
Are
?
>
C.T.Co is an IT outsourcing
group
>
Located in Riga, Latvia (Lettland)
>
Focused on the European market
>
More than
128

employees
(
less than 256
)
>
Most of the projects are Java based

LOGO SPEAKER‘S COMPANY
15
Our
C
lient
>
Fortune
5
00
corporation in Insurance indust ry
>
Based in Zurich
>

Typical enterprise

>
100s
of
JavaEE
applications
>
Technology standardization process

LOGO SPEAKER‘S COMPANY
16
Enterprise Requirements
>
Branding
>
Integrations
>
Response time
>
User base
>
Remote network locations
>
Security
>
Clustering
>
Availability
>
Intranet Application

LOGO SPEAKER‘S COMPANY
17
Project
Timeline
GWT versions and proj ect timeline
GWT
Version 1.3
GWT
Version 1.4
Aug
Jan
Dec
May
April
June
Feb
May
2006
200
7
2008
1.3
Prototyping
1.4
Project A
R1
Project B
1.5
Production

LOGO SPEAKER‘S COMPANY
18
Project Details
>
Proj ect A – Port al Applicat ion

7 mont hs

25 developers

~3000 classes
>
Proj ect B – Web- based OLTP Tool

4 mont hs

5 developers

~1000 classes
LOGO SPEAKER‘S COMPANY
Prototyping

LOGO SPEAKER‘S COMPANY
20
Prototyping Goals
>
Try GWT on building enterprise level application
>
See how it fits into existing environment
>
Measure performance
>
How
development model
changes?
>
Replace Struts and JSPs with GWT and see what happens...

LOGO SPEAKER‘S COMPANY
21
Integration with Other Frameworks
Checked how hard is to integrate with
>
Existing code base
>
Existing frameworks

LOGO SPEAKER‘S COMPANY
22
How
Fast

is JavaScript
?
>
How much time is needed for
GWT to do
?

Parsing ~200K JavaScript < 200 ms

First RPC request ~ 3 sec

RPC request < 200 ms

Simple rendering < 300 ms

LOGO SPEAKER‘S COMPANY
23
Server
Memory
U
sage
>
Memory
Usage
is significantly lower

No String concatenations

Smaller Session State

Smaller Footprint
>
Up to 8 times less memory per request

LOGO SPEAKER‘S COMPANY
24
Ease of Use
>
Much more easier
t han with JavaScript
>
Java Developers like it
>
Custom component s are easy to create
>

View Page Source“ does not work
>
Spagetti code wit hout preliminary design

LOGO SPEAKER‘S COMPANY
25
Full- blown MVC Framework?
>
GWT out- of- the- box does not provide:
>
Input validation
>
Data binding
>
Rich widget library
LOGO SPEAKER‘S COMPANY
Development

LOGO SPEAKER‘S COMPANY
27
Design Considerations
>
Minimal dependencies on GWT
>
Proper layering
>
Reusable components
>
Single entry point
>
Model, which enables reflection

LOGO SPEAKER‘S COMPANY
28
Shared Code
>
Code can be shared between client and server
>
Typical examples are:

Client side validation

Constant
mapping

LOGO SPEAKER‘S COMPANY
29
Reference
A
rchitecture
Remote Service Servlet
GWT Module 1
Domain Model
Spring Bean
Container
DB
Hibernate
Data Transfer
Objects
Bean Mapping
GWT Module 2
GWT Module 3

LOGO SPEAKER‘S COMPANY
30
Client
Side A
rchitecture
Model
s
View
s
Controller
s
Widgets
Callbacks
Listeners

LOGO SPEAKER‘S COMPANY
31
Integration with Other Technologies
>
JavaScript libraries -
JQuery, Calendar and other fancy
stuff
>
JSP output
>
Spring
>
Hibernate
>
Portlets (
JSR- 168
)

LOGO SPEAKER‘S COMPANY
32
Portlet Concept
>
Each portlet is a small GWT application
>
Each portlet is reloaded independently
>
Interportlet communication on the client level
>
Sceen content is configurable

LOGO SPEAKER‘S COMPANY
33
Automated Testing
>
Unit testing is problematic, but achievable
>
Screen
c
licking requires additional efforts
>
Should be considered early

LOGO SPEAKER‘S COMPANY
34
Product Maturity
>
No critical GWT bugs met in t wo projects
>
One in hosted mode
>
One in IE6 widget implementation
>
Easy migration from 1.3 t o 1.4
>
No
functional
difference between JavaScript and Hosted
mode

LOGO SPEAKER‘S COMPANY
35
Findings
>
Internet
Explorer supports two simultanious requests
(by
default)
>
It is possible to have OutOfMemory on the
browser
>
Straightforward rendering performance
is poor

LOGO SPEAKER‘S COMPANY
36
Overall Impressions
>
Harder than Struts
>
Needs certain mind shift

Is it
Java
or JavaScript
I am writing

!?

R
equests are asynchronous

Serializat ion
>
Fallback solut ions are easy
LOGO SPEAKER‘S COMPANY
Retrospectives

LOGO SPEAKER‘S COMPANY
38
Observations
>
Pure
UI Developers cease to exist
>
CSS skills are primary
>
Easier to build advanced Ajax than to emulate Struts
>
Hosted mode is absolutely necessary
>
Used GWT in unnatural ways

S
ingle entry point

Servlet filter emulation

LOGO SPEAKER‘S COMPANY
39
Common Widget Library
>
Should be extracted from the first projects
>
Packaged into Jar
>
Possible to

reuse on enterprise level

LOGO SPEAKER‘S COMPANY
40
Technical Constraints (1)
GWT feels like Java except:
>
No reusable libraries (even Apache Commons)
>
Limited reflection mechanism
>
No multithreading
>
No BigDecimal type
>
No SimpleDateFormat
>
...

LOGO SPEAKER‘S COMPANY
41
Technical Constraints (2)
>
Hosted Mode ignores web.xml
>
Packaging constraints

Unit tests

Package “
client”
is required

LOGO SPEAKER‘S COMPANY
42
Technology
Advantages
>
Faster development of advanced features
>
Reusable components
>
Scalability (memory,
cpu
)
>
Cross- browser compatibility
LOGO SPEAKER‘S COMPANY
Summary

LOGO SPEAKER‘S COMPANY
44
Summary
GWT is good enough to be used in “large enterprise projects”
>
Pros

Stateless architecture

Sophisticated UI tricks made easy

Cross- browser portability (except CSS)

Stable technology
>
Cons

Framework
on top of GWT is
required

Provided w
idget library
is not enough

Difficult project start- up time

LOGO SPEAKER‘S COMPANY
45
GWT Future
>
GWT 1.5 is coming with Java 5 and other
improvements
>
Emerging
frameworks and
widget
libraries
>
Can be used not only in Java applications
>
More GWT projects for us
...
LOGO SPEAKER‘S COMPANY
Q&A Time
LOGO SPEAKER‘S COMPANY
Dmitry Buzdin
ht tp://www.ct co.lv
C.T.Co ltd.
dmitry.buzdin@ctco.lv