Slide 1

Slide 1 text

Demian Borba BlackBerry Developer Evangelist @demianborba www.dborba.com C R E A T I N G H I G H P E R F O R M A N C E M O B I L E A P P S W I T H H T M L 5

Slide 2

Slide 2 text

• Graduated in Industrial Design (CEFET-PR) • Graduated in Computer Science (UFAL) • Crazy about Design, UX, Business and Technology • Professor at University of California San Diego (UCSD) • Working with Interactive Media for over 13 years • Founder of Action Creations, interactive agency in California • Developer Evangelist, 90% #upintheair • Launch the Startup Jam program globally • Launched the Tech Centers in Universities A B O U T M E

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

• Mobile is different • Why HTML5? • Defining PERFORMANCE • 20 tips to improve performance • Samples built with HTML5 • Remote Web Inspector • Live Refresh • The Car • What we are trying to solve • Questions & Answers A G E N D A

Slide 6

Slide 6 text

• Large display • Large point of focus • Unlimited connection and power • IMMERSIVE EXPERIENCE D E S K T O P C O N N E C T E D W O R L D

Slide 7

Slide 7 text

• Small display • Single point of focus • Variable limited connection and power INTERACTIVE EXPERIENCE M O B I L E I S D I F F E R E N T

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

“Fulfill the promise of a full mobile computing experience”. ONE CLEAR GOAL

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

Source: http://html5test.com

Slide 16

Slide 16 text

Source: http://beta.html5test.com/compare/browser/bb-10.2/ios-7.0/android-4.3/firefoxmobile-24/wp-8.html

Slide 17

Slide 17 text

W H Y ? • Reach • Huge Developer Community • Cross* Platform (Cordova, PhoneGap, Sencha etc) • Standards • Tons of Libraries, Tools and Services

Slide 18

Slide 18 text

Source: Vision Mobile Developer Economics 2013 78% of developers interested in revenue, use two or more platforms concurrently

Slide 19

Slide 19 text

Source: Vision Mobile Developer Economics 2013 Android, iOS and BlackBerry are top priority for their developers

Slide 20

Slide 20 text

H O W D O E S I T W O R K ?

Slide 21

Slide 21 text

P E R F O R M A N C E

Slide 22

Slide 22 text

