mobl

94
mobl Zef Hemel

description

mobl is a new language for the development of mobile applications using web technologies.

Transcript of mobl

Page 1: mobl

moblZef Hemel

Page 2: mobl
Page 3: mobl

50 million

iPhones

Page 4: mobl

50 million

iPhones

20 million

iPod Touches

Page 5: mobl

50 million

iPhones

20 million

iPod Touches

100 million

Page 6: mobl
Page 7: mobl

1.5 million

G1

Page 8: mobl

1.5 million

G1

1.2 million

Droid

Page 9: mobl

1.5 million

G1

1.2 million

Droid

2013

Page 10: mobl
Page 11: mobl

applicationdevelopment

Page 12: mobl

Objective-C

Page 13: mobl

Objective-C Java

Page 14: mobl

Objective-C Java J2ME/C++

Page 15: mobl

Objective-C Java J2ME/C++

HTML/Javascript

Page 16: mobl

Objective-C Java J2ME/C++

HTML/Javascript Java

Page 17: mobl
Page 18: mobl

Objective-C

Android Java

Blackberry Java

J2ME

HTML/JS

Page 19: mobl
Page 20: mobl

3.3.1

Page 21: mobl

3.3.1 – Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs. Applications must be originally written in Objective-C, C, C++, or JavaScript as executed by the iPhone OS WebKit engine, and only code written in C, C++, and Objective-C may compile and directly link against the Documented APIs (e.g., Applications that link to Documented APIs through an intermediary translation or compatibility layer or tool are prohibited).

Page 22: mobl

3.3.1 – Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs. Applications must be originally written in Objective-C, C, C++, or JavaScript as executed by the iPhone OS WebKit engine, and only code written in C, C++, and Objective-C may compile and directly link against the Documented APIs (e.g., Applications that link to Documented APIs through an intermediary translation or compatibility layer or tool are prohibited).

Page 23: mobl
Page 24: mobl
Page 25: mobl

AppStore

Page 26: mobl
Page 27: mobl
Page 28: mobl

cross-platform development

arbitrary rejections

language expressivity

Page 29: mobl

mobl

Page 30: mobl
Page 31: mobl
Page 32: mobl
Page 33: mobl
Page 34: mobl
Page 35: mobl
Page 36: mobl
Page 37: mobl

Webkit

Page 38: mobl

HTML

Page 39: mobl

WebDatabases

WebDatabases

Page 40: mobl

WebDatabases

Location information (GPS)

WebDatabases

Page 41: mobl

WebDatabases

Location information (GPS)

Threading

WebDatabases

Page 42: mobl

WebDatabases

Location information (GPS)

Threading

Canvas

WebDatabases

Page 43: mobl

WebDatabases

Location information (GPS)

Threading

Canvas

WebDatabases

Multi-touch

Page 44: mobl

WebDatabases

Location information (GPS)

Threading

Canvas

WebDatabases

Multi-touch

Offline support

Page 45: mobl

WebDatabases

Location information (GPS)

Threading

Canvas

WebDatabases

Multi-touch

Offline support

Full-screen support

Page 46: mobl

We believe the web has won and over the next several years, the browser [..] will become the platform that matters and certainly that’s where Google is investing.

“ ”Vic Gundotra, Google VP of Engineering

Page 47: mobl
Page 48: mobl
Page 49: mobl

syntax similar to

Page 50: mobl

demo

Page 51: mobl

entity Task { name : String (searchable) done : Bool tags : Collection<Tag> (inverse: tasks)}

entity Tag { name : String (searchable) tasks : Collection<Task> (inverse: tags)}

Page 52: mobl

function sayHello(name : String) { alert("Hello there, " + name);}

Page 53: mobl

screen root() { basicView("Tasks") { group { list(t in Task.all()) { item { label(t.name) } } } }}

Page 54: mobl

screen prompt(question : String) : String { var answer = "" header(question) group { inputString(answer) } button("Done", onclick={ screen return answer; })}

Page 55: mobl

screen root() { var firstName = prompt("First name?") var lastName = prompt("Last name?") header("Hello there") label("Hello, " + firstName + " " + lastName)}

Page 56: mobl

data binding

Page 57: mobl

var s = ""<span databind=s/>button("Set s", onclick={ s = "Hello";})

Page 58: mobl

template label(t : String) { <span databind=t/>}...var s = ""label(s)button("Set s", onclick={ s = "Hello";})

