gwt architectures and lessons learned (wjax 2013)

75
GWT Architectures and Lessons Learned p.g.taboada | pgt technology scouting GmbH

Upload: pgt-technology-scouting-gmbh

Post on 25-May-2015

1.057 views

Category:

Technology


0 download

DESCRIPTION

GWT-Entwicklung ist Rich-Client-Entwicklung, und das ist für viele Webentwickler neu. Mit den "Lessons Learned" aus der Entwicklung von Google AdWords wurden Architekturmuster für GWT-Anwendungen vorgestellt. Einiges davon ist inzwischen in GWT gelandet und kann sofort eingesetzt werden. In diesem Vortrag werden Architekturmuster vorgestellt, die in den letzten Jahren in einigen Projekten erfolgreich eingesetzt wurden.

TRANSCRIPT

Page 1: GWT Architectures and Lessons Learned (WJAX 2013)

GWT Architectures and Lessons Learned

p.g.taboada | pgt technology scouting GmbH

Page 2: GWT Architectures and Lessons Learned (WJAX 2013)

Papick G. Taboada

pgt technology scouting GmbH!http://pgt.de

Orientation in Objects GmbH!http://oio.de

Page 3: GWT Architectures and Lessons Learned (WJAX 2013)

http://gwtreferencelist.appspot.com

Page 4: GWT Architectures and Lessons Learned (WJAX 2013)

‣GWT Development

‣Basics

‣Structuring the UI

Page 5: GWT Architectures and Lessons Learned (WJAX 2013)

Shift happened

Java development, JS deployment,

Async, RPC,

RIA/ single page, ...

Page 6: GWT Architectures and Lessons Learned (WJAX 2013)

Web 2.0 ? development is all about…

!…js

…html …css

!none of it

!…jcp

…oracle … IBM

… backend

Page 7: GWT Architectures and Lessons Learned (WJAX 2013)

what is a GWT application?

a chunk of JS that does a lot of DOM manipulation to create web

applications

Page 8: GWT Architectures and Lessons Learned (WJAX 2013)

Widget t = new TextBox(); !

RootPanel.get().add(t);

UI component model

Browser Composite

Components

Page 9: GWT Architectures and Lessons Learned (WJAX 2013)

Architecture shift

Web applications

Model 2 web applications

Rich internet applications

+ testability!+ maintainance!+ product development

Page 10: GWT Architectures and Lessons Learned (WJAX 2013)

Browser Server

user action

full html response

full html response

full html response

user action

user action

classi

c web !

development

Page 11: GWT Architectures and Lessons Learned (WJAX 2013)

Browser Server

event

first request

full html response

data

data request

data

data request

event

event

event

RIA web

development

Page 12: GWT Architectures and Lessons Learned (WJAX 2013)

Web frameworks

Page 13: GWT Architectures and Lessons Learned (WJAX 2013)

low level, generic tools

Page 14: GWT Architectures and Lessons Learned (WJAX 2013)

let‘s build big things

Page 15: GWT Architectures and Lessons Learned (WJAX 2013)

TextBox t0 = new TextBox(); TextBox t1 = new TextBox(); TextBox t2 = new TextBox(); TextBox t3 = new TextBox(); TextBox t4 = new TextBox();

VerticalPanel... SplitPanel... ScrollPanel

RootPanel.get().add(mainPanel);

Page 16: GWT Architectures and Lessons Learned (WJAX 2013)

maintainance hell

Page 17: GWT Architectures and Lessons Learned (WJAX 2013)

MacGyverAll he needed was a ballpoint

pen and a paper clip

Page 18: GWT Architectures and Lessons Learned (WJAX 2013)

Ops

Page 19: GWT Architectures and Lessons Learned (WJAX 2013)

app-framework wizardry needed

Page 20: GWT Architectures and Lessons Learned (WJAX 2013)

‣GWT Development

‣Basics

‣Structuring the UI

Page 21: GWT Architectures and Lessons Learned (WJAX 2013)

DANGER GWT DEVELOPMENT IS

COMPLICATED HOT NEW STUFF.

Page 22: GWT Architectures and Lessons Learned (WJAX 2013)

NOT REALLY

Page 23: GWT Architectures and Lessons Learned (WJAX 2013)

GWT development

is not new, but different

Page 24: GWT Architectures and Lessons Learned (WJAX 2013)

WEB DEVELOPMENT IS NOT NEW...

Page 25: GWT Architectures and Lessons Learned (WJAX 2013)

THERE IS NOT A MOMENT TO LOOSETHERE IS NOT A MOMENT TO LOOSEJan 2000 Jan 2005

XHTML 1.0Jan 2000

