SlideShare ist ein Scribd-Unternehmen logo
1 von 56
The FT eb pp:
Coding responsively
Dr Robert Shilston (rob@labs.ft.com)
Director, FT Labs (@ftlabs)
InfoQ.com: News & Community Site
• 750,000 unique visitors/month
• Published in 4 languages (English, Chinese, Japanese and Brazilian
Portuguese)
• Post content from our QCon conferences
• News 15-20 / week
• Articles 3-4 / week
• Presentations (videos) 12-15 / week
• Interviews 2-3 / week
• Books 1 / month
Watch the video with slide
synchronization on InfoQ.com!
http://www.infoq.com/presentations
/FT-html5
Presented at QCon London
www.qconlondon.com
Purpose of QCon
- to empower software development by facilitating the spread of
knowledge and innovation
Strategy
- practitioner-driven conference designed for YOU: influencers of
change and innovation in your teams
- speakers and topics driving the evolution and innovation
- connecting and catalyzing the influencers and innovators
Highlights
- attended by more than 12,000 delegates since 2007
- held in 9 cities worldwide
Historical comparison
1880 1900 1920 1940 1960 1980 2000 2020
orks offline
Portable
Long battery life
Can be read in bright sunlight
Cheap
Ubiquity
Bookmarking
Sharing
Nesprint
Fast start up
Clipping/saving
Can be read in the dark
Updates in real time
Electronic delivery
Search
Personalisation
Deep linking
orks offline
Portable
Long battery life
Can be read in bright sunlight
Cheap
Ubiquity
Bookmarking
Sharing
‘Traditional’ eb
Fast start up
Clipping/saving
Can be read in the dark
Updates in real time
Electronic delivery
Search
Personalisation
Deep linking
orks offline
Portable
Long battery life
Can be read in bright sunlight
Cheap
Ubiquity
Bookmarking
Sharing
pps
Fast start up
Clipping/saving
Can be read in the dark
Updates in real time
Electronic delivery
Search
Personalisation
Deep linking
HTML5 is not a ‘mobile thing’.
It’s not an alternative to native
apps.
It’s a ay of making better
ebsites.
elcome back to the eb
The FT eb app provides a touch optimised user
experience ithout native code.
Sometimes it’s
hat e’ve done
But e’ve learned a lot, so to be honest sometimes it’s
hat e ould do if e did it
again.
genda
•  Coding responsively
– Layout and interactions
– Connection state
– OS
•  Development process
– Branching and feature flags
– Testing and deployment
hat is an app?
But first, let’s consider:
hat is an ‘app’?
•  Built for a single platform
•  In an app store
•  ritten in native code
•  Built for mobile
•  Designed for touch interactions
NO THNKS
hat an ‘app’ is to us:
app (n). a distributed computer softare
application designed for optimal use on specific
screen sizes and ith particular interface
technologies,
hy code responsively?
So let’s start:
Ne devices
+
Desktop
Click
Point
Ho an app might run
Laptop
Type
Move
Tablet
Touch
Phone
Speak
In car screen
Listen
eroplane
TV
KioskGlasses
Games
console
See
Think?
atchBillboard
Layout and interactions
•  Screen size
– Not the same as resolution
•  Instant touch feedback
•  Click and mouse hover effects
•  Keyboard shortcuts
•  Reading experience
– Easier to read narro columns
– Paragraph leading and guttering
Fastclick
•  Speed up touch interactions
•  Eliminates 300ms lag
<script src='fastclick.js'></script>
window.addEventListener('load', function() {
new FastClick(document.body);
}, false);
Scroller
Floed columns
Floed columns
Refloing
Resizing
Connection state
Or hy online and offline events should
not be trusted to anser the question ‘are
e online?’
navigator.onLine
re you online if?
– You’ve got ifi signal?
– You’ve got 3G signal?
– If DNS resolves?
If Titter loads?
– ill my site?
– ill Facebook?
Q: If the value of navigator.onLine is true,
hat does that mean?
: The device might be online.
For hen there’s no connection
•  ppCache
–  Essential for offline functionality
–  Just use it to bootstrap your app.
•  LocalStorage
–  Great for code and templates
•  Cookies
–  Shared ith the server
–  Included in every request
•  ebSQL / IndexedDB
–  Great for content
Splash	
  screen	
  
