+ All Categories
Home > Technology > Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Date post: 08-May-2015
Category:
Upload: ido-green
View: 363 times
Download: 1 times
Share this document with a friend
Description:
In this talk from DevCon TLV I've covered the two sides of the coin: 1. Client side: what are the main steps when you are building your Web Applications: ○ Design ○ Code ○ Debug ○ Demo 2. On the server side, you wish to have a great API that you (and others) could use from any platform out there (Mobile, web). The answer on Google Cloud platform is Google Cloud Endpoints.
43
Modern Web Applications With HTML5 Ido Green, Developer Advocate plus.google.com/+greenido
Transcript
Page 1: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Modern Web Applications With HTML5

Ido Green, Developer Advocateplus.google.com/+greenido

Page 2: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Agenda

● Modern Web Applications○ Design○ Code○ Debug○ Demo

● Google Cloud Endpoints

Page 3: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Modern Web Applications

Page 4: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Modern Applications

● Self Contained

● "Offline First"

● MV* Frameworks

● Device Aware

● #Perfmatters

Page 5: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

● Performance! #Perfmatters

● Flaky connections (e.g. cafes, car)

● Airplane, road trip, deserted island

● Consolidates the concept of permanent application.

* We will use: Lawnchair for our demo.

Offline - Why?

Page 6: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

● Storing assets: AppCache

● Storing data: localStorage, IndexedDB, File API.

● Offline first:○ Pretend that there's no internet connection○ Implement a sync layer that works only when

online.

Offline - How?

navigator.onLine & window.(ononline|onoffline)

Page 7: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Offline - Appcache

<html manifest="myapp.manifest">

CACHE MANIFEST

#version 1.2.3

#JS

js/main.js

#CSS

css/bootstrap.min.css

#Images

img/left-back.png

● You can use it TODAY:

○ http://caniuse.com/#feat=offline-apps

● Will also be used when the user

is online.

● Allows you to define fallback

pages.

● (!) Don't cache the manifest!

● http://www.html5rocks.com/en/tutorials/app

Page 8: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Use abstractions● Lawn Chair - brian.io/lawnchair/

● asyncStorage - https://github.com/WebReflection/db

● IndexedDBShim - nparashuram.com/IndexedDBShim/

Page 9: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Design Web Applications

Page 10: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

(Da New) Design process

Page 11: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

A Page? An App?

● It's not pages anymore

● Design from the content out

● Your web app as a collection of

(web) components

● Less is more: Any addition has the

potential to ruin our MVP

Page 12: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Design A List Again?

● Don't reinvent the wheel

○ http://html5rock.com

○ http://pttrns.com

○ http://mobile-patterns.com

● Don't let "web" nor "Enterprise"

be an excuse

Page 13: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Design - Phones? Tablets?

● Start with the UX

○ Balsamiq, Creately,

MockFlow

○ Aim for common

device breakpoints

(4:3, 16:9)

Page 14: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Philosophy: Adaptive Apps● Adaptive apps

○ Custom views and templates for each form factor○ Shared the model

● Use responsive design within the form factor

● progressive enhancement So your app is useful on any platform.

Page 15: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Building Web Applications

Page 16: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

MV* For The Win

● Separating concerns

○ Model handles data

○ server persistence layer

○ View handles user input and

rendering

● Used to be on the server...

Page 17: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

AngularJS - Client Side Framework

Angular.js - Let you extend HTML vocabulary for your application.

● Data binding

● Extensible HTML

● Dependency Injection / TestableMore options: addyosmani.github.com/todomvc/

Page 18: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Mobile World - RESTful World

Photos● GET http://ex.com/_ah/api/picturesque/v1/photos● POST http://ex.com/_ah/api/picturesque/v1/photo● PATCH http://ex.com/_ah/api/picturesque/v1/photo/id

Users● POST http://ex.com/_ah/api/picturesque/v1/users/join

And more...

Page 22: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Device APIs WG: www.w3.org/2009/dap/

● Geolocation API (Psst... support in DevTools)

● Device Orientation API (accelerometer in your DevTools)

● WebGL ( GPU )

● HTML5 Filesystem API

● Network connectivity

● Battery API

● Gamepad API

● WebRTC

● Web Audio API ( core audio )

"Device APIs"

● mobilehtml5.org/● caniuse.com

Page 23: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Google Cloud Endpoints

Page 24: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Modern Apps and The Server Conundrum

Have to deal with a server○ Offload Computation○ Sharing and Collaboration○ Logs

But who wants to run a server?○ Spikey traffic - Scaling challenges○ Client Server communication○ Serialization○ OAuth Dance

Page 25: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Google App Engine

Page 26: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Google App Engine

Page 28: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Google APIs: Client Libraries ● Web

○ JavaScript: google-api-javascript-client○ Node.js: google-api-nodejs-client○ Dart: google-api-dart-client

● Mobile○ Objective C: google-api-objectivec-client○ Java: google-api-java-client

● Server-side○ Ruby: google-api-ruby-client○ Python: google-api-python-client○ Go: google-api-go-client○ PHP: google-api-php-client○ .NET: google-api-dotnet-client○ GWT: gwt-google-apis

Page 29: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Google APIs

HTML<body> ... <script type="text/javascript"> function init() { gapi.client.load(‘urlshortener’, 'v1’, function() {}); } </script> <script src="https://apis.google.com/js/client.js?onload=init"></script></body>

Page 30: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Google Cloud Endpoints

Page 31: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Simple GET API Request

Page 32: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Using Data Model for Insert

[email protected](name='picturesque', version='v1', description='Photos API for Picturesque App')class PicturesqueApi(remote.Service):

@Photo.method(path='photo', name='photo.insert') def PhotoInsert(self, photo): # do some validation photo.put() return photo

Page 33: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Insert With Drag and Drop Demo

Python

Page 35: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

List Demo - Get Photos Baby!

Pythonvar req = gapi.client.picturesque.photo.list();

req.execute(function(data) {

data.items = data.items || [];

console.log("-- We have " + data.items.length);

addPhotos(data.items);

});

Page 37: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

"Smart" Client

● Network calls are expensive

● "Client" photo library ○ Lawnchair allows us to store photos' metadata

offline○ filer.js to store the photos○ Application Cache

● Do not Repeat Yourself○ Applies to code and to API calls○ Only retrieve photos that have been updated

since the last API call

Page 38: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Chrome DevTools

Page 39: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

What Is New?

○ Edit local projects

○ Check Devices: User agents, screen sizes, touch events etc'

○ Map source for: coffeescript, sass, dart etc'.

○ Test on your mobile device from DevTools.

○ More?

■ GDL "The Breakpoint" episodes

■ Improving Your 2013 Productivity With The Chrome DevTools

Page 40: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

The Screen Are Smaller

● Debug○ Remote debugging hack with jsconsole.com○ Chrome for Android remote debug with DevTools.

● Testing○ Qunit to test models○ Selenium and its mobile option Remote Web Driver

● How To○ http://mobile-html.appspot.com/

Page 42: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Key Take Aways

● Build powerful applications with Google Cloud Endpoints

● HTML5 APIs are ready and getting better fast.

● AngularJS - be more productive

● Leverage Modern Browser Features:○ Offline○ Web RTC○ New CSS3 artifacts○ Web workers

Page 43: Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)

Questions? THANK YOU!

Ido GreenDeveloper Relationshttp://plus.google.com/+greenido

App:: https://picturesque-app.appspot.com/

HTML5 APIs: http://ido-green.appspot.com/html5fest-il/

Slides: http://ido-green.appspot.com/


Recommended