google web toolkit dudeanu ermoghen ib ă nescu diana melinte laurenţiu-ionuţ petrişor ionuţ c...

22
Google Web Toolkit Dudeanu Ermoghen Ibănescu Diana Melinte Laurenţiu-Ionuţ Petrişor Ionuţ Cătălin

Post on 15-Jan-2016

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Google Web Toolkit Dudeanu Ermoghen Ib ă nescu Diana Melinte Laurenţiu-Ionuţ Petrişor Ionuţ C ă t ă lin

Google Web Toolkit

Dudeanu ErmoghenIbănescu Diana

Melinte Laurenţiu-IonuţPetrişor Ionuţ Cătălin

Page 2: Google Web Toolkit Dudeanu Ermoghen Ib ă nescu Diana Melinte Laurenţiu-Ionuţ Petrişor Ionuţ C ă t ă lin

Evolution of applications1960 – 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

Page 3: Google Web Toolkit Dudeanu Ermoghen Ib ă nescu Diana Melinte Laurenţiu-Ionuţ Petrişor Ionuţ C ă t ă lin

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.

Page 4: Google Web Toolkit Dudeanu Ermoghen Ib ă nescu Diana Melinte Laurenţiu-Ionuţ Petrişor Ionuţ C ă t ă lin

• 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

Page 5: Google Web Toolkit Dudeanu Ermoghen Ib ă nescu Diana Melinte Laurenţiu-Ionuţ Petrişor Ionuţ C ă t ă lin

Rich Internet ApplicationsAjaxJesse James Garrett, “Ajax: A New

Approach to Web Applications”JavaScript, XMLHttpRequest

object;Only parts of the page are

updated;AJAX = Asynchronous JavaScript

and XML.

Page 6: Google Web Toolkit Dudeanu Ermoghen Ib ă nescu Diana Melinte Laurenţiu-Ionuţ Petrişor Ionuţ C ă t ă lin

AsynchronousSynchronous 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;

Page 7: Google Web Toolkit Dudeanu Ermoghen Ib ă nescu Diana Melinte Laurenţiu-Ionuţ Petrişor Ionuţ C ă t ă lin

JavaScriptInterpreted, 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;

Page 8: Google Web Toolkit Dudeanu Ermoghen Ib ă nescu Diana Melinte Laurenţiu-Ionuţ Petrişor Ionuţ C ă t ă lin

Ajax is only a name, not an acronymAjax 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

Page 9: Google Web Toolkit Dudeanu Ermoghen Ib ă nescu Diana Melinte Laurenţiu-Ionuţ Petrişor Ionuţ C ă t ă lin

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.

Page 10: Google Web Toolkit Dudeanu Ermoghen Ib ă nescu Diana Melinte Laurenţiu-Ionuţ Petrişor Ionuţ C ă t ă lin

RIA disadvantagesRequires JavaScript or

specific plug-in – 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;

Page 11: Google Web Toolkit Dudeanu Ermoghen Ib ă nescu Diana Melinte Laurenţiu-Ionuţ Petrişor Ionuţ C ă t ă lin

GWTWriting JavaScript is difficult and

error-prone;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;

Page 12: Google Web Toolkit Dudeanu Ermoghen Ib ă nescu Diana Melinte Laurenţiu-Ionuţ Petrişor Ionuţ C ă t ă lin

FeaturesOpen-sourceNo plugin required (VML, Flash,

Silverlight)Dynamic and reusable UI componentsBrowser history managementSupport for full-featured Java debuggingGWT handles all cross-browser issues

for the developerJUnit integrationEasy internationalization

Page 13: Google Web Toolkit Dudeanu Ermoghen Ib ă nescu Diana Melinte Laurenţiu-Ionuţ Petrişor Ionuţ C ă t ă lin

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)

Page 14: Google Web Toolkit Dudeanu Ermoghen Ib ă nescu Diana Melinte Laurenţiu-Ionuţ Petrişor Ionuţ C ă t ă lin

GWT limitationsNot indexable by search

enginesJavascript dependentNo clear separation between

code and styling/layout – structure created in code;

Page 15: Google Web Toolkit Dudeanu Ermoghen Ib ă nescu Diana Melinte Laurenţiu-Ionuţ Petrişor Ionuţ C ă t ă lin

ComponentsJava 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

Page 16: Google Web Toolkit Dudeanu Ermoghen Ib ă nescu Diana Melinte Laurenţiu-Ionuţ Petrişor Ionuţ C ă t ă lin

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;

Page 17: Google Web Toolkit Dudeanu Ermoghen Ib ă nescu Diana Melinte Laurenţiu-Ionuţ Petrişor Ionuţ C ă t ă lin

JRE Emulation libraryMapping 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;

Page 18: Google Web Toolkit Dudeanu Ermoghen Ib ă nescu Diana Melinte Laurenţiu-Ionuţ Petrişor Ionuţ C ă t ă lin

JRE emulated classesNo 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.DateTimeFormatNamespaces: java.lang; java.util; java.io;

Page 19: Google Web Toolkit Dudeanu Ermoghen Ib ă nescu Diana Melinte Laurenţiu-Ionuţ Petrişor Ionuţ C ă t ă lin

UI library

Page 20: Google Web Toolkit Dudeanu Ermoghen Ib ă nescu Diana Melinte Laurenţiu-Ionuţ Petrişor Ionuţ C ă t ă lin

ConceptsApplication 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;

Page 21: Google Web Toolkit Dudeanu Ermoghen Ib ă nescu Diana Melinte Laurenţiu-Ionuţ Petrişor Ionuţ C ă t ă lin

Who is using GWT ?http://www.curriki.orghttp://traceurl.comhttp://beta.contactoffice.com

Page 22: Google Web Toolkit Dudeanu Ermoghen Ib ă nescu Diana Melinte Laurenţiu-Ionuţ Petrişor Ionuţ C ă t ă lin

GWT 2.0 ImprovementsDifferent 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;