Slide 1

Slide 1 text

Use Web Skills To Build Mobile Apps with Matt Baxter & Nathan Smith SATURDAY — JUNE 2, 2012 — DALLAS, TX http://bigdesignevents.com

Slide 2

Slide 2 text

Put down that pen! (or not) You can get the slides here: http://j.mp/web-skills

Slide 3

Slide 3 text

Who are we?

Slide 4

Slide 4 text

We do mobile/web UX & JavaScript at http://projekt202.com @mbxtr & @nathansmith (In case you want to talk smack on Twitter)

Slide 5

Slide 5 text

We’re hiring JavaScript savvy developers to join our team at projekt202. (You can talk to us after the presentation) An urgent (not desperate) announcement http://projekt202.com

Slide 6

Slide 6 text

The Rise of Mobile

Slide 7

Slide 7 text

http://flickr.com/photos/djwudi/382030798 State of mobile in 2007 — The year the iPhone was introduced

Slide 8

Slide 8 text

Handset design was quite diverse “way back when.” Industrial designers were still (awkwardly) searching for the best form factor…

Slide 9

Slide 9 text

http://zackmorriscellphone.com

Slide 10

Slide 10 text

Technology is cyclical. Good ideas are often “borrowed” and make their way to products from multiple vendors. http://engadget.com/photos/hp-envy-15-vs-the-macbook-pro

Slide 11

Slide 11 text

The state of mobile in 2012 — Touch screens reign supreme

Slide 12

Slide 12 text

Not everyone can rock the giant cell phone forever… http://hulu.com/watch/76560/late-night-with-jimmy-fallon-saved-by-the-bell-reunion-update-3

Slide 13

Slide 13 text

Nowadays, it’s more about the software on the device.

Slide 14

Slide 14 text

http://lukew.com/ff/entry.asp?1506 317,124 newborns begin life 1,450,000 mobile devices activated Each day, on planet Earth…

Slide 15

Slide 15 text

The one thing all these phones have in common (besides Angry Birds) is they all have decent web browsers. http://paulirish.com/2010/high-res-browser-icons

Slide 16

Slide 16 text

“Obama orders agencies to optimize Web content for mobile…” http://flickr.com/photos/whitehouse/7161178504

Slide 17

Slide 17 text

http://computerworld.com/s/article/9227412/Obama_orders_agencies_to_optimize_Web_content_for_mobile

Slide 18

Slide 18 text

Mobile web trivia time… — PhoneGap on Windows Phone uses the IE9 engine (it is pretty good) — WebKit is the dominant rendering engine across most mobile devices — iOS, Android, Blackberry, webOS — Blackberry has one of the best WebKit-based browsers available

Slide 19

Slide 19 text

So, what should I build? [A] Desktop web app [B] Mobile web app [C] Mobile native app

Slide 20

Slide 20 text

[D] All of the above Note: We’re not saying you have to build all-in-one… But it is possible.

Slide 21

Slide 21 text

http://alistapart.com/articles/responsive-web-design Whither Responsive Web Design? Responsive web design using @media queries (with one codebase for all devices) typically works best for web “sites” (not apps). As a general rule of thumb, if your content can be read via RSS and still make sense, it is a good candidate for RWD.

Slide 22

Slide 22 text

Benefits of native development — Default OS look & feel (UI conventions) — Performance (“closer to the metal”) — Access to device hardware (GPS, etc) — App store/marketplace distribution — Benefit from latest OS enhancements

Slide 23

Slide 23 text

Drawbacks of native development — Tied to the particular OS you built for — Maintaining a multi OS team/skill-set — Dealing with app store approval process — Keeping app in sync with OS updates

Slide 24

Slide 24 text

LinkedIn’s iPad app is 95% HTML5 We did users studies in-house, and I don’t think people noticed a big difference. Nobody said, “Oh that’s native,” or “Oh, that’s web.” As long as we can make the experience fast enough, nobody can tell the difference. It still feels right. — Kiran Prasad http://venturebeat.com/2012/05/02/linkedin-ipad-app-engineering

Slide 25

Slide 25 text

Benefits of hybrid development — Common codebase for multiple OS’s — Access to device hardware (GPS, etc) — App store/marketplace distribution — Skills you already have (HTML, CSS, JS) — Potential code reuse in web site/app

Slide 26

Slide 26 text