HTML 4.0.1Dez 1999

CSS 2Mai 1998

HTML 4.0 updateApril 1998

XHTML 1.1Mai 2001

HTML 2.0November 1995

HTML 4.0Dezember 1997

Java EE 1.2Dez 1999

JDK 1.1Feb 1997

Internet Explorer 6Aug 2001

JDK 1.0Jan 1996

CSS 2.1Feb 2004 – Jun 2011

CSS level 2 revision 1, often referred to as "CSS 2.1", fixes errors in CSS 2, removes poorly supported or not fully interoperable features and adds already-implemented browser extensions to the specification. In order to comply with the W3C Process for standardizing technical specifications, CSS 2.1 went back and forth between Working Draft status and Candidate Recommendation status for many years.

J2SE 1.2Dez 1998

J2SE 1.3Mai 2000

CSS 1Dez 1996

HTML 3.2Januar 1997

Page 26: GWT Architectures and Lessons Learned (WJAX 2013)

RICH CLIENT DEVELOPMENT IS NOT NEW EITHER

Page 27: GWT Architectures and Lessons Learned (WJAX 2013)

nothing new here

Page 28: GWT Architectures and Lessons Learned (WJAX 2013)

nothing new here too

Jan 2007

Page 29: GWT Architectures and Lessons Learned (WJAX 2013)

YES! This is my code!

Page 30: GWT Architectures and Lessons Learned (WJAX 2013)

It’s all aboutsoftware engineering

Page 31: GWT Architectures and Lessons Learned (WJAX 2013)

Just a few tips

Page 32: GWT Architectures and Lessons Learned (WJAX 2013)

USE MVP!You will get used to it

Page 33: GWT Architectures and Lessons Learned (WJAX 2013)

event bus pleasehttp://jarrettws.blogspot.de/2010/05/public-transport.html

Page 34: GWT Architectures and Lessons Learned (WJAX 2013)

eventbus.fireEvent( NotificationEvent.info( "Daten wurden erfolgreich gespeichert"

) );

Page 35: GWT Architectures and Lessons Learned (WJAX 2013)

SINGLETON don‘t public static instance

Page 36: GWT Architectures and Lessons Learned (WJAX 2013)

BUT ON IE 6 IT IS SO SLOW!

Page 37: GWT Architectures and Lessons Learned (WJAX 2013)

BUT ON IE 7 IT IS SO SLOW!

Page 38: GWT Architectures and Lessons Learned (WJAX 2013)

BUT ON IE 8 IT IS SO SLOW!

Page 39: GWT Architectures and Lessons Learned (WJAX 2013)

BUT ON IE 9 IT IS SO SLOW!

Page 40: GWT Architectures and Lessons Learned (WJAX 2013)

DID ANYONE TEST ON IE / SURFACE?

Page 41: GWT Architectures and Lessons Learned (WJAX 2013)

browsers day to day job

Page 42: GWT Architectures and Lessons Learned (WJAX 2013)

too many HTTP requests

Page 43: GWT Architectures and Lessons Learned (WJAX 2013)

WTF?

> 2400 DOM elements

Page 44: GWT Architectures and Lessons Learned (WJAX 2013)

too many widgets

Page 45: GWT Architectures and Lessons Learned (WJAX 2013)

use large HTML chunks

Page 46: GWT Architectures and Lessons Learned (WJAX 2013)

too many widgets ain‘t good

Page 47: GWT Architectures and Lessons Learned (WJAX 2013)

a Widget is a JS thing holding a DOM element

<div />

Page 48: GWT Architectures and Lessons Learned (WJAX 2013)

CREATE CUSTOM WIDGETS

don‘t extend FlextTable

don‘t extend VerticalPanel

don‘t extend SimplePanel

CREATE CUSTOM EVENTS

extend composite!!!

Page 49: GWT Architectures and Lessons Learned (WJAX 2013)

if you can, do it in CSS

