SlideShare una empresa de Scribd logo
1 de 54
The FT eb pp:
Coding responsively




Dr Robert Shilston (rob@labs.ft.com)
Director, FT Labs (@ftlabs)
Watch the video with slide
                         synchronization on InfoQ.com!
                      http://www.infoq.com/presentations
                             /FT-Coding-Responsively

       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
Presented at QCon San Francisco
                          www.qconsf.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
Nesprint
orks offline                      Fast start up
Portable                         Clipping/saving
Long battery life                Can be read in the dark
Can be read in bright sunlight   Updates in real time
Cheap                            Electronic delivery
Ubiquity                         Search
Bookmarking                      Personalisation
Sharing                          Deep linking
‘Traditional’ eb
orks offline                      Fast start up
Portable                         Clipping/saving
Long battery life                Can be read in the dark
Can be read in bright sunlight   Updates in real time
Cheap                            Electronic delivery
Ubiquity                         Search
Bookmarking                      Personalisation
Sharing                          Deep linking
pps
orks offline                      Fast start up
Portable                         Clipping/saving
Long battery life                Can be read in the dark
Can be read in bright sunlight   Updates in real time
Cheap                            Electronic delivery
Ubiquity                         Search
Bookmarking                      Personalisation
Sharing                          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
But first, let’s consider:

hat is an app?
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,
So let’s start:

hy code responsively?
Ho an app might run

   Desktop        Laptop         Click   Type


    Tablet        Phone          Move    Touch


 In car screen   eroplane       Speak   Listen

                  Games
                             +
      TV                         Point   Think?
                  console

    Kiosk        Billboard        ???
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
Floed columns
Floed columns
Scroller
Fastclick
•  Speed up touch interactions
•  Eliminates 300ms lag
<script src='fastclick.js'></script>


window.addEventListener('load', function() {
    new FastClick(document.body);
}, false);
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
HTML5	
  AppCache	
  for	
  
                                                ini=al	
  page	
  load	
  
          Splash	
  screen	
                                 	
  
                                            Beware.	
  	
  AppCache	
  needs	
  
                                                careful	
  handling.	
  
        Basic	
  CSS	
  /	
  Fonts	
  


 Bootstrap	
  &	
  error	
  handling	
  
                                              LocalStorage	
  for	
  code	
  	
  
         Main	
  app	
  code	
                   and	
  templates	
  


Main	
  CSS	
  &	
  HTML	
  templates	
  
                                             Cookies	
  for	
  data	
  shared	
  
                                                with	
  the	
  server	
  
         Authen=ca=on	
  


   Text	
  and	
  image	
  content	
  
                                            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:
api.add('getStory', {'path': '/1'}, callback1);
api.add('getStory', {'path': '/2'}, callback2);
api.send(callback3);
api.add('analytics', params, callback4);
api.send(callback5);

•  Callbacks per action and per group
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
But ith multiple devices, surely

Managing the release process
                                    is hard?
The Old Days: Branches
                                                   Feature	
  “Banana”	
  

                                                                             Dev	
  

  Feature	
  “Apple”	
                       Merge	
  

                                                                             Test	
  

          Merge	
  


                                                                             Trunk	
  


                           Release	
  
                            to	
  live	
  