Drawbacks of hybrid development — Build for lowest common denominator — 3rd party SDK’s might lag behind OS — Want to use feature X? Wait for an implementation in abstraction layer. — An abstraction layer can have bugs of its own. Have to determine if a bug is in your code, the abstraction layer, or OS.

Slide 27

Slide 27 text

Titanium from Appcelerator http://appcelerator.com/platform

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

Areas where Titanium shines — Native UI — Great for iOS, crapshoot on Android — Build for iOS, Android, and Blackberry — Some code reuse across platforms — Entirely JavaScript based — Uses CommonJS’s AMD approach — Except for WebView (HTML/CSS too)

Slide 30

Slide 30 text

http://j.mp/bachmann-eyezed

Slide 31

Slide 31 text

Abstraction layers tend to be harder to debug than “native” languages — Objective-C, C#, or Java — whilst using an IDE such as Visual Studio, Xcode, or Eclipse. With “the web,” you have familiar browser-based desktop tools in Chrome, Firebug, or Opera Dragonfly.

Slide 32

Slide 32 text

http://phonegap.com PhoneGap from Adobe

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

Areas where PhoneGap shines — It is “the web you already know” — Debugging via desktop browser — Access to device API’s (GPS, etc) — Strives to implement W3C specs — Camera API, etc. — Supports Windows Phone 7, too

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

http://youtu.be/nOEw9iiopwI

Slide 37

Slide 37 text

— It embeds a WebView in a native app — Native app gives access to OS API’s — All the UI is built via HTML/CSS — JavaScript handles everything else — The app wrapper compiles via… Xcode, Eclipse, Visual Studio, or “the cloud” → build.phonegap.com How PhoneGap works

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

http://host.sonspring.com/handlebbbars Handlebbbars demo of Handlebars.js and the Dribbble API

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

http://handlebarsjs.com

Slide 42

Slide 42 text

http://dribbble.com/api

Slide 43

Slide 43 text

Dribbble API: JSON

Slide 44

Slide 44 text

