James Pearce
 Director, Developer Relations

 @ jamespearce
   jamesp@sencha.com
HTML5 and the dawn of
   rich mobile web
     applications
or
Everything I know about HTML5 I learned from
How Mobile Rolls
2008
We must have an
 iPhone App!
2010
We must have an
 Android App!
2011
omfg
JS
        C# Palm   J2ME
    Microsoft

                        RIM         RIM
                                    Android
                                    Apple
Apple                     Air       Microsoft
                                    Palm
Obj-C
                       Java
         C++ Android            Top U.S. Smartphone Platforms,
                                3 Month Average Ending December 2010
                                comScore MobiLens 2010
J2ME
     C#          RIM   C
     Microsoft                                   Nokia
                       Python                    Apple
 Java                                            Android
  Android                        Nokia           Microsoft
 C++                                             RIM
                       Lua
            Obj-C
         Apple             ...               Top EU5 Smartphone Platforms,
                                             3 Month Average Ending December 2010
                                             comScore MobiLens 2010




http://www.cloudfour.com/a-comprehensive-guide-to-mobile-statistics/
Device diversity
App Stores   Updates
The Promise of
Web Technologies
The Web
Cross-platform
Familiar skills & tools
Decentralized
Easily updated
Indexed
Well-understood
...



                      Mobile: the next era of the web as we know it
http://www.victoriassecret.com
http://mobile.victoriassecret.com
The
mobile web
 is not a
320px web
(“responsive web design”)
The Web
Cross-platform
Familiar skills & tools
Decentralized
Easily updated
Indexed
Well-understood
...



                          But wait! Weren’t we talking about apps?
Hypothesis:


   Web technologies
          are a
   viable alternative
to native development
The Web is Evolving...
   Documents           Applications
 Declarative HTML   Programmatic DOM
    Templates             APIs
      URLs             Arguments
 Request/Response    Synchronization
    Thin client        Thick client
-webkit
       accelerometer
                                        @page
  localStorage
                                                CSS Text
  @media
                                                 manifest
transform
                                                <video>
  WebSQL
                                             GeoLocation

   type=camera                              canvas

                  keyframe       gradient
this is uncanny
A New Mobile App Stack
                WebFonts        Video      Audio    Graphics
Device Access                                                  Server & Services

  Camera                    CSS Styling & Layout                    HTTP

  Location                                                          AJAX
                                   Javascript
  Contacts                                                          Events

    SMS                          Semantic HTML                     Sockets

 Orientation                                                         SSL
                 File Systems        Worker
                                                    x-App
    Gyro              DBs            Parallel                      More...
                                                   Messaging
                  App Cache         Processing
Rich Media & StylingO     RM
                          TF
                        LA
   Full Resource PP P Access
                    A
                 RN
    ParallelDProcessing
               E
             O
            M Communication
Inter-AppTE
      LE
     P O ine Capability
 C Full
  OM
Web technologies
          are a
   viable alternative
to native development
Caveats?
Performance

Browser support

Device access          All less of a issue
                   than you might think
Discoverability

Monetization

App ‘experience’
Progressive enhancement
assumption




   HTML              JS      CSS


                      progressive
                     enhancement
                                    app




               doc
                                          vs




           assumption




HTML           JS            CSS
                                    app
State of the Art:
 Mobile HTML5
Environments




     ?
Browsers




     WebKit   FOEs
HTML5 support
                       IE 9 PR   Chrome 7   Safari 5   Firefox 4b   iPhone 4   BB Torch   Android 2.2
@font-face
Canvas
HTML5 Audio & Video
rgba(), hsla()
border-image:
border-radius:
box-shadow:
text-shadow:
opacity:
Multiple backgrounds
Flexible Box Model
CSS Animations
CSS Columns
CSS Gradients
CSS Reflections
CSS 2D Transforms
CSS 3D Transforms
CSS Transitions
Geolocation API
local/sessionStorage
SVG/SVG Clipping
SMIL
Inline SVG
Drag and Drop
hashchange
X-window Messaging
History Management
applicationCache
Web Sockets
Web Workers
Web SQL Database
WebGL
IndexedDB
Stay on top of diversity
Can I Use?
http://caniuse.com

Modernizr
http://modernizr.com

DeviceAtlas
http://deviceatlas.com
Enter The Framework
Why use a framework?
Provide user interface components

Smooth browser inconsistencies

Mimic native or server paradigms

Create consistent application architectures