The alternative: Feature flags
•  Develop in one place
•  Sitch bits of code on and off
if (Flags.get('WidgetEnabled’)) { ... }

•  Centralise those sitches
function get(flagname) {
  switch flagname:
    case 'WidgetEnabled':
      return isAndroid
      ...

•  Don’t associate multiple things to the same flag
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.
“The biggest mistake e made as a
company as betting too much on
HTML5 as opposed to native,”

“It just asn’t ready”
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
•  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	
  
	
  

Más contenido relacionado

Destacado

Roles and Responsibilities
Roles and Responsibilities Roles and Responsibilities
Roles and Responsibilities
Tarun Kalra
 
Six Sigma Certification
Six Sigma CertificationSix Sigma Certification
Six Sigma Certification
Rehan Ahmed
 

Destacado (10)

Gametogenesis
GametogenesisGametogenesis
Gametogenesis
 
Keilani Resume 2016
Keilani Resume 2016Keilani Resume 2016
Keilani Resume 2016
 
Roles and Responsibilities
Roles and Responsibilities Roles and Responsibilities
Roles and Responsibilities
 
Six Sigma Certification
Six Sigma CertificationSix Sigma Certification
Six Sigma Certification
 
FSF Philosophy
FSF PhilosophyFSF Philosophy
FSF Philosophy
 
DSD-INT 2015 - Heatstress urban area - Kluck
DSD-INT 2015 - Heatstress urban area - KluckDSD-INT 2015 - Heatstress urban area - Kluck
DSD-INT 2015 - Heatstress urban area - Kluck
 
Perang banjar new
Perang banjar   newPerang banjar   new
Perang banjar new
 
Goal
GoalGoal
Goal
 
Vegetarian pizza recipe italian food recipe
Vegetarian pizza recipe   italian food recipeVegetarian pizza recipe   italian food recipe
Vegetarian pizza recipe italian food recipe
 
Nghiên cứu hành vi tiêu dùng giày da công sở tại thị trường Hà Nội
Nghiên cứu hành vi tiêu dùng giày da công sở tại thị trường Hà NộiNghiên cứu hành vi tiêu dùng giày da công sở tại thị trường Hà Nội
Nghiên cứu hành vi tiêu dùng giày da công sở tại thị trường Hà Nội
 

Similar a The FT Web App: Coding Responsively

Cm i padwebdev_lunch_learn
Cm i padwebdev_lunch_learnCm i padwebdev_lunch_learn
Cm i padwebdev_lunch_learn
Critical Mass
 
Flu3nt highlights
Flu3nt highlightsFlu3nt highlights
Flu3nt highlights
dswork
 
Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011
Nuxeo
 
Stream SQL eventflow visual programming for real programmers presentation
Stream SQL eventflow visual programming for real programmers presentationStream SQL eventflow visual programming for real programmers presentation
Stream SQL eventflow visual programming for real programmers presentation
streambase
 

Similar a The FT Web App: Coding Responsively (20)

Advanced iOS Engineering - The Junction Talk
Advanced iOS Engineering - The Junction TalkAdvanced iOS Engineering - The Junction Talk
Advanced iOS Engineering - The Junction Talk
 
Cm i padwebdev_lunch_learn
Cm i padwebdev_lunch_learnCm i padwebdev_lunch_learn
Cm i padwebdev_lunch_learn
 
Life Beyond Rails: Creating Cross Platform Ruby Apps
Life Beyond Rails: Creating Cross Platform Ruby AppsLife Beyond Rails: Creating Cross Platform Ruby Apps
Life Beyond Rails: Creating Cross Platform Ruby Apps
 
One App, Multiple Platforms
One App, Multiple PlatformsOne App, Multiple Platforms
One App, Multiple Platforms
 
Flu3nt highlights
Flu3nt highlightsFlu3nt highlights
Flu3nt highlights
 
Mobile gotcha
Mobile gotchaMobile gotcha
Mobile gotcha
 
How to be Successful with Responsive Sites (Koombea & NGINX) - English
How to be Successful with Responsive Sites (Koombea & NGINX) - EnglishHow to be Successful with Responsive Sites (Koombea & NGINX) - English
How to be Successful with Responsive Sites (Koombea & NGINX) - English
 
Service worker API
Service worker APIService worker API
Service worker API
 
Ember Conf 2016: Building Mobile Apps with Ember
Ember Conf 2016: Building Mobile Apps with EmberEmber Conf 2016: Building Mobile Apps with Ember
Ember Conf 2016: Building Mobile Apps with Ember
 
Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011
 
Stream SQL eventflow visual programming for real programmers presentation
Stream SQL eventflow visual programming for real programmers presentationStream SQL eventflow visual programming for real programmers presentation
Stream SQL eventflow visual programming for real programmers presentation
 
Leaving the Ivory Tower: Research in the Real World
Leaving the Ivory Tower: Research in the Real WorldLeaving the Ivory Tower: Research in the Real World
Leaving the Ivory Tower: Research in the Real World
 
PykQuery.js
PykQuery.jsPykQuery.js
PykQuery.js
 
Practical workflows for responsive design
Practical workflows for responsive designPractical workflows for responsive design
Practical workflows for responsive design
 
Dreamweaver CS6, jQuery, PhoneGap, mobile design
Dreamweaver CS6, jQuery, PhoneGap, mobile designDreamweaver CS6, jQuery, PhoneGap, mobile design
Dreamweaver CS6, jQuery, PhoneGap, mobile design
 
MTC Spring 2013 - crossplatform woes - robert virkus - 2013-03-13
MTC Spring 2013 -  crossplatform woes - robert virkus - 2013-03-13MTC Spring 2013 -  crossplatform woes - robert virkus - 2013-03-13
MTC Spring 2013 - crossplatform woes - robert virkus - 2013-03-13
 
Offline of web applications
Offline of web applicationsOffline of web applications
Offline of web applications
 
Offline for web - Frontend Dev Conf Minsk 2014
Offline for web - Frontend Dev Conf Minsk 2014Offline for web - Frontend Dev Conf Minsk 2014
Offline for web - Frontend Dev Conf Minsk 2014
 
Prototyping for mobile
Prototyping for mobilePrototyping for mobile
Prototyping for mobile
 
Simplicity - develop modern web apps with tiny frameworks and tools
Simplicity - develop modern web apps with tiny frameworks and toolsSimplicity - develop modern web apps with tiny frameworks and tools
Simplicity - develop modern web apps with tiny frameworks and tools
 

Más de C4Media

Más de 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
 

Último

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Último (20)

Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 

The FT Web App: Coding Responsively

  • 1. The FT eb pp: Coding responsively Dr Robert Shilston (rob@labs.ft.com) Director, FT Labs (@ftlabs)
  • 2. Watch the video with slide synchronization on InfoQ.com! http://www.infoq.com/presentations /FT-Coding-Responsively 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
  • 3. Presented at QCon San Francisco www.qconsf.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. Nesprint orks offline Fast start up Portable Clipping/saving Long battery life Can be read in the dark Can be read in bright sunlight Updates in real time Cheap Electronic delivery Ubiquity Search Bookmarking Personalisation Sharing Deep linking
  • 7. ‘Traditional’ eb orks offline Fast start up Portable Clipping/saving Long battery life Can be read in the dark Can be read in bright sunlight Updates in real time Cheap Electronic delivery Ubiquity Search Bookmarking Personalisation Sharing Deep linking
  • 8. pps orks offline Fast start up Portable Clipping/saving Long battery life Can be read in the dark Can be read in bright sunlight Updates in real time Cheap Electronic delivery Ubiquity Search Bookmarking Personalisation Sharing 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. But first, let’s consider: hat is an app?
  • 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. So let’s start: hy code responsively?
  • 17. Ho an app might run Desktop Laptop Click Type Tablet Phone Move Touch In car screen eroplane Speak Listen Games + TV Point Think? console Kiosk Billboard ???
  • 18. 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
  • 22. Fastclick •  Speed up touch interactions •  Eliminates 300ms lag <script src='fastclick.js'></script> window.addEventListener('load', function() { new FastClick(document.body); }, false);
  • 23. Connection state Or hy online and offline events should not be trusted to anser the question ‘are e online?’
  • 24. 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?
  • 25. Q: If the value of navigator.onLine is true, hat does that mean? : The device might be online.
  • 26. 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
  • 27. HTML5  AppCache  for   ini=al  page  load   Splash  screen     Beware.    AppCache  needs   careful  handling.   Basic  CSS  /  Fonts   Bootstrap  &  error  handling   LocalStorage  for  code     Main  app  code   and  templates   Main  CSS  &  HTML  templates   Cookies  for  data  shared   with  the  server   Authen=ca=on   Text  and  image  content   WebSQL  /  IndexedDB  for   news  content  
  • 28. Squeezing your bits •  Devices tend to limit HTML5 storage •  Storing images offline: Base64 encoded data-URIs + UTF-16 storage encoding = Inefficient
  • 29.
  • 30. 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.
  • 31. 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
  • 32. One HTTP request! •  ggressive batching - collect requests asynchronously: api.add('getStory', {'path': '/1'}, callback1); api.add('getStory', {'path': '/2'}, callback2); api.send(callback3); api.add('analytics', params, callback4); api.send(callback5); •  Callbacks per action and per group
  • 34. 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
  • 39. Native rappers •  Invoke same core online eb site •  rapper to eb communication –  via HTML5 postMessage –  JavaScript function calls
  • 40. But ith multiple devices, surely Managing the release process is hard?
  • 41. The Old Days: Branches Feature  “Banana”   Dev   Feature  “Apple”   Merge   Test   Merge   Trunk   Release   to  live  
  • 42. The alternative: Feature flags •  Develop in one place •  Sitch bits of code on and off if (Flags.get('WidgetEnabled’)) { ... } •  Centralise those sitches function get(flagname) { switch flagname: case 'WidgetEnabled': return isAndroid ... •  Don’t associate multiple things to the same flag
  • 43. Feature flags: Override for testing Screenshot of flag tool
  • 44. 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 ...
  • 45. 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!
  • 46. 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
  • 48. HTML5 sites can be great But building a good HTML5 site is very hard.
  • 49. “The biggest mistake e made as a company as betting too much on HTML5 as opposed to native,” “It just asn’t ready”
  • 50. 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
  • 51. 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
  • 52. e're trying to help •  Your dev team can use our code –  github.com/ftlabs •  e blog about techniques at labs.ft.com •  Talks at conferences like this one
  • 53. “Don’t build native apps, build eb apps” -­‐  Tim  Berners-­‐Lee  
  • 54. 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