Slide 1

Slide 1 text

Mobile and Cross-Platform using web technologies

Slide 2

Slide 2 text

Hello! My name is Misha Reyzlin I’m JavaScript Engineer @SoundCloud

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Why mobile?

Slide 5

Slide 5 text

Why mobile? mobile is huge, really huge

Slide 6

Slide 6 text

Why mobile? mobile is huge, really huge 91% people in the world own mobile device

Slide 7

Slide 7 text

Why mobile? most of our plays come from mobile

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

Mobile?

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

HTML ● accessible, no installs

Slide 13

Slide 13 text

HTML ● accessible, no installs ● one codebase

Slide 14

Slide 14 text

HTML ● accessible, no installs ● one codebase ● no review process

Slide 15

Slide 15 text

Native ● More APIs available

Slide 16

Slide 16 text

Native ● More APIs available ● Performance

Slide 17

Slide 17 text

Native ● More APIs available ● Performance ● Complex UI is easier

Slide 18

Slide 18 text

Phonegap Wraps HTML apps in native, providing access to some APIs

Slide 19

Slide 19 text

HTML & Native They compliment each other: ● Hit URL and listen to sound ● Download app, do more complex interactions

Slide 20

Slide 20 text

Standards In 2007 iPhone came out with support for rich media and No Flash

Slide 21

Slide 21 text

Standards Google:

Slide 22

Slide 22 text

Standards Microsoft: pointer events, mixed input – touch and mouse

Slide 23

Slide 23 text

Standards Mozilla: A lot of general enhancements to JavaScript

Slide 24

Slide 24 text

Standards Mozilla: A lot of general enhancements to JavaScript

Slide 25

Slide 25 text

How is SoundCloud built?

Slide 26

Slide 26 text

History (2005) ● user types URL ● Apache+PHP parse req. ● Query DB ● print HTML as response

Slide 27

Slide 27 text

History (2005) ● browser renders HTML ● fetches resources (JS, CSS) ● JS enhances UX

Slide 28

Slide 28 text

History (2006) ● Prototype.JS with $ function ● YUI ● jQuery

Slide 29

Slide 29 text

$('.images').beautifulGallery(); $('.navigation a').each(function (link) { link.click(function (event) { event.preventDefault(); $('.animated').animate({ top: '-100px' }, 500); }); });

Slide 30

Slide 30 text

$('.images').beautifulGallery(); $('.navigation a').each(function (link) { link.click(function (event) { event.preventDefault(); $('.animated').animate({ top: '-100px' }, 500); }); });

Slide 31

Slide 31 text

$('.images').beautifulGallery(); $('.navigation a').each(function (link) { link.click(function (event) { event.preventDefault(); $('.animated').animate({ top: '-100px' }, 500); }); });

Slide 32

Slide 32 text

● Desire to match application performance ● No hard page refreshes ● AJAX History (2007)

Slide 33

Slide 33 text

● init state from URL ● HTTP requests to API ● render HTML from the API data Move to JS

Slide 34

Slide 34 text

● lack of modules & dependency management ● testability and isolating units ● no separation of concerns ● memory management How to write JS?

Slide 35

Slide 35 text

"Pro JavaScript Design Patterns" Creation of objects, architecture, behaviour Solutions (2007)

Slide 36

Slide 36 text

● Massive UI frameworks (sproutcore, EXT.js) ● Compiled (Objective-J and GWT) ● Rich widget libs (YUI, DOJO, jQuery plugins) Solutions (2008-09)

Slide 37

Slide 37 text

Lightweight framework promoted MVC pattern for UI development (on the client side) Backbone (2010)

Slide 38

Slide 38 text

The main idea is separation of concerns MVC

Slide 39

Slide 39 text

Model and View types implement pub/sub pattern Backbone MVC

Slide 40

Slide 40 text

var model = new Model(); var view = new View(model); // in View::constructor model.on( ‘change’, view.render );

Slide 41

Slide 41 text

var model = new Model(); var view = new View(model); // in View::constructor model.on( ‘change’, view.render );

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

Thank you [email protected] http://twitter.com/gryzzly