Handlebars template {{#each shots}} <li> <p> <b class="big"> {{title}} </b> <img alt="{{title}}" class="frame" style="background-image:url({{image_url}})" src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAEklEQVQIHWP8//8/AzJgJCg AAB+ICPuLaDnAAAAAAElFTkSuQmCC" /> </p> <table> <tr> <th> Designer: </th> <td> <b>{{player.name}}</b> </td> </tr> {{#if player.twitter_screen_name}} ... {{/if}} {{#if likes_count}} ... {{/if}} {{#if short_url}} ... {{/if}} </table> </li> {{/each}}

Slide 45

Slide 45 text

{{#each shots}} <li> <p> <b class="big"> {{title}} </b> <img alt="{{title}}" class="frame" style="background-image:url({{image_url}})" src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAEklEQVQIHWP8//8/AzJgJCg AAB+ICPuLaDnAAAAAAElFTkSuQmCC" /> </p> <table> <tr> <th> Designer: </th> <td> <b>{{player.name}}</b> </td> </tr> {{#if player.twitter_screen_name}} ... {{/if}} {{#if likes_count}} ... {{/if}} {{#if short_url}} ... {{/if}} </table> </li> {{/each}} Handlebars template

Slide 46

Slide 46 text

... {{#if player.twitter_screen_name}} Twitter: @{{player.twitter_screen_name}} {{/if}} {{#if likes_count}} Likes: {{likes_count}} {{/if}} {{#if short_url}} URL: {{short_url}} {{/if}} ... Handlebars template

Slide 47

Slide 47 text

... {{#if player.twitter_screen_name}} Twitter: @{{player.twitter_screen_name}} {{/if}} {{#if likes_count}} Likes: {{likes_count}} {{/if}} {{#if short_url}} URL: {{short_url}} {{/if}} ... Handlebars template

Slide 48

Slide 48 text

Sweet, responsive Handlebbbars action http://host.sonspring.com/handlebbbars

Slide 49

Slide 49 text

@font-face { font-family: 'Open Sans'; // For all good browsers, including IE9. src: url('../fonts/OpenSans-Regular-webfont.woff') format('woff'), // For older IE, and Android default browser. url('../fonts/OpenSans-Regular-webfont.ttf') format('truetype'); } @font-face { font-family: 'Open Sans'; font-weight: bold; // For all good browsers, including IE9. src: url('../fonts/OpenSans-Bold-webfont.woff') format('woff'), // For older IE, and Android default browser. url('../fonts/OpenSans-Bold-webfont.ttf') format('truetype'); } All modern browsers support *.woff or *.ttf

Slide 50

Slide 50 text

http://fontsquirrel.com

Slide 51

Slide 51 text

http://thingsorganizedneatly.tumblr.com/post/9494864300/submission-the-compulsively-tidy-ursus-wehrli CSS served to browser Neatly organized *.sass

Slide 52

Slide 52 text

CSS Sass Compass http://sonspring.com/journal/sass-for-designers

Slide 53

Slide 53 text

http://compass-style.org

Slide 54

Slide 54 text

Compass makes vendor prefixes easy...

Slide 55

Slide 55 text

Compass brings sanity to gradients...

Slide 56

Slide 56 text

Text editors and IDE’s that support Sass/SCSS syntax Aptana http://aptana.org BBEdit http://barebones.com/bbedit Chocolat http://chocolatapp.com Coda http://panic.com/coda E Text Editor http://e-texteditor.com Eclipse http://eclipse.org Emacs http://gnu.org/software/emacs Espresso http://macrabbit.com/espresso GEdit http://projects.gnome.org/gedit Komodo http://activestate.com/komodo-ide Netbeans http://netbeans.org PhpStorm http://jetbrains.com/phpstorm PyCharm http://jetbrains.com/pycharm RubyMine http://jetbrains.com/ruby SubEthaEdit http://codingmonkeys.de/subethaedit Sublime Text http://sublimetext.com/dev TextMate http://macromates.com Vim http://vim.org Visual Studio http://microsoft.com/visualstudio http://sass-lang.com/editors.html ^ We  recommend

Slide 57

Slide 57 text

IE9 gets jQuery, other browsers get Zepto

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

// Redefine: $, window, document, undefined. var APP = (function($, window, document, undefined) { // Expose contents of APP. return { // APP.go go: function() { // ... }, // APP.init init: { // ... }, // APP.util util: { // ... } } // Parameters: Zepto/jQuery, window, document. })(typeof Zepto === 'function' ? Zepto : jQuery, this, this.document); http://host.sonspring.com/handlebbbars/assets/js/application.js Overview of Handlebbbars’ application.js file

Slide 60

Slide 60 text

markup = $('#_template-list-item') .html() .replace(/\s\s+/g, ''); template = Handlebars.compile(markup); Where the magic of Handlebars happens Yes, this looks underwhelming. That’s the point. It’s code you don’t have to write yourself! :) http://host.sonspring.com/handlebbbars/assets/js/application.js

Slide 61

Slide 61 text

Private “constant” variables…

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

Application “skeleton” object…

Slide 64

Slide 64 text

No content

Slide 65

Slide 65 text

Nav shortcuts: J/K keys, swipe left/right…

Slide 66

Slide 66 text

No content

Slide 67

Slide 67 text

Handling “state” changes…

Slide 68

Slide 68 text

Maintaining an app’s state can drive you crazy @MikeTownson dared us to use a “lolcat” — Challenge accepted!

Slide 69

Slide 69 text

No content

Slide 70

Slide 70 text

Pop out external links (for PhoneGap)…

Slide 71

Slide 71 text

No content

Slide 72

Slide 72 text

Rudimentary caching, for one hour…

Slide 73

Slide 73 text

No content

Slide 74

Slide 74 text

Ajax call (JSONP) to Dribbble’s API…

Slide 75

Slide 75 text

No content

Slide 76

Slide 76 text

No content

Slide 77

Slide 77 text

PhoneGap tip: Declare “safe” domains on iOS http://anujgakhar.com/2011/11/22/phonegap-gotcha-error-whitelist-rejection

Slide 78

Slide 78 text

No content

Slide 79

Slide 79 text

Underscore.js is a power tool for working with collections of objects and arrays… — Collections — sortBy — pluck — uniq — extend — flatten — each — filter — find — Utility functions — throttle — chain — times and  much  more!

Slide 80

Slide 80 text

“Real artists ship” — Steve Jobs Hopefully we have inspired you to create more rapidly shippable software today :)

Slide 81

Slide 81 text

Want to reread something? You can get the slides here: http://j.mp/web-skills

Slide 82

Slide 82 text

Questions? We (might) have answers. @mbxtr & @nathansmith If you think of something later, feel free to ask us on Twitter…