59
Gustaf Nilsson Kotte (HTML Hypermedia APIs and Adaptive Web Design)

Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

Gustaf Nilsson Kotte

(HTML Hypermedia APIs and Adaptive Web Design)

Page 2: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

@gustaf_nk

Page 3: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013
Page 4: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

How to scale development of apps?

How to make our web work on every browser?

Page 5: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

How to scale development of apps? => HTML Hypermedia APIs

How to make our web work on every browser? => AWD

HTML Hypermedia APIs + AWD => Perfect combo!

Page 6: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013
Page 7: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013
Page 8: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013
Page 9: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013
Page 10: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013
Page 11: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

• Connected physical devices

• Types of devices

• Platforms

• Device models

http://gigaom.com/2010/04/14/ericsson-sees-the-internet-of-things-by-2020/

Page 12: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

Improved quality

Improved price

http://en.wikipedia.org/wiki/Commoditization

Page 13: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013
Page 14: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

54%35%

7%

3%

Google Apple RIM Microsoft

http://www.comscore.com/Insights/Press_Releases/2013/1/comScore_Reports_November_2012_U.S._Mobile_Subscriber_Market_Share

Page 15: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

http://opensignal.com/reports/fragmentation.php

Page 16: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013
Page 17: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

Move slowly

Hungry

Angry

Lots of them

Page 18: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

How to scale development of apps? => HTML Hypermedia APIs

How to make our web work on every browser? => AWD

HTML Hypermedia APIs + AWD => Perfect combo!

Page 19: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

iOS Android … … Web…

API

Store

?

Page 20: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

iOS Android … … Web…

API

Store

?

http://roca-style.org/#application-logic

Page 21: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

http://martinfowler.com/articles/richardsonMaturityModel.html

Page 22: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013
Page 23: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

Jon Moore

http://codeartisan.blogspot.com/2012/07/using-html-as-media-type-for-your-api.html

Page 24: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

http://codeartisan.blogspot.com/2012/07/using-html-as-media-type-for-your-api.html

Hypermedia controls

Jon Moore

Page 25: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

Support for out-bound navigational links (HTTP GET)<a href="http://www.example.org/search" title="view search page">Search</a>

Support for non-idempotent updates (HTTP POST)<form method="post" action="http://www.example.org/my-keywords"/>

<label>Keywords:</label>

<input name="keywords" type="text" value="" />

<input type="submit" />

</form>

http://amundsen.com/hypermedia/hfactor/

Page 26: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

http://codeartisan.blogspot.com/2012/07/using-html-as-media-type-for-your-api.html

Rich semantics

<ul> => bag

<ol> => list

<dl> => mapJon Moore

Page 27: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

http://codeartisan.blogspot.com/2012/07/using-html-as-media-type-for-your-api.html

Extend using micro format style

Jon Moore

Page 28: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

<div id="bugs"> <ul class="all"> <li><span class="title">JFokus bug</span><span class="description">The description of the bug</span>

<form class="move working next" action="/bugs/working" method="POST" title="Move to Working">

<input name="id" type="hidden" value="..."> <input name="submit" type="submit" value="Move to Working">

</form></li>

</ul></div>

Page 29: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

http://codeartisan.blogspot.com/2012/07/using-html-as-media-type-for-your-api.html

Already standardized, everybody knows it

Jon Moore

Page 30: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

http://codeartisan.blogspot.com/2012/07/using-html-as-media-type-for-your-api.html

Good tooling support

Jon Moore

Page 31: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

“Optimize where it matters”

Page 32: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

Primary use-cases => Native

Secondary use-cases => Render HTML response

Page 33: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

• Hypermedia Controls (read/write)?

• Rich semantics?

• Extendable?

• Standardized?

• Everybody knows it?

• Good tooling support (server/clients)?

Page 34: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

”Building Hypermedia APIs

with HTML5 and Node”, Mike Amundsen

http://www.amazon.com/Building-Hypermedia-APIs-HTML5-Node/dp/1449306578

Page 35: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

How to scale development of apps? => HTML Hypermedia APIs

How to make our web work on every browser? => AWD

HTML Hypermedia APIs + AWD => Perfect combo!

Page 36: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

”Mobile first”

Simple HTML

~3kB CSS

Avoid JavaScript!

Page 37: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

RestBugs: Mobile web

Page 38: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

How to make a “desktop web app” with better UX?

Page 39: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

“An escalator can never break: it can only become stairs.”

– Mitch Hedberg

Page 40: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

Aaron Gustafsonhttp://easy-readers.net/books/adaptive-web-design

Page 41: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

Performance

Conditionally loaded content

Delayed content loading

Bundling AJAX requests

Responsive Web Design

Feature detectionHTML5 Navigation Timing

Unobtrusive JavaScript

Hijax

http://bradfrostweb.com/blog/mobile/beyond-media-queries-anatomy-of-an-adaptive-web-design

Page 42: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

“Progressive Enhancement 2.0”, Nicolas Zakas

“Resource-Oriented Client Architecture”

http://www.webmonkey.com/2012/03/video-progressive-enhancement-2-0

http://roca-style.org

Page 43: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

HTML Hypermedia APIs

Mobile first

“Minimalistic HTML”

Page 44: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013
Page 45: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013
Page 46: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

Native apps (80/20)

Enhanced web (80/20)

Web browsers

No application logic Application logic

HTML Hypermedia API+

AWD

Page 47: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013
Page 48: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

www.example.com

api.example.com

Page 49: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

RestBugs: HTML Hypermedia API + AWD

Page 50: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

(Inline javascript code in responses)

use harvey.js // polyfill for media queries

configuration "large screen":

on:

$.getScript("/js/client.min.js");

$.get("/css/client.min.css", function(css) {…});

off:

location.reload()

Page 51: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

(client.min.js)

links = $("#links a[rel!=index]");

addForm = $("form.new");

load template containing angular.js markup

clear <body>

bootstrap angular

foreach link in links:

htmlResponse = GET link

parse htmlResponse

populate view model

Enable hijax for add and move forms

Page 52: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

(app.js)

renderWeb = function(){

return host.contains(“:9200”)

};

if (renderWeb):

redirect to index page

else:

return 201 Created;

Page 53: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

(app.js)

renderWeb = function(){

return host.contains(":9200")

};

(server template)

<% if(renderWeb) { %>

<script>…</script>

<link href="/css/mobile.css" … />

<% } %>

Page 54: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013
Page 55: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

• Connected physical devices

• Types of devices

• Platforms

• Device models

Page 56: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

• How to scale development of apps? => HTML Hypermedia APIs

• How to make our web work on every browser? => AWD

HTML Hypermedia APIs + AWD => Perfect combo!

Page 57: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

Native apps (80/20)

Enhanced web (80/20)

Web browsers

No application logic Application logic

HTML Hypermedia API+

AWD

Page 58: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013
Page 59: Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013

@gustaf_nk

https://github.com/gustafnk/RestBugs