Source: Wikipedia (http://en.wikipedia.org/wiki/Computer_performance) Computer performance is characterized by the amount of useful work accomplished by a computer system compared to the time and resources used.

Slide 23

Slide 23 text

Source: Michael Wolf, Director of Technology at Cynergy PERFORMANCE UX ===

Slide 24

Slide 24 text

L A T E N C Y Input Event ( press menu key ) Display Update ( menu appears ) timeline UI Latency

Slide 25

Slide 25 text

L A T E N C Y

Slide 26

Slide 26 text

D O E S P E R F O R M A N C E M A T T E R ? Source: http://www.slideshare.net/stoyan/yslow-20-presentation

Slide 27

Slide 27 text

D O E S P E R F O R M A N C E M A T T E R ? Source: https://sites.google.com/site/glinden/Home/StanfordDataMining.2006-11-28.ppt?attredirects=0

Slide 28

Slide 28 text

2 0 T I P S P E R F O R M A N C E I M P R O V E T O

Slide 29

Slide 29 text

Accessing the DOM is expensive, do smarter trips 1 ECMA LAND DOM LAND BRIDGE TOLL ROAD

Slide 30

Slide 30 text

2 Call the right keyboard

Slide 31

Slide 31 text

2 Call the right keyboard

Slide 32

Slide 32 text

2 Call the right keyboard

Slide 33

Slide 33 text

3 Use custom data-* attributes

Slide 34

Slide 34 text

3 Use custom data-* attributes // Add new data attributes via JS. var el = document.querySelector('#demian'); el.setAttribute('data-focus', 'html5');

Slide 35

Slide 35 text

3 Use custom data-* attributes var html = []; for (var key in el.dataset) { html.push(key, ': ', el.dataset[key], '
'); } el.innerHTML = html.join(''); Output: job: evangelist company: blackberry focus: html5

Slide 36

Slide 36 text

4 Worry about keeping the user well informed (good feedback) TAP REQUEST DATA WAIT PARSE DATA UPDATE VIEW

Slide 37

Slide 37 text

4 Worry about keeping the user well informed (good feedback) TAP REQUEST DATA WAIT PARSE DATA UPDATE VIEW

Slide 38

Slide 38 text

5 Be careful with Gradients, prefer CSS or SVG

Slide 39

Slide 39 text

6 Use sprites and pick the right image format USE JPEG FOR for non-transparent images USE PNG FOR for transparent images

Slide 40

Slide 40 text

7 dataURI is your friend

Slide 41

Slide 41 text

8 Browser APIs are awesome if (navigator.onLine) { alert('online'); } else { alert('offline'); }

Slide 42

Slide 42 text

9 Have a nice backend solution (e.g. Amazon AWS)

Slide 43

Slide 43 text

9 Have a nice backend solution (ex: Amazon AWS) Great tutorial by Christophe Coenraets: http://bit.ly/1aDYANI

Slide 44

Slide 44 text

9 Have a nice backend solution (ex: Amazon AWS)

Slide 45

Slide 45 text

1 0 Create an offline mode (localStorage) window.localStorage.setItem('nome', 'Demian Borba'); window.localStorage.getItem('nome');

Slide 46

Slide 46 text

1 0 Create an offline mode (Web SQL Database) var db = window.openDatabase("DBName", "1.0", "description", 5*1024*1024); // 5MB db.transaction(function(tx) { tx.executeSql("SELECT * FROM employees", [], successCallback, errorCallback); });

Slide 47

Slide 47 text

1 0 Create an offline mode (IndexedDB) var idbRequest = window.indexedDB.open('Database Name'); idbRequest.onsuccess = function(event) { var db = event.srcElement.result; var transaction = db.transaction([], IDBTransaction.READ_ONLY); var curRequest = transaction.objectStore('ObjectStore Name').openCursor(); curRequest.onsuccess = ...; };

Slide 48

Slide 48 text

1 1 Create single page apps App

Slide 49

Slide 49 text

1 2 Touch is different than Click click: 307ms

Slide 50

Slide 50 text

1 2 Touch is different than Click touchstart: 4ms

Slide 51

Slide 51 text

1 2 Touch is different than Click github.com/ftlabs/fastclick index.html: app.js: window.addEventListener('load', function () { new FastClick(document.body); }, false);

Slide 52

Slide 52 text

1 3 jQuery? Well... .querySelectorAll()

Slide 53

Slide 53 text

1 3 jQuery? Well... document.getElementById

Slide 54

Slide 54 text

1 4 CSS for touch is special -webkit-tap-highlight-color: rgba(0, 0, 0, 0); user-select: none;

Slide 55

Slide 55 text

1 5 Boost your scrolling list -webkit-overflow-scrolling: touch; iScroll

Slide 56

Slide 56 text

1 6 Use CSS Transitions + Hardware Acceleration -webkit-transform: translate3d(0,0,0);

Slide 57

Slide 57 text

1 7 preventDefault()

Slide 58

Slide 58 text

1 8 Web Workers Execution happens in a separate process. Not on the UI THREAD = no UI delays Main Script doWork.js (The Worker)

Slide 59

Slide 59 text

1 9 Be careful with frameworks http://jquerymobile.com § Easy to write (no need for heavy JS work) § Theme Roller & Codiqa (visual tool) § Does well with single page apps § Built upon jQuery UI § Runs on iOS, Android, BlackBerry, Bada, Windows Phone, WebOS and more § Has a builder tool (alpha)

Slide 60

Slide 60 text

1 9 Be careful with frameworks http://zeptojs.com/

Slide 61

Slide 61 text

1 9 Be careful with frameworks http://www.sencha.com/products/touch § MVC like § Focused on commercial products § Training & Support § Runs on OS, Android, BlackBerry, Windows Phone, and more.

Slide 62

Slide 62 text

1 9 Be careful with frameworks http://lungo.tapquo.com § Created to run on low end devices § Robust API § Community Driven (GitHub) § Runs on iOS / Android / Blackberry / FirefoxOS

Slide 63

Slide 63 text

1 9 Be careful with frameworks https://github.com/blackberry/bbUI.js § Niche specific, (BlackBerry 10 look and feel) § Follows BlackBerry 10 User Experience Guidelines § Community Driven (GitHub) § OFF DOM Implementation § UI only

Slide 64

Slide 64 text

2 0 There is no magic! (JSPerf, BrowserScope, WebInspector) Test! Test! Test! Tip: 20% QA

Slide 65

Slide 65 text

• bbUI.js • Sensors • Accelerometer Fight • Built For BlackBerry • WebGL Sample (http://dborba.com/gamepad) source code: http://github.com/blackberry/ and look for WebWorks S A M P L E A P P S

Slide 66

Slide 66 text

developer.blackberry.com/html5 C++/Qt Cascades ActionScript Adobe® AIR® HTML5 BlackBerry® WebWorks™ C/C++ Native SDK Java Android™ Runtime

Slide 67

Slide 67 text

developer.blackberry.com/builtforblackberry

Slide 68

Slide 68 text

R E M O T E W E B I N S P E C T O R Sample App: bbUI Sample

Slide 69

Slide 69 text

L I V E R E F R E S H Video tutorial: http://dborba.com/wow-no-more-re-packaging-when-testing-html5-apps-on-your-device/ Text Editor (i.g. Sublime) Packager (i.g. WebWorks) Network Observer (i.g. Live Reload) + +

Slide 70

Slide 70 text

T H E C A R

Slide 71

Slide 71 text

Q N X C A R

Slide 72

Slide 72 text

No content

Slide 73

Slide 73 text

• HTML5 SDK for Web Developers • Launch planned for end of 2013 (in sync with QNX CAR 2.1) How app developers can make money? • Advertising • In-app purchases • SaaS - Software as a Service (monthly charges) • OEM pre-funded • Etc Q N X C A R S D K

Slide 74

Slide 74 text

No content

Slide 75

Slide 75 text

QNX$CAR$2$feature$highlights$ Naviga&on) •  Elektrobit$embedded$ •  Telenav$hybrid$ •  TCS$off@board$ $ Infotainment)+)social)media) •  Media/AM/FM/HD$ •  Pandora,$SHtcher$ •  Web$browser,$YouTube$ •  Facebook,$TwiMer$ Automo&ve) •  PersonalizaHon$ •  Climate$control$ •  Virtual$mechanic$ •  Audio$control$ $ Connec&vity) •  Bluetooth$+$SMS$ •  MirrorLink$+$iPod$Out$ •  Smartphone$w/$HTML5$ •  DLNA$ Pla9orm)+)framework) •  Torch$browser$ •  ComposiHon$manager$ •  HTML5$framework$ •  App$store$support$

