Progressive Enhancement With GQuery and GWT. Ray Cromwell ray@timefire.com



Similar documents
An introduction to creating Web 2.0 applications in Rational Application Developer Version 8.0

Front-End Performance Testing and Optimization

Drupal Performance Tuning

Google Web Toolkit. Introduction to GWT Development. Ilkka Rinne & Sampo Savolainen / Spatineo Oy

Credits: Some of the slides are based on material adapted from

Table of contents. HTML5 Data Bindings SEO DMXzone

Developing Cross-platform Mobile and Web Apps

Coding for Desktop and Mobile with HTML5 and Java EE 7

Dynamic Web Programming BUILDING WEB APPLICATIONS USING ASP.NET, AJAX AND JAVASCRIPT

place/business fetch details, removefromfavorite () function, 189 search button handler bind, B BlackBerry build environment

Building native mobile apps for Digital Factory

Advantage of Jquery: T his file is downloaded from

Rich Internet Applications

HtmlUnit: An Efficient Approach to Testing Web Applications

CHOOSING THE RIGHT HTML5 FRAMEWORK To Build Your Mobile Web Application

AJAX. Gregorio López López Juan Francisco López Panea

Web Development. How the Web Works 3/3/2015. Clients / Server

How To Build A Web App

Example. Represent this as XML

Google Web Toolkit (GWT) Architectural Impact on Enterprise Web Application

Facebook Twitter YouTube Google Plus Website . o Zooming and Panning. Panel. 3D commands. o Working with Canvas

QML and JavaScript for Native App Development

Web Cloud Architecture

Mobile development with Apache OFBiz. Ean Schuessler, Brainfood

