29
LOGO SPEAKER‘S COMPANY # 6 the perfect experience.

GWT@Jazoon08 - Part 6/6 - The Perfect Experience

Embed Size (px)

DESCRIPTION

A presentation about GWT which I presentaed at Jazoon '08Part 6/6 - The Perfect Experience

Citation preview

Page 1: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

# 6the perfect experience.

Page 2: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

Starbucks experience ...

Page 3: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

the Virgin lounge ...

Page 4: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

Vegas baby, yeah ...

Page 5: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

gears.[ the quest ]

Page 6: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

“Make it possible to create web appsas powerful as desktop appsby unlocking the local machine’s capabilities.”

- Gears Vision

Page 7: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

BROWSER CHALLENGES

desktop experience

connectivity

reliability

responsiveness

computing power

busy?

loop?

what should I do?

Page 8: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

MODULES

offline database blob

offline local server resumable upload

offline workerpool geolocation

desktop shortcuts file system load / save

desktop notifications

… much more on the way

Page 9: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

gears.[ offline ]

Page 10: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

blind adaption.

decide on offline features

modal versus modeless

manual versus background synchronization

architecture

Page 11: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

OFFLINE FEATURE AVAILABILITY

caching transient data makes no senseReal-time stock quotes

some data just does not make sense offlineInstant messaging

doesn’t mean you have to cache everythingFrequently accessed data

computational / disk space requirements make it unfeasable

Page 12: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

MODAL

distinct online / offline modes

user is state aware and and participates in switching states

online it only communicates with the server

data synchronization when the user switches between states

local data is not always up-to-date

more user interaction required

Page 13: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

MODELESS

the application assumes it is offline

or that it can loose connection at any time

user does not have to be state aware

application uses the local store as much as possible

continuous small data syncs in the background

data synchronization is also done when coming back online

Page 14: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

MANUAL SYNCHRONIZATION

user drives synchronization through user interface

user must be aware of the network state

user must remember to synchronize before going offline

amount of data must be small enough to download quickly

local data is not always up-to-date

more user interaction required

Page 15: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

BACKGROUND SYNCHRONIZATION

continuous synchronization through background process

user is unaware

data is ready at all times (offline / accidentally disconnected)

fast performance even when slow connection

sync process might slow down the application

Page 16: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

SYNCHRONIZATION IS HARD

need GUIDs

need timestamps (SQLite has no Date)

need a strategy :

last one wins

lock / checkout

let user decide

Page 17: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

TRADITIONAL ARCHITECTURE

GEARS ARCHITECTURE

Page 18: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

GEARS FEATURES

LocalServer

cache and serve application resources locally

Database

store data locally in a fully-searchable relational database

WorkerPool

perform resource-intensive operations asynchrounously

Page 19: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

LOCALSERVER

ResourceStore

manual resource capturing

ManagedResourceStore

capture entire applications

list applications in separate manifest file

gears captures and updates the list automatically

Page 20: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

WORKERPOOL

run JavaScript in the background

provides thread-like functionality

no more blocking the browser UI

inter WorkerPool Communication is via message Strings

no shared state or threading primitives

does not trigger the browser's "unresponsive script" dialog

no DOM access

no singleton, multiple instances can be instantiated

Page 21: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

DATABASE

embedded SQLite

full text search with FTS2

limited data types (Integer, Real, Text, Blob)

low level API

Page 22: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

SECURITY

one simple rule: Same-origin-policy

all local files are stored in your local profile directory

Page 23: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

gears.[ advanced use case: orm ]

Page 24: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

DATA OBJECT + GEARS ORM ANNOTATIONS

@gears.table (name=“Wishes”)

public class Wish implements GearsDataObject {

@gears.id (length = 50)

private String name;

@gears.column (name = “description”, length = 200)

private String description;

}

BINDING

<generate-with class=“com.GearsDAOGenerator”>

<when-type-assignable class=“com.GearsDataObject”/>

</generate-with>

Page 25: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

USAGE

public void onModuleLoad() {

GearsDAO wishDAO = GWT.create(Wish.class); // Initializes database

Wish wish = new Wish(“Car”, “Red shiny with big wheels”);

wishDAO.save();

Wish wish = wishDAO.findById(“Car”);

wishDAO.delete(wish);

}

Page 26: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

FIND BY EXAMPLE

@gears.namedQuery (name=“findByDescription”

sql=“select :Wishes where description = ?”)

@gears.table (name=“Wishes”)

public class Wish implements GearsDataObject {

public static final String FIND_BY_DESCRIPTION = “findByDescription”;

@gears.column (name = “description”, length = 200)

private String description;

}

Page 27: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

USAGE

public void onModuleLoad() {

GearsDAO wishDAO = GWT.create(Wish.class);

GearsQuery query =

wishDAO.getNamedQuery(Wish.FIND_BY_DESCRIPTION);

query.setString(“Red shiny with big wheels”);

List<Wish> wishes = query.execute();

}

Page 28: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

questions?or later, [email protected]

Page 29: GWT@Jazoon08 - Part 6/6 - The Perfect Experience

LOGO SPEAKER‘S COMPANY

MAARTENVOLDERS.comPASSIONATE ABOUT PEOPLE AND TECHNOLOGY