Basic	
  CSS	
  /	
  Fonts	
  
Bootstrap	
  &	
  error	
  handling	
  
Main	
  app	
  code	
  
Main	
  CSS	
  &	
  HTML	
  templates	
  
Authen=ca=on	
  
Text	
  and	
  image	
  content	
  
HTML5	
  AppCache	
  for	
  
ini=al	
  page	
  load	
  
	
  
Beware.	
  	
  AppCache	
  needs	
  
careful	
  handling.	
  
LocalStorage	
  for	
  code	
  	
  
and	
  templates	
  
Cookies	
  for	
  data	
  shared	
  
with	
  the	
  server	
  
WebSQL	
  /	
  IndexedDB	
  for	
  
news	
  content	
  
Squeezing your bits
•  Devices tend to limit HTML5 storage
•  Storing images offline:
Base64 encoded data-URIs
+ UTF-16 storage encoding
= Inefficient
n image storage solution
1.  Donload images as gzipped base64
2.  Squeeze 2⅔ base64 characters into one
UTF-16 character
3.  Push that into the database
4.  Reverse hen rendering the page
•  Go to http://labs.ft.com/ to read more.
Tips for coping ith the netork
•  Batching your requests
•  Prioritise requests
– User requested content first
– nalytics last
•  Progress bars
– Sho feedback fast
– Be pessimistic
One HTTP request!
•  ggressive batching - collect requests
asynchronously:
•  Callbacks per action and per group
api.add('getStory', {'path': '/1'}, callback1);
api.add('getStory', {'path': '/2'}, callback2);
api.send(callback3);
api.add('analytics', params, callback4);
api.send(callback5);
Going native
cclimatised users
•  ndroid
– Back and Search buttons
– Sharing: Intent.ACTION_SEND
– idgets
– Background content donloading
•  indos 8
– Sharing and Search charms
– Home screen tile
– Nav bar
Search on ndroid
Search on indos 8
Search on iPad
Search on iPhone
Native rappers
•  Invoke same core online eb site
•  rapper to eb communication
– via HTML5 postMessage
– JavaScript function calls
Managing the release process
But ith multiple devices, surely
is hard?
The Old Days: Branches
Test	
  
Dev	
  
Trunk	
  
Feature	
  “Apple”	
  
Feature	
  “Banana”	
  
Release	
  
to	
  live	
  
Merge	
  
Merge	
  