Slide 76

Slide 76 text

A P P ?

Slide 77

Slide 77 text

A P P ?

Slide 78

Slide 78 text

• Bluetooth 4.0 • Wifi • NFC • USB • HDMI • DLNA • Triggers SENSE UNDERSTAND ADAPT • BBM • Files • Screen • Video • Game GPS Accelerometer Altimeter Gyroscope Camera Screens Keyboard Cascades UI Framework My Location Geofence Places Map Automotive Hub Contacts Calendar Notifications UI Outputs based on Sensor Inputs and User Preferences CONNECT SHARE

Slide 79

Slide 79 text

T R I G G E R S Sample: Travel, Context Aware, Headless Apps

Slide 80

Slide 80 text

N F C Sample: Pictures, Wotando

Slide 81

Slide 81 text

P R O T Y P I N G Sample: Rabiscapp

Slide 82

Slide 82 text

C O N T R O L L E R Sample: Sphero “In 2 hours, I created an app to control my Sphero with a BlackBerry 10. It was the 1st time I had even heard of the BlackBerry development tools”. - Mike DePhillips, Software Engineer at GoSphero

Slide 83

Slide 83 text

G A M I N G Sample: ShadowGun / Tunnel Tilt

Slide 84

Slide 84 text

D O I T

Slide 85

Slide 85 text

• Find a real world problem • Never bring TECHNOLOGY before the PROBLEM • Analyze the current solutions • Validate your idea • Build your MVP (Minimum Viable Product) • Sense, understand and adapt S U G G E S T I O N S

Slide 86

Slide 86 text

No content

Slide 87

Slide 87 text

W H A T A R E Y O U W A I T I N G F O R ?

Slide 88

Slide 88 text

Demian Borba BlackBerry Developer Evangelist @demianborba www.dborba.com T H A N K Y O U