@-webkit-keyframes redPulse { from { box-shadow: 0px 0px 2px #ff0033; } 50% { box-shadow: 0px 0px 10px #ff0033; } to

{ box-shadow: 0px 0px 2px #ff0033; } }

Page 50: GWT Architectures and Lessons Learned (WJAX 2013)

use LayoutPanel

<g:LayoutPanel styleName="{B.style.mainContent}"> <g:layer left="0" right="340px" top="0" height="50%"> <g:SimpleLayoutPanel styleName="{B.style.mainWidget}" addStyleNames="{B.style.termineGlow}"> <ux:DashboardTermineDataGrid ui:field="terminetable" styleName="{B.style.mainWidgetContent}" /> </g:SimpleLayoutPanel> </g:layer> <g:layer right="0" width="340px" top="0" height="50%"> <g:SimpleLayoutPanel styleName="{B.style.mainWidget}" addStyleNames="{B.style.finanzenGlow}"> <ux:KWStatsDataGrid ui:field="statstable" styleName="{B.style.mainWidgetContent}" /> </g:SimpleLayoutPanel> </g:layer> <g:layer right="0" left="0" bottom="0" height="50%"> <g:SimpleLayoutPanel styleName="{B.style.mainWidget}" addStyleNames="{B.style.uebersichtGlow}"> <ux:WartelisteDataGrid ui:field="wartelistetable" styleName="{B.style.mainWidgetContent}" /> </g:SimpleLayoutPanel> </g:layer> </g:LayoutPanel>

Page 51: GWT Architectures and Lessons Learned (WJAX 2013)

Ray Ryan - lessons learned

Page 52: GWT Architectures and Lessons Learned (WJAX 2013)

‣GWT Development

‣Basics

‣Structuring the UI

Page 53: GWT Architectures and Lessons Learned (WJAX 2013)

„just do it“ pattern

„View A“

„View B“

mainPanel.setWiget( aWidget );

mainPanel.setWiget( bWidget );

some action

Page 54: GWT Architectures and Lessons Learned (WJAX 2013)

hard to maintain

Page 55: GWT Architectures and Lessons Learned (WJAX 2013)

history management

from day one! !

back button and refresh as a

feature (not a catastrophe)

Page 56: GWT Architectures and Lessons Learned (WJAX 2013)

keep it stupid simple

• use PLACES framework for main level navigation

• if you really need to, nest activities for a second level. try not to.

• use dialogs for user input, showing data. dialogs are easily reused.

Page 57: GWT Architectures and Lessons Learned (WJAX 2013)

Once upon a time, a good designer does

good a good looking design...

‣ he will be using photoshop or dreamweaver ‣ he will not use the

software ‣ he will not build the

software ‣ he will not maintain the

software

Page 58: GWT Architectures and Lessons Learned (WJAX 2013)
Page 59: GWT Architectures and Lessons Learned (WJAX 2013)

top menue bound to places framework

Page 60: GWT Architectures and Lessons Learned (WJAX 2013)

switching between places with fade in and out

Page 61: GWT Architectures and Lessons Learned (WJAX 2013)

teach user to wait until application is ready again

Page 62: GWT Architectures and Lessons Learned (WJAX 2013)

gives us enough time to load the required content

300ms out 500ms in

Page 63: GWT Architectures and Lessons Learned (WJAX 2013)
Page 64: GWT Architectures and Lessons Learned (WJAX 2013)

Components inside of

„activity“ fire non public,

custom events

Page 65: GWT Architectures and Lessons Learned (WJAX 2013)

datepicker sends WEEK

selected event

Page 66: GWT Architectures and Lessons Learned (WJAX 2013)

presenter may goto itself, view may be cached

Page 67: GWT Architectures and Lessons Learned (WJAX 2013)

#ashtag?!?

Page 68: GWT Architectures and Lessons Learned (WJAX 2013)

STATELESS VIEW !URL contains EVERYTHING needed to rebuild view

user hits reload

GWT apps starts, activity

gets fired

presenter loads data

from server

view is back again

Page 69: GWT Architectures and Lessons Learned (WJAX 2013)

some actions don‘t require PLACE navigation at all

Page 70: GWT Architectures and Lessons Learned (WJAX 2013)

use POPUPS/ DIALOGS to stay ABOVE navigation

Page 71: GWT Architectures and Lessons Learned (WJAX 2013)

let POPUPS/ DIALOGS move slowly into view

pin POPUPS to one side of the

window

Page 72: GWT Architectures and Lessons Learned (WJAX 2013)

Don‘t move your user away from his

„PLACE“ unless you have to.

Search DIALOG slides in from right side, stays on TOP

Page 73: GWT Architectures and Lessons Learned (WJAX 2013)

Navigation should not hurt

• The application shown uses only 3 levels of navigation, DOES NOT NEED MORE

• PLACES used for bookmarkable entry points/ back button navigation consistency

• Activities should be STATELESS, to survive page reloads

• Learn from OTHERS, lookout for hashtags…

Page 74: GWT Architectures and Lessons Learned (WJAX 2013)

BEFORE YOU ADD THE LOGO TO THE TOP

HOW MANY PIXELS DO YOUR USERS HAVE?

the designer or marketing guy

using photoshop is probably sitting in

front of a 27“ apple cinema

display

Page 75: GWT Architectures and Lessons Learned (WJAX 2013)

Thanks!