SlideShare una empresa de Scribd logo
1 de 64
Descargar para leer sin conexión
Fast Mobile UIs
                           You’re an Edge Case




Thursday, 8 March, 12                            1
Who am I, right?


                        Horia Dragomir
                        UI Developer @ wooga
                        HTML5 Social Games




Thursday, 8 March, 12                            2
Mobile UI != Desktop UI




Thursday, 8 March, 12                             3
Mobile UI is Harder


                        • Awesome standard support
                        • No IE6
                        • Super hardware


Thursday, 8 March, 12                                4
Forget What You Knew




Thursday, 8 March, 12                          5
Learn by Doing




Thursday, 8 March, 12                    6
Learn by Solving Problems




Thursday, 8 March, 12                               7
We Used to Have No
                            Debugging



Thursday, 8 March, 12                        8
Thank you, Adobe and
                               Opera!



Thursday, 8 March, 12                          9
Viewport
Thursday, 8 March, 12              10
Viewport



                        • It's actually hard to use the full screen
                        • Use a custom hack


Thursday, 8 March, 12                                                 11
Viewport


                        • Viewporter tries to solve this problem, but
                          fails
                        • You webapp will run in far too many
                          environments to create profiles for




Thursday, 8 March, 12                                                   12
Speed




Thursday, 8 March, 12           13
iOS versus Android
                           Android is usually half as fast*




Thursday, 8 March, 12                                         14
iOS versus Android
                                        Android is usually half as fast
                 http://daringfireball.net/linked/2012/03/05/ios-android-html5-benchmarks




Thursday, 8 March, 12                                                                      15
Loading Speed


                        • Show first, load later
                        • Loading JS can freeze the UI
                        • Lazy-loading?


Thursday, 8 March, 12                                    16
HTTP Hates You
                          Roundtrips are expensive
                               Try pipelining




Thursday, 8 March, 12                                17
applicationCache is a lie


                        • Loads in one gulp
                        • Loads in order
                        • the UI will hate this
                        • Use it with care

Thursday, 8 March, 12                                 18
Golf Everything!
                             140byt.es




Thursday, 8 March, 12                      19
Golf?



                        • Make you application smaller and smaller
                          and keep it as small as you can




Thursday, 8 March, 12                                                20
Be Awesome!




Thursday, 8 March, 12                 21
Be Awesome?




Thursday, 8 March, 12                 22
Thursday, 8 March, 12   23
You Don’t Need jQuery!



                        • I <3 jQuery, but not on mobile.
                        • jQuery fills in gaps in APIs


Thursday, 8 March, 12                                       24
HTML5 is Awesome!




Thursday, 8 March, 12                       25
USE IT!




Thursday, 8 March, 12             26
.querySelectorAll()



                        • [].map.call
                        • super fast!


Thursday, 8 March, 12                               27
.querySelectorAll()


                        [].map.call(node.querySelectorAll('a .super'),
                        function (child) {
                        	

 //awesome stuff here
                        });




Thursday, 8 March, 12                                                    28
.querySelectorAll()


                        http://snook.ca/archives/javascript/going-
                        simple-with-javascript




Thursday, 8 March, 12                                                29
getElementsByClassName



                        • blazing fast!



Thursday, 8 March, 12                            30
getElementById




Thursday, 8 March, 12                    31
Use Event Bubbling!




Thursday, 8 March, 12                         32
Use Event Bubbling!


                        instead of addingEventListeners to every
                        node, just add one to their parent.

                        It’s what the cool kids are doing!




