Google Web Toolkit
Download
Report
Transcript Google Web Toolkit
Google Web Toolkit
Dudeanu Ermoghen
Ibănescu Diana
Melinte Laurenţiu-Ionuţ
Petrişor Ionuţ Cătălin
Evolution of applications
1960 – Mainframes, punch cards,
monochrome text terminals;
◦ Same application, different code , one for every
operating system - big development cost;
Client/Server Applications
◦ WIMP(Windows, Icon, Menu, Pointer);
◦ Applications running on a desktop machine, with
centralized data on a server
◦ Bigger cost, because the client has to run on
every operating system; an upgrade to the system
required an update to the application
Web Applications
Internet, documents sharing;
HTML;
Browsers
◦ Back-Forward Navigation;
◦ Bookmarks;
Documents accessed by URL; HTTP Protocol; All
documents in one place;
Many standards: CSS, DOM, SVG, PNG; no proprietary
extensions => popularity, success;
Web application: application that resides on a central
server and can be accessed through web browsers;
HTML content is dynamically generated.
• Small cost; One application for all browsers;
clients have already all necessary software
installed; Easy to upgrade;
No rich user experience, no visual feedback,
slow; Every action results in a call to the
server to generate whole application;
Great improvement on cost effectiveness =>
most popular type of software application
No spreadsheets, messengers, etc;
Application with rich user interaction still was
developed as Client/Server Applications
Rich Internet Applications
Ajax
Jesse James Garrett, “Ajax: A New
Approach to Web Applications”
JavaScript, XMLHttpRequest object;
Only parts of the page are updated;
AJAX = Asynchronous JavaScript and XML.
Asynchronous
Synchronous interaction model = user
waits for data to be send an page to load.
In asynchronous model – the Ajax engine
running on a separate thread delegates
requests to server and handles the
results, while the user can interact with
the application
◦ No page refresh;
JavaScript
Interpreted, weakly typed programming language;
Created Brendan Eich at Netscape;
Originally named Mocha, then LiveScript;renamed
in 1995 to JavaScript.
No relation with Java;
Microsoft dialect: JScript;
1996 – JavaScript submitted to standardization,
resulted ECMAScript specification with JavaScript
as one of its implementations;
Ajax is only a name, not an acronym
Ajax can be implemented in
ActionScript(Flex)
Other technologies different from XML are
preferred
◦ A proprietary protocol
◦ JavaScript Object Notation(JSON) – lightweight
data interchange format based on name/value
pairs
◦ Plain JavaScript – most powerful; JavaScript code
hard to generate
RIA advantages
No instalation required – software run in a browser;
Updates are automatic – when page is revisited;
Platform independent – on every platform with a
browser;
More secure – little access to the local system; less likely to
be harmful
More responsive – compared to classic applications
More scalable – more computations done on client
More network efficient – only necessary data is send at
the server.
RIA disadvantages
Requires JavaScript or specific plugin – users can turn off javascript
No access to system resources –
cannot read local files;
Hard for search engines to index
fully
Depends on an Internet connection
Accessibility issues – screen readers have
problems with partial updated pages;
GWT
Writing JavaScript is difficult and errorprone;
JavaScript behaves a little different on
different browsers;
GWT (Google Web Toolkit)
◦ real abstraction layer that hides the detail of
JavaScript;
◦ Java to JavaScript compiler; easy to code and
debug in Java;
◦ Unit Testing; best coding practices;
Features
Open-source
No plugin required (VML, Flash, Silverlight)
Dynamic and reusable UI components
Browser history management
Support for full-featured Java debugging
GWT handles all cross-browser issues for
the developer
JUnit integration
Easy internationalization
The developers can mix handwritten
JavaScript in the Java source code using the
JavaScript Native Interface
Support for using Google APIs in GWT
applications (Google Gears)
The developers can design and develop their
application in a pure object-oriented fashion
A number of libraries are available for GWT,
by Google and third parties(exGWT)
GWT limitations
Not indexable by search engines
Javascript dependent
No clear separation between code
and styling/layout – structure created
in code;
Components
Java to JavaScript compiler – the heart
of GWT, compiles java code for client part
into JavaScript
JRE Emulation library – classes from Java
have to have an equivalent in javascript to be
used with GWT
UI building library – the biggest part; UI
components; RPC support; history
management;
GWT Hosted Web Browser – develop in
hosted mode; code compiled in Java; used for
debugging
Java to JavaScript Compiler
A program that can be started by running
the class
com.google.gwt.dev.GWTCompiler;
Unreferenced code is not compiled;
Doesn’t allow runtime loading of classes;
Is a little slow;
A different JavaScript code version for
every browser category is generated;
JRE Emulation library
Mapping of JRE into JavaScript;
Differences from JRE:
◦ No long support;
◦ Exception handling – no NullPointerException,
OutOfMemory; no getStackTrace();
◦ Single threaded – JavaScript interpreters are
single threaded; thread related functions and
keywords have no effect
◦ No reflection - related to the fact GWT needs
to know each class and methods used in order to
optimize code;
JRE emulated classes
No SQL, file support(because of JavaScript
security restrictions)
Only a subset of classes are emulated;
Differences in classes:
◦ Regular expressions – different behavior;
◦ Different serialization support from java;
Some common used classes are different
◦ java.util.DateTimeFormat ->
com.google.gwt.i18n.client.DateTimeFormat
Namespaces: java.lang; java.util; java.io;
UI library
Concepts
Application organized in modules;
---------------------------------------------------------------------------------Host page – the page
that has the application loader;
Running modes:
◦ Hosted mode – code compiled in java bite code;
full debugging support; running in an emulated
browser;
◦ Web mode – code compiled in JavaScript; running
on real browser;
Who is using GWT ?
http://www.curriki.org
http://traceurl.com
http://beta.contactoffice.com
GWT 2.0 Improvements
Different terminology : “Development
mode” instead of “hosted mode”
In-browser development mode – debugging
in real browsers; Based on plug-ins for every
browser
Code chunks – on demand loading of
needed code;
Declarative user interface – UI can be
declared in a XML file;
Bundling of resources – XML, CSS and text
files can be combined into one file for fewer
server requests;