Pentesting Web Frameworks (preview of next year's SEC642 update)

Learn to Compose and Utilise GWT

Lucy Zhang UI Developer Contact:

Mobile Performance: for excellent User Experience

Mobile Web Design with HTML5, CSS3, JavaScript and JQuery Mobile Training BSP-2256 Length: 5 days Price: $ 2,895.00

Introducing Apache Pivot. Greg Brown, Todd Volkert 6/10/2010

CMSC434 TUTORIAL #3 HTML CSS JavaScript Jquery Ajax + Google AppEngine Mobile WebApp HTML5

Rich Web Applications in Server-side Java without Plug-ins or JavaScript

How To Write An Ria Application

Reading an sent with Voltage Secur . Using the Voltage Secur Zero Download Messenger (ZDM)

Web Apps The Next Generation

FIVE WAYS TO OPTIMIZE MOBILE WEBSITE PERFORMANCE WITH PAGE SPEED

<Insert Picture Here> Oracle Application Express 4.0

Responsive Web Design Creative License

White Paper On. Single Page Application. Presented by: Yatin Patel

HTML5, The Future of App Development

Lecture 4 Cross-Platform Development. <lecturer, date>

Cross Platform Applications with IBM Worklight

E-commerce. business. technology. society. Kenneth C. Laudon Carol Guercio Traver. Third Edition. Copyright 2007 Pearson Education, Inc.

WHITE PAPER on Flex to HTML5 The Migration Challenge. April 2014

Modern Web Development with Dart. Alan Knight Google

10CS73:Web Programming

Cross Platform App Development

The Learn-Verified Full Stack Web Development Program

Web 2.0 Technology Overview. Lecture 8 GSL Peru 2014

Modern Web Development From Angle Brackets to Web Sockets

Scalable and Efficient Web Application Architectures. Thin-clients and SQL vs. Thick-clients and NoSQL

Web Design Technology

Enterprise Application Development In Java with AJAX and ORM

AUTOMATED CONFERENCE CD-ROM BUILDER AN OPEN SOURCE APPROACH Stefan Karastanev

End User Monitoring. AppDynamics Pro Documentation. Version Page 1

Oracle Identity Analytics Architecture. An Oracle White Paper July 2010

Whitepaper. Rich Internet Applications. Frameworks Evaluation. Document reference: TSL-SES-WP0001 Januar

A Model of the Operation of The Model-View- Controller Pattern in a Rails-Based Web Server

RIA Technologies Comparison

YouTrack MPS case study

How To Develop A Mobile App With Phonegap

TDAQ Analytics Dashboard

Web application Architecture

Agile Web Application Testing

The Google Web Toolkit (GWT): Overview & Getting Started

Browser tools that make web development easier. Alan Seiden Consulting alanseiden.com

IBM Script Portlet for WebSphere Portal Release 1.1

Advanced Web Development SCOPE OF WEB DEVELOPMENT INDUSTRY

Developing multidevice-apps using Apache Cordova and HTML5. Guadalajara Java User Group Guillermo Muñoz Java Developer

From Desktop to Browser Platform: Office Application Suite with Ajax

Enterprise Mobile Application Development: Native or Hybrid?

Introduction to Mobile Performance Testing

DOCUMENT REFERENCE: SQ EN. SAMKNOWS TEST METHODOLOGY Web-based Broadband Performance White Paper. July 2015

Speed up your web site. Alan Seiden Consulting alanseiden.com

Best practices building multi-platform apps. John Hasthorpe & Josh Venman

Web-Application Security

Enable Your Automated Web App Testing by WebDriver. Yugang Fan Intel

Using HTML5 Pack for ADOBE ILLUSTRATOR CS5

DIPLOMA IN WEBDEVELOPMENT

A History of Tcl in the Browser

Electronic Commerce Engineering

Framework as a master tool in modern web development

Web Designing with UI Designing

Cross Platform Applications with IBM Worklight

Transcription:

Progressive Enhancement With GQuery and GWT Ray Cromwell ray@timefire.com

Web Application Models Web 1.0, 1 Interaction = 1 Page Refresh Pure JS, No Navigation Away from Page Mixed Model, Page Reloads + AJAX

Web 2.0 era Return to simplicity (Rails, Django) HTML enhanced with client-side JS Page reloads gradually replaced with AJAX calls

Today s Applications Shift more logic to client UI Frameworks like jquery growing End to end tool chain lacking maturity Typically separate toolspace for client and backend (Rails, etc)

GWT Compiles Java code to optimized Javascript Produces incredibly fast code Reduces startup latency Integrates easily with Java language tools Increases productivity and decreases errors May be a big leap for existing mature apps

But... Currently encourages UI development using Widget abstraction Learning curve for UI designers wanting to integrate May conflict with existing design processes

Progressive Enhancement Many designers start with look Reify into server-side rendering using LAMP frameworks Layer Javascript on top to enhance UI Page can always degrade to working Web 1.0 app when Javascript is lacking Facilitates SEO and accessibility

Attaching Javascript

Attaching Javascript

Attaching Javascript

Attaching Javascript

Attaching Javascript

Attaching Javascript

Attaching Javascript

jquery Core Concepts Querying Method Chaining Manipulation Attaching Data and Events Plugins

GQuery is jquery clone written in GWT Designed to fit into design centric workflow Enable easy progressive enhancement of existing applications Be easy to learn for those using jquery While delivering all of the productivity, efficiency, and safety benefits of GWT

This is legal Java code! CSS Selector Strongly Typed Property Name Typed CSS Value

Edit time Suggests Legal Values Documentation from CSS2 Spec

Typing has Other Benefits Output Code from GWT (for Safari) css() function inlined Constant propagated Inlined call to native queryselectorall

Think about safety See anything wrong?

Think about safety See anything wrong? Typo in property name

Think about safety See anything wrong? Typo in property name Lavender is not a valid color

Think about safety See anything wrong? Typo in property name Lavender is not a valid color ID might not exist

Think about safety See anything wrong? Typo in property name Lavender is not a valid color ID might not exist dblclick!= doubleclick

Unit Testing

GQuery Demo

Hosted Mode Magic Hosted Mode is like GreaseMonkey, but injects Java code instead of Javascript!

Performance

Performance (Dreaded IE6)

Compactness

Compactness $( div.note ).text( Hello Google I/O );

Compactness $( div.note ).text( Hello Google I/O ); ~10,000 lines of Java code

Compactness $( div.note ).text( Hello Google I/O ); ~10,000 lines of Java code 300kbytes on disk

Compactness $( div.note ).text( Hello Google I/O ); ~10,000 lines of Java code 300kbytes on disk How big is the compiled output?

Compactness $( div.note ).text( Hello Google I/O ); ~10,000 lines of Java code 300kbytes on disk How big is the compiled output? 15kb or larger? (size of JQuery 1.2)

Compactness $( div.note ).text( Hello Google I/O ); ~10,000 lines of Java code 300kbytes on disk How big is the compiled output? 15kb or larger? (size of JQuery 1.2) How about 7kb, a 50% reduction?

Compactness $( div.note ).text( Hello Google I/O ); ~10,000 lines of Java code 300kbytes on disk How big is the compiled output? 15kb or larger? (size of JQuery 1.2) How about 7kb, a 50% reduction? Actual answer: 760 bytes (Safari)

Compactness $( div.note ).text( Hello Google I/O ); ~10,000 lines of Java code 300kbytes on disk How big is the compiled output? 15kb or larger? (size of JQuery 1.2) How about 7kb, a 50% reduction? Actual answer: 760 bytes (Safari) Smaller than HTTP headers used to fetch

Compactness

Performance Explained GQuery can parse, optimize, and compile selectors at compile time Inlining and other optimizations help Only fields and methods references are included in output, reducing size

Compile Time vs Runtime $( query expression ) - Runtime GWT.create(Slide.class) - Compile Time

$(selector) On HTML5, document.queryselectorall() On Firefox2, older Safari, Opera document.evaluate(xpath) Everyone else, lots of RegExp and DOM calls. Note: each browser gets own separately compiled version

Compile Time Selector (HTML5) Statically short-circuited to queryselectorall getelementsbyclassname for $(.foo ) getelementbyid for $( #foo )

Compile Time Selectors (Firefox2, Safari2, etc) On XPath capable browsers CSS selector translated to XPath query document.evaluate() invoked otherwise, short-circuited to getelementbyid e.g. for $( #foo )

Compile Time Selectors (Dreaded IE6) Generate inlined calls to runtime selector engine (JS) Possible to short-circuit or eliminate some cases Parsing step still avoided.

Workflow Starting HTML Desired

jquery enhancement

GQuery (Inner Class)

GQuery Lazy $.lazy() = function() {.end() = }

GQuery for Designers Provide reusable components Auto-generate documentation Leverages compile-time selectors

Design Time Docs GQuery produces Javadoc-like documentation for designers Each selector can have extra metadata associated Name of Design Element Menu Item Sample Usage Selector/CSS Classes used

Design Time Selectors

Example GQuery Doc

GQuery Extension jquery-like plugin mechanism Type-safe chained calls Extremely simple to write Zero overhead unless invoked by developer

Example: Star Ratings

Anatomy of a Plugin Foo extends GQuery Implement Plugin<Foo> interface In static initializer, invoke GQuery.registerPlugin() Declare static Class<Foo> Foo = Foo.class

License Open Source Apache License Available now at http://gwtquery.com Come contribute to the core, or write plugins! Thanks to Manuel Carrasco for unit tests and patches. More info at timepedia.blogspot.com

Questions?