Thursday, 8 March, 12                                              33
XMLHttpRequest
                                rocks the boat


                        • req.overrideMimeType('text/plain;
                          charset=x-user-defined');




Thursday, 8 March, 12                                         34
req.responseCode < 400




Thursday, 8 March, 12                            35
req.responseCode < 400


                        An AJAX request to an asset already stored
                        in applicationCache will sometimes yield a
                        responseCode of 0




Thursday, 8 March, 12                                                36
pushState for navigation



                        • hashChange if you're afraid of pushState



Thursday, 8 March, 12                                                37
requestAnimationFrame




Thursday, 8 March, 12                           38
requestAnimationFrame

                        • function(a,b){while(a--&&!
                          (b=this["oR0msR0mozR0webkitR0r".split(0
                          )[a]+"equestAnimationFrame"]));return b||
                          function(a){setTimeout(a,15)}}(5)


                        • https://gist.github.com/997619

Thursday, 8 March, 12                                                 39
Redraws Hate You


                        • The feeling will be mutual
                        • Use as little DOM nodes as possible
                        • Make top level changes that cascade


Thursday, 8 March, 12                                           40
CSS is your friend




Thursday, 8 March, 12                        41
Animations are hard


                        • Think of the poor CPU
                        • Use transitions!
                        • Use CSS3 transforms


Thursday, 8 March, 12                             42
Also, cheat and add dummy transforms just
                        to get things HW accelerated




Thursday, 8 March, 12                                               43
Android hates multiple
                              transforms


                        You will end up having simplified animations
                        for Android. That’s OK.




Thursday, 8 March, 12                                                 44
Also, turn off Hardware Acceleration for
                        Android 2.x




                        Thank you, Ben Green!



Thursday, 8 March, 12                                              45
node[data-mode=”super”]



                        • set attributes, not just classes
                        • classes are cool for binary switches, though


Thursday, 8 March, 12                                                    46
Tread with care



                        • CSS3 does not always follow live DOM
                          events




Thursday, 8 March, 12                                            47
Tread with care


                        • CSS3 does not always follow live DOM
                          events
                        • See this for an example:
                          http://jsbin.com/orolov/12/edit#html,live




Thursday, 8 March, 12                                                 48
Small hacks go a long way




Thursday, 8 March, 12                               49
onclick is broken



                        for a good reason




Thursday, 8 March, 12                             50
Roll your own “onclick”



                        • use touchstart, touchmove and touchend
                        • enable longtouch listener


Thursday, 8 March, 12                                              51
document.addEventListener('touchend', function () {}, false);




                        This enables the :active selector and
                        increases the perceived responsiveness of
                        your app




Thursday, 8 March, 12                                                            52
Perceived Responsiveness
                        Delay JS heavy execution to allow the UI to
                                       respond fast.




Thursday, 8 March, 12                                                 53
Perceived Responsiveness
                        http://alexmaccaw.co.uk/posts/async_ui




Thursday, 8 March, 12                                            54
Thursday, 8 March, 12   55
Thursday, 8 March, 12   56
Thursday, 8 March, 12   57
format-detection telephone=no




                        This will not always work, so you will need
                        to insert dummy <span>s here and there




Thursday, 8 March, 12                                                 58
pointer-events: none;
                         user-select: none;
                          user-drag: none;



Thursday, 8 March, 12                           59
name=viewport content="initial-scale=0.5"




                        • Use CSS3 transforms to scale things back
                          to size
                        • Or just use bigger graphics


Thursday, 8 March, 12                                                60
Use optimized images


                        • pngnq
                        • spritopia
                        • Android has navigator.connection


Thursday, 8 March, 12                                        61
Android was broken,
                              though



Thursday, 8 March, 12                         62
You should be an edge case
                        this means you're doing something special




Thursday, 8 March, 12                                               63
You should be an edge case
                        this means you're doing something special




                        @hdragomir                     @wooga



Thursday, 8 March, 12                                               64

Más contenido relacionado

Similar a Fast Mobile UIs

GitHub Notable OSS Project
GitHub  Notable OSS ProjectGitHub  Notable OSS Project
GitHub Notable OSS Project
roumia
 
Performance for Product Developers
Performance for Product DevelopersPerformance for Product Developers
Performance for Product Developers
Matthew Wilkes
 
Dan node meetup_socket_talk
Dan node meetup_socket_talkDan node meetup_socket_talk
Dan node meetup_socket_talk
Ishi von Meier
 
Scaling Quizlet
Scaling QuizletScaling Quizlet
Scaling Quizlet
Quizlet
 

Similar a Fast Mobile UIs (20)

jQuery Mobile, Backbone.js, and ASP.NET MVC
jQuery Mobile, Backbone.js, and ASP.NET MVCjQuery Mobile, Backbone.js, and ASP.NET MVC
jQuery Mobile, Backbone.js, and ASP.NET MVC
 
GitHub Notable OSS Project
GitHub  Notable OSS ProjectGitHub  Notable OSS Project
GitHub Notable OSS Project
 
Front end performance improvements
Front end performance improvementsFront end performance improvements
Front end performance improvements
 
Measure Everything
Measure EverythingMeasure Everything
Measure Everything
 
Performance for Product Developers
Performance for Product DevelopersPerformance for Product Developers
Performance for Product Developers
 
Scaling the Cloud - Cloud Security
Scaling the Cloud - Cloud SecurityScaling the Cloud - Cloud Security
Scaling the Cloud - Cloud Security
 
Dan node meetup_socket_talk
Dan node meetup_socket_talkDan node meetup_socket_talk
Dan node meetup_socket_talk
 
Educause - Building a Responsive Website for the Presidential Debate
Educause - Building a Responsive Website for the Presidential DebateEducause - Building a Responsive Website for the Presidential Debate
Educause - Building a Responsive Website for the Presidential Debate
 
Mobile in a Nutshell
Mobile in a NutshellMobile in a Nutshell
Mobile in a Nutshell
 
Webvs Native
Webvs NativeWebvs Native
Webvs Native
 
Scaling Quizlet
Scaling QuizletScaling Quizlet
Scaling Quizlet
 
static ABAP code analyzers
static ABAP code analyzersstatic ABAP code analyzers
static ABAP code analyzers
 
SOLVING BIG DATA APP DEVELOPERS BIGGEST PAINS from Structure:Data 2013
SOLVING BIG DATA APP DEVELOPERS BIGGEST PAINS from Structure:Data 2013SOLVING BIG DATA APP DEVELOPERS BIGGEST PAINS from Structure:Data 2013
SOLVING BIG DATA APP DEVELOPERS BIGGEST PAINS from Structure:Data 2013
 
State of Puppet
State of PuppetState of Puppet
State of Puppet
 
Faster mobile sites
Faster mobile sitesFaster mobile sites
Faster mobile sites
 
Hyves: Mobile app development with HTML5 and Javascript
Hyves: Mobile app development with HTML5 and JavascriptHyves: Mobile app development with HTML5 and Javascript
Hyves: Mobile app development with HTML5 and Javascript
 
Html5 new sword for interactive app
Html5 new sword for interactive appHtml5 new sword for interactive app
Html5 new sword for interactive app
 
Core Data in Motion
Core Data in MotionCore Data in Motion
Core Data in Motion
 
HH.JS - State of the Automation
HH.JS - State of the AutomationHH.JS - State of the Automation
HH.JS - State of the Automation
 
Building Antifragile Applications with Apache Cassandra
Building Antifragile Applications with Apache CassandraBuilding Antifragile Applications with Apache Cassandra
Building Antifragile Applications with Apache Cassandra
 

Más de Wooga

Riak & Wooga_Geeek2Geeek Meetup2014 Berlin
Riak & Wooga_Geeek2Geeek Meetup2014 BerlinRiak & Wooga_Geeek2Geeek Meetup2014 Berlin
Riak & Wooga_Geeek2Geeek Meetup2014 Berlin
Wooga
 
Staying in the Game: Game localization practices for the mobile market
Staying in the Game: Game localization practices for the mobile marketStaying in the Game: Game localization practices for the mobile market
Staying in the Game: Game localization practices for the mobile market
Wooga
 
Startup Weekend_Makers and Games_Philipp Stelzer
Startup Weekend_Makers and Games_Philipp StelzerStartup Weekend_Makers and Games_Philipp Stelzer
Startup Weekend_Makers and Games_Philipp Stelzer
Wooga
 
CodeFest 2014_Mobile Game Development
CodeFest 2014_Mobile Game DevelopmentCodeFest 2014_Mobile Game Development
CodeFest 2014_Mobile Game Development
Wooga
 
How to hire the best people for your startup-Gitta Blat-Head of People
How to hire the best people for your startup-Gitta Blat-Head of PeopleHow to hire the best people for your startup-Gitta Blat-Head of People
How to hire the best people for your startup-Gitta Blat-Head of People
Wooga
 
Pocket Gamer Connects 2014_The Experience of Entering the Korean Market
Pocket Gamer Connects 2014_The Experience of Entering the Korean MarketPocket Gamer Connects 2014_The Experience of Entering the Korean Market
Pocket Gamer Connects 2014_The Experience of Entering the Korean Market
Wooga
 

Más de Wooga (20)

Story of Warlords: Bringing a turn-based strategy game to mobile
Story of Warlords: Bringing a turn-based strategy game to mobile Story of Warlords: Bringing a turn-based strategy game to mobile
Story of Warlords: Bringing a turn-based strategy game to mobile
 
Instagram Celebrities: are they the new cats? - Targetsummit Berlin 2015
Instagram Celebrities: are they the new cats? - Targetsummit Berlin 2015Instagram Celebrities: are they the new cats? - Targetsummit Berlin 2015
Instagram Celebrities: are they the new cats? - Targetsummit Berlin 2015
 
In it for the long haul - How Wooga boosts long-term retention
In it for the long haul - How Wooga boosts long-term retentionIn it for the long haul - How Wooga boosts long-term retention
In it for the long haul - How Wooga boosts long-term retention
 
Leveling up in localization! - Susan Alma & Dario Quondamstefano
Leveling up in localization! - Susan Alma & Dario QuondamstefanoLeveling up in localization! - Susan Alma & Dario Quondamstefano
Leveling up in localization! - Susan Alma & Dario Quondamstefano
 
Evoloution of Ideas
Evoloution of IdeasEvoloution of Ideas
Evoloution of Ideas
 
Entitas System Architecture with Unity - Maxim Zaks and Simon Schmid
Entitas System Architecture with Unity - Maxim Zaks and Simon Schmid Entitas System Architecture with Unity - Maxim Zaks and Simon Schmid
Entitas System Architecture with Unity - Maxim Zaks and Simon Schmid
 
Saying No to the CEO: A Deep Look at Independent Teams - Adam Telfer
Saying No to the CEO: A Deep Look at Independent Teams - Adam TelferSaying No to the CEO: A Deep Look at Independent Teams - Adam Telfer
Saying No to the CEO: A Deep Look at Independent Teams - Adam Telfer
 
Innovation dank DevOps (DevOpsCon Berlin 2015)
Innovation dank DevOps (DevOpsCon Berlin 2015)Innovation dank DevOps (DevOpsCon Berlin 2015)
Innovation dank DevOps (DevOpsCon Berlin 2015)
 
Big Fish, small pond - strategies for surviving in a maturing market - Ed Biden
Big Fish, small pond - strategies for surviving in a maturing market - Ed BidenBig Fish, small pond - strategies for surviving in a maturing market - Ed Biden
Big Fish, small pond - strategies for surviving in a maturing market - Ed Biden
 
Review mining aps2014 berlin
Review mining aps2014 berlinReview mining aps2014 berlin
Review mining aps2014 berlin
 
Riak & Wooga_Geeek2Geeek Meetup2014 Berlin
Riak & Wooga_Geeek2Geeek Meetup2014 BerlinRiak & Wooga_Geeek2Geeek Meetup2014 Berlin
Riak & Wooga_Geeek2Geeek Meetup2014 Berlin
 
Staying in the Game: Game localization practices for the mobile market
Staying in the Game: Game localization practices for the mobile marketStaying in the Game: Game localization practices for the mobile market
Staying in the Game: Game localization practices for the mobile market
 
Startup Weekend_Makers and Games_Philipp Stelzer
Startup Weekend_Makers and Games_Philipp StelzerStartup Weekend_Makers and Games_Philipp Stelzer
Startup Weekend_Makers and Games_Philipp Stelzer
 
DevOps goes Mobile (daho.am)
DevOps goes Mobile (daho.am)DevOps goes Mobile (daho.am)
DevOps goes Mobile (daho.am)
 
DevOps goes Mobile - Jax 2014 - Jesper Richter-Reichhelm
DevOps goes Mobile - Jax 2014 - Jesper Richter-ReichhelmDevOps goes Mobile - Jax 2014 - Jesper Richter-Reichhelm
DevOps goes Mobile - Jax 2014 - Jesper Richter-Reichhelm
 
CodeFest 2014_Mobile Game Development
CodeFest 2014_Mobile Game DevelopmentCodeFest 2014_Mobile Game Development
CodeFest 2014_Mobile Game Development
 
Jelly Splash: Puzzling your way to the top of the App Stores - GDC 2014
Jelly Splash: Puzzling your way to the top of the App Stores - GDC 2014Jelly Splash: Puzzling your way to the top of the App Stores - GDC 2014
Jelly Splash: Puzzling your way to the top of the App Stores - GDC 2014
 
How to hire the best people for your startup-Gitta Blat-Head of People
How to hire the best people for your startup-Gitta Blat-Head of PeopleHow to hire the best people for your startup-Gitta Blat-Head of People
How to hire the best people for your startup-Gitta Blat-Head of People
 
Two Ann(e)s and one Julia_Wooga Lady Power from Berlin_SGA2014
Two Ann(e)s and one Julia_Wooga Lady Power from Berlin_SGA2014Two Ann(e)s and one Julia_Wooga Lady Power from Berlin_SGA2014
Two Ann(e)s and one Julia_Wooga Lady Power from Berlin_SGA2014
 
Pocket Gamer Connects 2014_The Experience of Entering the Korean Market
Pocket Gamer Connects 2014_The Experience of Entering the Korean MarketPocket Gamer Connects 2014_The Experience of Entering the Korean Market
Pocket Gamer Connects 2014_The Experience of Entering the Korean Market
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Último (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Fast Mobile UIs