html hypermedia apis and adaptive web design - reject.js

28
HTML HYPERMEDIA APIS AND ADAPTIVE WEB DESIGN Gustaf Nilsson Kotte / @gustaf_nk

Upload: gustaf-nilsson-kotte

Post on 10-May-2015

26.381 views

Category:

Technology


2 download

DESCRIPTION

NB! Download the pdf and open it in Chrome to see the slides without the "grid background".

TRANSCRIPT

Page 1: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

HTML HYPERMEDIA APIS AND

ADAPTIVE WEB DESIGNGustaf Nilsson Kotte / @gustaf_nk

Page 2: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

ABOUT ME

Page 3: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

TWO AREAS OF INTEREST

Hypermedia APIs - No application logic in API clientsAdaptive Web Design - Multi-device web

Working nicely together!

Page 4: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

DEMO, KANBAN BOARDHTML Hypermedia API + Adaptive Web Design

Page 5: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

PREFER FAT APIS OVER FAT CLIENTS

Page 6: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

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

Page 7: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

HYPERMEDIA APIS

Page 8: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

WHAT IS THE HYPERMEDIA CONSTRAINT?

— Jon Moore

You do stuff by reading pages and then either

follow links or submit forms.

Page 9: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

USE HTML FOR HYPERMEDIA APIS

Lots of hypermedia controlsOld, standardized, everybody knows HTMLGood tooling support

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

http://amundsen.com/hypermedia/html/

Page 10: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

MORE...

Great for learning about hypermedia!

Page 11: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

INTERLUDE

JSON is ok :)

Also, hypermedia is a bit harder to consume in general

Page 12: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

EXAMPLE: MICROFORMATS2, ENTITIES<li class="h-item"> <div class="p-name"><%= item.name %></div> <div class="p-status"><%= item.status %></div> <div class="p-description"><%= item.description %></div> <div class="p-forms"> ... </div> <div class="p-links"> ... </div></li>

Page 13: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

EXAMPLE: MICROFORMATS2, FORMS<div class="p-forms"> <form data-rel="move backlog" action="/items/backlog" method="POST"> <input name="id" type="hidden" value="4"> <input title="submit" type="submit" value="Move to backlog"> </form> <form data-rel="move verify next" action="/items/verify" method="POST"> <input name="id" type="hidden" value="4"> <input title="submit" type="submit" value="Move to verify"> </form></div>

Page 14: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

Minimal HTML

IDEA: A COMMON GOAL

HTML Hypermedia APIs ∩ Mobile first

=(also, reduce number of roundtrips)

Page 15: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

http://filamentgroup.com/lab/ajax_includes_modular_content/

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

Page 16: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

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

Page 17: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

ADAPTIVE WEB DESIGNResponsive web design

Feature detectionDevice APIs

PerformanceConditional loading

Content strategyTouch

Platform optimizationErgonomics

...

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

Page 18: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

PROGRESSIVE ENHANCEMENT

Page 19: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

THE API AND THE WEB CAN BE THE SAME THING!

HTML Hypermedia APIs ❤ Mobile First

Mobile First ❤ all web browsers and devices

Page 20: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

THE API AND THE WEB CAN BE THE SAME THING!

HTML Hypermedia APIs +

Adaptive Web Design

Page 21: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

HTML HYPERMEDIA APIS + AWD

Page 22: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

HIGH LEVEL VIEWSame code for web and API

(yes, share templates too)

Separate URLs

Optimize response size and #roundtrips

Microformats2 as semantic layer or RDFa [Lite]

Agressive enhancement

Other AWD techniques :)

Optimize API perspective

Page 23: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

DEMO: CHANGING THE APPLICATION

Page 24: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

SUMMARY

Page 25: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

HTML Hypermedia APIs ❤ Mobile First

Mobile First ❤ all web browsers and devices

Page 26: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

FURTHER EXPLORATION, BOOKS, Mike Amundsen Building Hypermedia APIs

with HTML5 and Node

, Steve Klabnik Designing Hypermedia APIs

, Aaron Gustafson Adaptive Web Design

Page 27: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

FURTHER EXPLORATION, ONLINE, Brad Frost Beyond Media Queries:

Anatomy of an Adaptive Web Design

, Nicolas Zakas Progressive Enhancement 2.0

(et al), Stefan Tilkov Resource-oriented Client Architecture

Page 28: HTML Hypermedia APIs and Adaptive Web Design -  reject.js

THANK YOU!Gustaf Nilsson Kotte / @gustaf_nk

Code: https://github.com/gustafnk/kanban-awd-api

Demo: and http://kanban-awd.herokuapp.com/ http://kanban-api.herokuapp.com

Slides: https://github.com/gustafnk/HTML-Hypermedia-APIs-and-Adaptive-Web-Design