...and more
Strokes for folks
 Sites & Documents      Applications
 Declarative HTML    Programmatic DOM
     Templates             APIs
       URLs             Arguments
 Request/Response     Synchronization
    Thin client         Thick client
jQTouch
UI layer on top of jQuery
Declarative HTML
Library progressively enhances
Browsers:
 iOS (iPhone/iPod)
 Android
 BlackBerry v6
 Most WebKit-based browsers

http://jQTouch.com
jQTouch
                    Scripts & stylesheets




      CSS classes for semantics & config
jQuery Mobile (alpha)
UI layer on top of jQuery
Declarative HTML
Library progressively enhances
Browsers:
 iOS (iPhone/iPad)
 Android
 BlackBerry v5+
 Symbian v5, MeeGo, webOS

http://jquerymobile.com
jQuery Mobile
          Scripts & stylesheet




          data-* for semantics
                & config
Sencha Touch
Self-contained library
Programmatic Javascript
Standalone MVC applications
Browsers:
 iOS (iPhone/iPad)
 Android
 BlackBerry v6 & QNX
 Bada, MeeGo & other WebKit
 Windows Phone 7*

http://sencha.com/touch


* to come
Sencha Touch
                   Data model
                   & records




       Programmatically create
            toolbar & list
What’s in a good framework?
Layouts & components
Theming & icons
Orientation & animation
Touch events & scroller
Data package
MVC framework
Components
Lists
- Nested, Grouped, Sortable
Carousel
Picker
Overlay
Slider
Forms & fields
Toolbars & buttons
HTML5
- Audio
- Video
- GeoLocation
Theming
Use CSS3 & SASS
- Flexible themes
- Highly optimized
Forms
Scrolling
Momentum/bounce physics

Hardware accelerated

Throughout all components:
- Lists
- Carousel
- Pickers
Touch Events
Built on native events

Abstracted for performance

Additional events
- Tap
- Double tap
- Tap and hold
- Swipe
- Rotate
- Drag & drop
Data Package
Models, Stores, and Proxies
- Associations
- Validation
- Local & server storage

Easily consume web services
- JSON/P
- XML
- YQL
“The Kitchen Sink”




                     http://sencha.com/x/5e
Implementing Mobile Web
      Sites|Apps
Evolving sites for mobile

   Views
               HTML, CSS...


 Controllers
  Models
Evolving sites for mobile
           Desktop
Switcher


                     HTML, CSS...
            Mobile


  Controllers
           Models
Mobile detection
class ApplicationController < ActionController::Base
    has_mobile_fu
end



*.mobile.erb

is_mobile_device?
in_mobile_view?



  https://github.com/brendanlim/mobile-fu
Smart detection
 & user choice
“Switch to our desktop site”
Thematic consistency
w3c-speak


            http://mysite.com/posts/123



            http://mysite.mobi/posts/123
Mobile switching




http://tinyurl.com/mobswi1 http://tinyurl.com/mobswi2
Then to an app...
            Desktop
Switchers



             Mobile
             REST
  Controllers          JSO
                          N
            Models
Thematic consistency


   http://mysite.com/posts/123



  http://mysite.com/#!/posts/123
The stack of the present


                 req/res
User interface             Rendering
Business logic
   Storage
The stack of the future



                  User interface
           sync
Security          Business logic
Storage              Storage

                   The return of
                  the thick client!
Do we have time for
   some code?
Brand consistency
Getting help from the cloud




http://i.tinysrc.mobi/http://mysite.com/myimage.png

               http://tinysrc.net/
Mobile devices
              are di erent
               Geolocation
              Telephony
              Camera
       Messaging

And mobile users
are different too!
Going Hybrid
PhoneGap
A platform that allows you to author native applications
  with web technologies and get access to device APIs




                 http://phonegap.com
+
Full API list:

Accelerometer   File
Camera          Geolocation
Compass         Media
Contacts        Network
Device          Notification
Events          Storage

http://docs.phonegap.com
                                http://www.sencha.com/learn/
                              Tutorial:Sencha_Touch_PhoneGap
PhoneGap Build
A word about app stores

     (pssst: they’re an admission of defeat)
Doing mobile right
 Everyone loves apps - but native development sucks

 This is the year of the mobile web - but caveats apply

Web technologies are a viable alternative to native apps
built with

Apps vs Web technology
James Pearce
 Director, Developer Relations

 @ jamespearce
   jamesp@sencha.com

HTML5 and the dawn of rich mobile web applications