The alternative: Feature flags
•  Develop in one place
•  Sitch bits of code on and off
•  Centralise those sitches
•  Don’t associate multiple things to the same flag
function get(flagname) {
switch flagname:
case 'WidgetEnabled':
return isAndroid
...
if (Flags.get('WidgetEnabled’)) { ... }
Feature flags: Override for testing
Screenshot of flag tool
Feature flags: Override for testing
•  Code example:
function get(flagname) {
flagoverrides = JSON.parse(localstorage.getItem('flags'));
if (flagname in flagoverrides) {
return flagoverrides[flagname];
}
switch flagname:
case 'AppleEnabled':
return isAndroid
...
Feature flags 2.0
•  Server-side decisions control client side
behaviour
– Enable /B feature release
– Deploy features to different platforms
– Push flags to client
•  Share flags client and server side
– Get feedback on /B testing
•  Remember analytics!
Client-side code updates
•  The bootstrap code:
– Runs hat’s in localStorage
– sks the server if there’s a ne version
•  llo beta users to get version first
– Donloads it for use next time
•  Minimises ppCache aggravation
•  Gives us complete control
Final points
HTML5 sites can be great
But building a good HTML5
site is very hard.
Summary
•  Less separation, more adaptation
– Feer, more adaptive ebsites
•  Less native, more eb
•  HTML5 is NOT just a mobile solution, but a
ay of making better ebsites.
•  Responsiveness is not about multiple static
designs, it's a multi-variable equation
Summary
•  appCache + localStorage + intelligent
bootstrapping + good use of storage
= reliable offline app
•  You don’t have to sacrifice features
•  ith good optimisations you can get a great
app experience
e're trying to help
•  Your dev team can use our code
– github.com/ftlabs
•  e blog about techniques at labs.ft.com
•  Consultancy available
•  Talks at conferences like this one
“Don’t build native apps,
build eb apps”
-­‐	
  Tim	
  Berners-­‐Lee	
  
Thanks
rob@labs.ft.com
@FTLabs
Do you ant to build this stuff? Join in.
jobs@labs.ft.com
Image	
  credits::	
  	
  
hOp://cdn3.worldcarfans.co/2008/2/medium/9080214.017.Mini1L.jpg,	
  	
  hOp://www.netbasic.com/blog/2008/10/mini-­‐car-­‐parking-­‐fail,	
  hOp://runningstopsigns.files.wordpress.com/
2011/04/smart-­‐car.jpg	
  
	
  

Weitere ähnliche Inhalte

Andere mochten auch (8)

Esquema de la comunicacion luis
Esquema de la comunicacion luisEsquema de la comunicacion luis
Esquema de la comunicacion luis
 
Esquema aprendizajes esperados
Esquema aprendizajes esperados Esquema aprendizajes esperados
Esquema aprendizajes esperados
 
κινα
κινακινα
κινα
 
Apunte de Ortografía repaso
Apunte de Ortografía repasoApunte de Ortografía repaso
Apunte de Ortografía repaso
 
aparato respiratorio
aparato respiratorioaparato respiratorio
aparato respiratorio
 
aparato urinario
aparato urinarioaparato urinario
aparato urinario
 
Boheme - media.innovations
Boheme - media.innovationsBoheme - media.innovations
Boheme - media.innovations
 
Vortrag: Täglich frisch 15.11.11
Vortrag: Täglich frisch 15.11.11Vortrag: Täglich frisch 15.11.11
Vortrag: Täglich frisch 15.11.11
 

Mehr von C4Media

Streaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live VideoStreaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live VideoC4Media
 
Next Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy MobileNext Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy MobileC4Media
 
Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020C4Media
 
Understand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsUnderstand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsC4Media
 
Kafka Needs No Keeper
Kafka Needs No KeeperKafka Needs No Keeper
Kafka Needs No KeeperC4Media
 
High Performing Teams Act Like Owners
High Performing Teams Act Like OwnersHigh Performing Teams Act Like Owners
High Performing Teams Act Like OwnersC4Media
 
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to JavaDoes Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to JavaC4Media
 
Service Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideService Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideC4Media
 
Shifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDShifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDC4Media
 
CI/CD for Machine Learning
CI/CD for Machine LearningCI/CD for Machine Learning
CI/CD for Machine LearningC4Media
 
Fault Tolerance at Speed
Fault Tolerance at SpeedFault Tolerance at Speed
Fault Tolerance at SpeedC4Media
 
Architectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsArchitectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsC4Media
 
ML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsC4Media
 
Build Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerBuild Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerC4Media
 
User & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleUser & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleC4Media
 
Scaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeScaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeC4Media
 
Make Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereMake Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereC4Media
 
The Talk You've Been Await-ing For
The Talk You've Been Await-ing ForThe Talk You've Been Await-ing For
The Talk You've Been Await-ing ForC4Media
 
Future of Data Engineering
Future of Data EngineeringFuture of Data Engineering
Future of Data EngineeringC4Media
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreC4Media
 

Mehr von C4Media (20)

Streaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live VideoStreaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live Video
 
Next Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy MobileNext Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy Mobile
 
Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020
 
Understand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsUnderstand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java Applications
 
Kafka Needs No Keeper
Kafka Needs No KeeperKafka Needs No Keeper
Kafka Needs No Keeper
 
High Performing Teams Act Like Owners
High Performing Teams Act Like OwnersHigh Performing Teams Act Like Owners
High Performing Teams Act Like Owners
 
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to JavaDoes Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
 
Service Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideService Meshes- The Ultimate Guide
Service Meshes- The Ultimate Guide
 
Shifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDShifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CD
 
CI/CD for Machine Learning
CI/CD for Machine LearningCI/CD for Machine Learning
CI/CD for Machine Learning
 
Fault Tolerance at Speed
Fault Tolerance at SpeedFault Tolerance at Speed
Fault Tolerance at Speed
 
Architectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsArchitectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep Systems
 
ML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.js
 
Build Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerBuild Your Own WebAssembly Compiler
Build Your Own WebAssembly Compiler
 
User & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleUser & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix Scale
 
Scaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeScaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's Edge
 
Make Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereMake Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home Everywhere
 
The Talk You've Been Await-ing For
The Talk You've Been Await-ing ForThe Talk You've Been Await-ing For
The Talk You've Been Await-ing For
 
Future of Data Engineering
Future of Data EngineeringFuture of Data Engineering
Future of Data Engineering
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
 

Kürzlich hochgeladen

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Kürzlich hochgeladen (20)

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

Developing the FT Web App

  • 1. The FT eb pp: Coding responsively Dr Robert Shilston (rob@labs.ft.com) Director, FT Labs (@ftlabs)
  • 2. InfoQ.com: News & Community Site • 750,000 unique visitors/month • Published in 4 languages (English, Chinese, Japanese and Brazilian Portuguese) • Post content from our QCon conferences • News 15-20 / week • Articles 3-4 / week • Presentations (videos) 12-15 / week • Interviews 2-3 / week • Books 1 / month Watch the video with slide synchronization on InfoQ.com! http://www.infoq.com/presentations /FT-html5
  • 3. Presented at QCon London www.qconlondon.com Purpose of QCon - to empower software development by facilitating the spread of knowledge and innovation Strategy - practitioner-driven conference designed for YOU: influencers of change and innovation in your teams - speakers and topics driving the evolution and innovation - connecting and catalyzing the influencers and innovators Highlights - attended by more than 12,000 delegates since 2007 - held in 9 cities worldwide
  • 4. Historical comparison 1880 1900 1920 1940 1960 1980 2000 2020
  • 5.
  • 6. orks offline Portable Long battery life Can be read in bright sunlight Cheap Ubiquity Bookmarking Sharing Nesprint Fast start up Clipping/saving Can be read in the dark Updates in real time Electronic delivery Search Personalisation Deep linking
  • 7. orks offline Portable Long battery life Can be read in bright sunlight Cheap Ubiquity Bookmarking Sharing ‘Traditional’ eb Fast start up Clipping/saving Can be read in the dark Updates in real time Electronic delivery Search Personalisation Deep linking
  • 8. orks offline Portable Long battery life Can be read in bright sunlight Cheap Ubiquity Bookmarking Sharing pps Fast start up Clipping/saving Can be read in the dark Updates in real time Electronic delivery Search Personalisation Deep linking
  • 9. HTML5 is not a ‘mobile thing’. It’s not an alternative to native apps. It’s a ay of making better ebsites.
  • 10. elcome back to the eb The FT eb app provides a touch optimised user experience ithout native code.
  • 11. Sometimes it’s hat e’ve done But e’ve learned a lot, so to be honest sometimes it’s hat e ould do if e did it again.
  • 12. genda •  Coding responsively – Layout and interactions – Connection state – OS •  Development process – Branching and feature flags – Testing and deployment
  • 13. hat is an app? But first, let’s consider:
  • 14. hat is an ‘app’? •  Built for a single platform •  In an app store •  ritten in native code •  Built for mobile •  Designed for touch interactions NO THNKS
  • 15. hat an ‘app’ is to us: app (n). a distributed computer softare application designed for optimal use on specific screen sizes and ith particular interface technologies,
  • 16. hy code responsively? So let’s start:
  • 18. + Desktop Click Point Ho an app might run Laptop Type Move Tablet Touch Phone Speak In car screen Listen eroplane TV KioskGlasses Games console See Think? atchBillboard
  • 19. Layout and interactions •  Screen size – Not the same as resolution •  Instant touch feedback •  Click and mouse hover effects •  Keyboard shortcuts •  Reading experience – Easier to read narro columns – Paragraph leading and guttering
  • 20. Fastclick •  Speed up touch interactions •  Eliminates 300ms lag <script src='fastclick.js'></script> window.addEventListener('load', function() { new FastClick(document.body); }, false);
  • 26. Connection state Or hy online and offline events should not be trusted to anser the question ‘are e online?’
  • 27. navigator.onLine re you online if? – You’ve got ifi signal? – You’ve got 3G signal? – If DNS resolves? If Titter loads? – ill my site? – ill Facebook?
  • 28. Q: If the value of navigator.onLine is true, hat does that mean? : The device might be online.
  • 29. For hen there’s no connection •  ppCache –  Essential for offline functionality –  Just use it to bootstrap your app. •  LocalStorage –  Great for code and templates •  Cookies –  Shared ith the server –  Included in every request •  ebSQL / IndexedDB –  Great for content
  • 30. Splash  screen   Basic  CSS  /  Fonts   Bootstrap  &  error  handling   Main  app  code   Main  CSS  &  HTML  templates   Authen=ca=on   Text  and  image  content   HTML5  AppCache  for   ini=al  page  load     Beware.    AppCache  needs   careful  handling.   LocalStorage  for  code     and  templates   Cookies  for  data  shared   with  the  server   WebSQL  /  IndexedDB  for   news  content  
  • 31. Squeezing your bits •  Devices tend to limit HTML5 storage •  Storing images offline: Base64 encoded data-URIs + UTF-16 storage encoding = Inefficient
  • 32.
  • 33. n image storage solution 1.  Donload images as gzipped base64 2.  Squeeze 2⅔ base64 characters into one UTF-16 character 3.  Push that into the database 4.  Reverse hen rendering the page •  Go to http://labs.ft.com/ to read more.
  • 34. Tips for coping ith the netork •  Batching your requests •  Prioritise requests – User requested content first – nalytics last •  Progress bars – Sho feedback fast – Be pessimistic
  • 35. One HTTP request! •  ggressive batching - collect requests asynchronously: •  Callbacks per action and per group api.add('getStory', {'path': '/1'}, callback1); api.add('getStory', {'path': '/2'}, callback2); api.send(callback3); api.add('analytics', params, callback4); api.send(callback5);
  • 37. cclimatised users •  ndroid – Back and Search buttons – Sharing: Intent.ACTION_SEND – idgets – Background content donloading •  indos 8 – Sharing and Search charms – Home screen tile – Nav bar
  • 42. Native rappers •  Invoke same core online eb site •  rapper to eb communication – via HTML5 postMessage – JavaScript function calls
  • 43. Managing the release process But ith multiple devices, surely is hard?
  • 44. The Old Days: Branches Test   Dev   Trunk   Feature  “Apple”   Feature  “Banana”   Release   to  live   Merge   Merge  
  • 45. The alternative: Feature flags •  Develop in one place •  Sitch bits of code on and off •  Centralise those sitches •  Don’t associate multiple things to the same flag function get(flagname) { switch flagname: case 'WidgetEnabled': return isAndroid ... if (Flags.get('WidgetEnabled’)) { ... }
  • 46. Feature flags: Override for testing Screenshot of flag tool
  • 47. Feature flags: Override for testing •  Code example: function get(flagname) { flagoverrides = JSON.parse(localstorage.getItem('flags')); if (flagname in flagoverrides) { return flagoverrides[flagname]; } switch flagname: case 'AppleEnabled': return isAndroid ...
  • 48. Feature flags 2.0 •  Server-side decisions control client side behaviour – Enable /B feature release – Deploy features to different platforms – Push flags to client •  Share flags client and server side – Get feedback on /B testing •  Remember analytics!
  • 49. Client-side code updates •  The bootstrap code: – Runs hat’s in localStorage – sks the server if there’s a ne version •  llo beta users to get version first – Donloads it for use next time •  Minimises ppCache aggravation •  Gives us complete control
  • 51. HTML5 sites can be great But building a good HTML5 site is very hard.
  • 52. Summary •  Less separation, more adaptation – Feer, more adaptive ebsites •  Less native, more eb •  HTML5 is NOT just a mobile solution, but a ay of making better ebsites. •  Responsiveness is not about multiple static designs, it's a multi-variable equation
  • 53. Summary •  appCache + localStorage + intelligent bootstrapping + good use of storage = reliable offline app •  You don’t have to sacrifice features •  ith good optimisations you can get a great app experience
  • 54. e're trying to help •  Your dev team can use our code – github.com/ftlabs •  e blog about techniques at labs.ft.com •  Consultancy available •  Talks at conferences like this one
  • 55. “Don’t build native apps, build eb apps” -­‐  Tim  Berners-­‐Lee  
  • 56. Thanks rob@labs.ft.com @FTLabs Do you ant to build this stuff? Join in. jobs@labs.ft.com Image  credits::     hOp://cdn3.worldcarfans.co/2008/2/medium/9080214.017.Mini1L.jpg,    hOp://www.netbasic.com/blog/2008/10/mini-­‐car-­‐parking-­‐fail,  hOp://runningstopsigns.files.wordpress.com/ 2011/04/smart-­‐car.jpg