Page 59: mobl

two-way binding

<span databind=s/><input type="text" databind=s/>

Page 60: mobl

reactive/dataflow programming

Page 61: mobl

demo

Page 62: mobl

screen root() { var amount = 10 var percentage = 10 var total = amount * (1 + percentage/100)

header("Tip calculator") group { inputNumber(amount, label="amount") inputNumber(percentage, label="%") label(total) }}

Page 63: mobl

demo

Page 64: mobl

implementation

Page 65: mobl

HTML/Javascript

Page 66: mobl

<span>64</span>

Page 67: mobl

<span>64</span>

span

64

CSS stylesevents- onclick

Page 68: mobl

var myspan = $("<span>");myspan.text("64");anotherEl.append(myspan);

Page 69: mobl

sync vs async

Page 70: mobl

var results = tx.executeQuery("SELECT * FROM Task");for(var i = 0; i < results.length; i++) { alert(results[i].name);}

synchronous programming

Page 71: mobl

render page

query database and process

results

...

time

Page 72: mobl

render page

query database and process

results

...

timebrowser freeze

Page 73: mobl

render page

send query

...

process query result

...

time

Page 74: mobl

tx.executeQuery("SELECT * FROM Task", function(results) { for(var i = 0; i < results.length; i++) { alert(results[i].name); } });...

asynchronous programming

Page 75: mobl

tx.executeQuery("SELECT * FROM Task", function(results) { alert("Hello, "); });alert("world!");

Page 76: mobl

tx.executeQuery("SELECT * FROM Task", function(results) { tx.executeQuery("INSERT ...", function() { alert("Selected, then inserted"); }); });

Page 77: mobl

continuation-passing styletransformation

Page 78: mobl

function displayLocationAndReturn() : Coordinates { var position = mobl::location::getPosition(); alert("Lat: " + position.latitude); alert("Long: " + position.longitude); return position;}

Page 79: mobl

function displayLocationAndReturn() : Coordinates { var position = mobl::location::getPosition(); alert("Lat: " + position.latitude); alert("Long: " + position.longitude); return position;}

function displayLocationAndReturn(callback) { mobl.location.getPosition(function(result) { var position = result; alert("Lat: " + position.latitude); alert("Long: " + position.longitude); callback(position); });};

Page 80: mobl

function displayLocationAndReturn() : Coordinates { var position = mobl::location::getPosition(); alert("Lat: " + position.latitude); alert("Long: " + position.longitude); return position;}

function displayLocationAndReturn(callback) { mobl.location.getPosition(function(result) { var position = result; alert("Lat: " + position.latitude); alert("Long: " + position.longitude); callback(position); });};

Page 81: mobl

function displayLocationAndReturn() : Coordinates { var position = mobl::location::getPosition(); alert("Lat: " + position.latitude); alert("Long: " + position.longitude); return position;}

function displayLocationAndReturn(callback) { mobl.location.getPosition(function(result) { var position = result; alert("Lat: " + position.latitude); alert("Long: " + position.longitude); callback(position); });};

Page 82: mobl

reactive programming

Page 83: mobl

screen root() { var n = 8 label(n * n) button("Inc", onclick={ n = n + 1; })}

Page 84: mobl

var n = 8

var n = ref(8);

Page 85: mobl

var n = 8

var n = ref(8);

Observable- set(value)- get()- addEventListener(eventType, callback)

Page 86: mobl

label(n * n)

var node565 = $("<span>");node565.text(n.get() * n.get());n.addEventListener("change", function() { node565.text(n.get() * n.get());});root.append(node565);

Page 87: mobl

button("Inc", onclick={ n = n + 1;})

var nodes566 = $("<span class='button'>");node566.text("Inc");node566.click(function() { n.set(n.get() + 1);});root.append(node566);

Page 88: mobl

screen root() { var n = 8 label(n * n) button("Inc", onclick={ n = n + 1; })}

Page 89: mobl

screen root() { var n = 8 label(n * n) button("Inc", onclick={ n = n + 1; })}

Page 90: mobl

screen root() { var n = 8 label(n * n) button("Inc", onclick={ n = n + 1; })}

Page 91: mobl

conclusion

Page 92: mobl

many mobile platforms

HTML5/JS

avoid AppStore approval

Page 93: mobl

mobl

statically-typed WebDSL-like language

generates HTML/JS

CPS transform/reactive programming