124
Zef Hemel http://www.mobl-lang.org

mobl presentation @ IHomer

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: mobl presentation @ IHomer

Zef Hemel

http://www.mobl-lang.org

Page 2: mobl presentation @ IHomer
Page 3: mobl presentation @ IHomer

230,000 300,000

Page 4: mobl presentation @ IHomer
Page 5: mobl presentation @ IHomer

Objective-C Java J2ME/C++

HTML/Javascript Java .NET

Page 6: mobl presentation @ IHomer

portability

Page 7: mobl presentation @ IHomer
Page 8: mobl presentation @ IHomer
Page 9: mobl presentation @ IHomer

productivity

Page 10: mobl presentation @ IHomer

Reqs 10101

Page 11: mobl presentation @ IHomer

Reqs 10101asm

Page 12: mobl presentation @ IHomer

Reqs 10101asmC/C++

’70-’80

Page 13: mobl presentation @ IHomer

Reqs 10101asmC/C++

’70-’80

3rd genJava/C#

’90-’10

Page 14: mobl presentation @ IHomer

Reqs 10101asmC/C++

’70-’80

3rd genJava/C#

’90-’10

DSLs

Page 15: mobl presentation @ IHomer

MoDSE

Page 16: mobl presentation @ IHomer

Objective-C Java J2ME/C++

HTML/Javascript Java .NET

Page 17: mobl presentation @ IHomer

Webkit browser Webkit browser J2ME/C++

Webkit browser Webkit browser .NET

Page 18: mobl presentation @ IHomer
Page 19: mobl presentation @ IHomer

WebDatabases

Page 20: mobl presentation @ IHomer

WebDatabases

Location information (GPS)

Page 21: mobl presentation @ IHomer

WebDatabases

Location information (GPS)

Canvas

Page 22: mobl presentation @ IHomer

WebDatabases

Location information (GPS)

Canvas

Multi-touch

Page 23: mobl presentation @ IHomer

WebDatabases

Location information (GPS)

Canvas

Multi-touch

Offline support

Page 24: mobl presentation @ IHomer

WebDatabases

Location information (GPS)

Canvas

Multi-touch

Offline support

Full-screen support

Page 25: mobl presentation @ IHomer

WebDatabases

Location information (GPS)

Canvas

Multi-touch

Offline support

Full-screen support

Accelerator support

Page 26: mobl presentation @ IHomer

WebDatabases

Location information (GPS)

Canvas

Multi-touch

Offline support

Full-screen support

Accelerator support

Audio

Page 27: mobl presentation @ IHomer
Page 28: mobl presentation @ IHomer

Address book

Page 29: mobl presentation @ IHomer

Address book

Camera

Page 30: mobl presentation @ IHomer

Address book

Camera

Compass

Page 31: mobl presentation @ IHomer

Address book

Camera

Compass

File IO

Page 32: mobl presentation @ IHomer

Address book

Camera

Compass

File IO

Notifications

Page 33: mobl presentation @ IHomer
Page 34: mobl presentation @ IHomer

annotated HTML

Page 35: mobl presentation @ IHomer

annotated HTML

imperative Javascript

Page 36: mobl presentation @ IHomer
Page 37: mobl presentation @ IHomer

declarativetyped

integrated concise

Page 38: mobl presentation @ IHomer
Page 39: mobl presentation @ IHomer
Page 40: mobl presentation @ IHomer
Page 41: mobl presentation @ IHomer
Page 42: mobl presentation @ IHomer

mobl program

Page 43: mobl presentation @ IHomer

user interface

styling

data modeling

application logic

web services

Page 44: mobl presentation @ IHomer

user interface

Page 45: mobl presentation @ IHomer

demo

Page 46: mobl presentation @ IHomer

screen name(farg*) : ReturnType? { screenelem*}

control name(farg*) { screenelem*}

ui syntax

Page 47: mobl presentation @ IHomer

control calls

variable declarations

inline HTML

script blocks

control structures

Page 48: mobl presentation @ IHomer

button("Click me")

control calls

Page 49: mobl presentation @ IHomer

button("Click me")

button("Click me", { alert("Click!");})

control calls

Page 50: mobl presentation @ IHomer

button("Click me")

button("Click me", { alert("Click!");})

button("Click me", onclick={ alert("Click!");})

control calls

Page 51: mobl presentation @ IHomer

group() { item() { "Item 1" } item() { "Item 2" }}

control calls with body

Page 52: mobl presentation @ IHomer

group { item { "Item 1" } item { "Item 2" }}

control calls with body

Page 53: mobl presentation @ IHomer

variable declarations

var b = true

Page 54: mobl presentation @ IHomer

variable declarations

var b = truevar b : Bool = true

Page 55: mobl presentation @ IHomer

variable declarations

var b = true

var newTask = Task()

var b : Bool = true

Page 56: mobl presentation @ IHomer

variable declarations

var b = true

var newTask = Task()

var b : Bool = true

var newTask : Task = Task()

Page 57: mobl presentation @ IHomer

when

var b = true

checkBox(b)

when(b) { label("Yep")} else { label("Nope")}

Page 58: mobl presentation @ IHomer

list

var nums = [1, 2, 3]

group { list(n in nums) { item { label(n) } }}

Page 59: mobl presentation @ IHomer

inline HTML

<img src="img/icon.png"/>

Page 60: mobl presentation @ IHomer

inline HTML

<img src="img/icon.png"/>

<div class=selected ? selectedStyle : notSelectedStyle> ...</div>

Page 61: mobl presentation @ IHomer

script blocks

var n = -1script { n = Math.sqrt(9);}

avoid if possible

Page 62: mobl presentation @ IHomer

higher-order controls

Page 63: mobl presentation @ IHomer

controls taking controlsas arguments

confused yet?

Page 64: mobl presentation @ IHomer

demo

Page 65: mobl presentation @ IHomer

styling

Page 66: mobl presentation @ IHomer

style bigAndBlue { color: blue; font-size: 40px;}

Page 67: mobl presentation @ IHomer

style bigAndBlue { color: blue; font-size: 40px;}

Style

Page 68: mobl presentation @ IHomer

control block(style : Style) { ...}

block(bigAndBlueStyle) { label("I am big and blue!");}

Page 69: mobl presentation @ IHomer

style $baseColor = rgb(100, 100, 100)

style myStyle { color: rgb($baseColor.r+10, $baseColor.g+50, $baseColor.b~20); font-size: 20px;}

Page 70: mobl presentation @ IHomer

style mixin borderRadiusMixin($radius) { -moz-border-radius: $radius; -webkit-border-radius: $radius; border-radius: $radius;}

Page 71: mobl presentation @ IHomer

style mixin borderRadiusMixin($radius) { -moz-border-radius: $radius; -webkit-border-radius: $radius; border-radius: $radius;}

style myStyle { color: $baseColor; borderRadiusMixin(10px);}

Page 72: mobl presentation @ IHomer

demo

Page 73: mobl presentation @ IHomer

data modeling& query

Page 74: mobl presentation @ IHomer

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

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

Page 75: mobl presentation @ IHomer

var newTask = Task(name="New task");newTask.done = false;add(newTask);

Page 76: mobl presentation @ IHomer

var doneTasks = Task.all()

Page 77: mobl presentation @ IHomer

var doneTasks = Task.all()

Collection<Task>

Page 78: mobl presentation @ IHomer

var doneTasks = Task.all()

Collection<Task>

.filter("done", "=", true)

.order("date", false)

.limit(10);

Page 79: mobl presentation @ IHomer

var tagDoneTasks = tag.tasks .filter("done", "=", true) .order("date", false) .limit(10);

Collection<Task>

Page 80: mobl presentation @ IHomer

var doneTasks = Task.all()

Collection<Task>

Page 81: mobl presentation @ IHomer

var doneTasks = Task.all()

Collection<Task>

where done == trueorder by date desclimit 10;

Page 82: mobl presentation @ IHomer

var tagDoneTasks = tag.tasks where done == true order by date desc limit 10;

Collection<Task>

Page 83: mobl presentation @ IHomer

var searchTasks = Task.search("task") where done == true limit 10;

Collection<Task>

Page 84: mobl presentation @ IHomer

screen root() { header("Tasks") group { list(t in Task.all() order by date desc) { item { label(t.name) } } }}

Page 85: mobl presentation @ IHomer

applicationlogic

Page 86: mobl presentation @ IHomer

label("Total tasks: " + Task.all().count())

logic in ui

Page 87: mobl presentation @ IHomer

button("Click me", onclick={ alert("You clicked me!");})

label("Total tasks: " + Task.all().count())

logic in ui

Page 88: mobl presentation @ IHomer

var n = 7;var n2 = Math.round(n/2);

if(n2 > 3) { alert("More than three!");} else { alert("Less than three!");}

Page 89: mobl presentation @ IHomer

var n = 7;var n2 = Math.round(n/2);

if(n2 > 3) { alert("More than three!");} else { alert("Less than three!");}

type inference

Page 90: mobl presentation @ IHomer

var done = 0;foreach(t in Task.all()) { if(t.done) { done = done + 1; }}

Page 91: mobl presentation @ IHomer

var done = 0;foreach(t in Task.all()) { if(t.done) { done = done + 1; }}

var done = (Task.all() where done == true) .count();

Page 92: mobl presentation @ IHomer

function sqr(n : Num) : Num { return n * n;}

Page 93: mobl presentation @ IHomer

demo: todo list

Page 94: mobl presentation @ IHomer

web serviceaccess

Page 95: mobl presentation @ IHomer

service SomeService { resource tasks() : JSON { uri = "/tasks" }

resource search(query : String) : JSON { uri = "/search?q=" + escape(query) }}

Page 96: mobl presentation @ IHomer

service Twitter { resource trends() : JSON { uri = "http://api.twitter.com/1/trends.json" encoding = "jsonp" }

resource search(query : String) : JSON { uri = "http://search.twitter.com/search.json?q=" + escape(query) encoding = "jsonp" }}

Page 97: mobl presentation @ IHomer

{"trends": [{"url":"http://search.twitter.com/search?q=...", "name":"#ihaveadream"}, {"url":"http://search.twitter.com/search?q=...", "name":"#mlkday"} ... ]}

http://api.twitter.com/1/trends.json

Page 98: mobl presentation @ IHomer

type Trend { name : String url : String}

function trendsMapper(json : JSON) : [Trend] { return json.trends;}

Page 99: mobl presentation @ IHomer

resource trends() : JSON { uri = "http://api.twitter.com/1/trends.json" encoding = "jsonp" mapper = trendsMapper}

Page 100: mobl presentation @ IHomer

screen root() { var trends = Twitter.trends()

header("Twitter trends") group { list(topic in trends) { item { label(topic.name) } } }}

Page 101: mobl presentation @ IHomer

demo: twitter trends

Page 102: mobl presentation @ IHomer

user interface

styling

data modeling

application logic

web services

Page 103: mobl presentation @ IHomer

the glass ceiling

Page 104: mobl presentation @ IHomer

language small

library large (and extensible)

Page 105: mobl presentation @ IHomer

how?

- built-in types- built-in controls

Page 106: mobl presentation @ IHomer

how?

- built-in types- built-in controls

+ native interface+ sufficiently low-level primitives+ abstraction mechanisms (screens, controls, functions, types)

Page 107: mobl presentation @ IHomer

native interface

external type String : Object { length : Num sync function charAt(index : Num) : String sync function charCodeAt(index : Num) : Num ...}

external control html(h : String)external screen bla() : voidexternal function log(o : Object) : void

Page 108: mobl presentation @ IHomer

control image(url : String, onclick : Callback = null) { <img src=url onclick=onclick/>}

low-level primitives

Page 109: mobl presentation @ IHomer

control slideupBlock() { div@<div onclick={ div.slideUp(); }> elements() </div>}

...

slideupBlock { label("Click me to slide up")}

low-level primitives

Page 110: mobl presentation @ IHomer

control slideupBlock() { div@<div onclick={ div.slideUp(); }> elements() </div>}

...

slideupBlock { label("Click me to slide up")}

low-level primitives

JQuery

Page 111: mobl presentation @ IHomer

mobl::test

Page 112: mobl presentation @ IHomer

deployment

Page 113: mobl presentation @ IHomer

deployment

pure client-side

Page 114: mobl presentation @ IHomer
Page 115: mobl presentation @ IHomer
Page 116: mobl presentation @ IHomer

code concatenation

Page 117: mobl presentation @ IHomer

code concatenation

dead-code elimination

Page 118: mobl presentation @ IHomer

code concatenation

dead-code elimination

code minification

Page 119: mobl presentation @ IHomer

public release: jan 6, 2011

state of the

Page 120: mobl presentation @ IHomer

public release: jan 6, 2011

state of the

11 releases

Page 121: mobl presentation @ IHomer

public release: jan 6, 2011

state of the

11 releases

1000+ visitors/day

Page 122: mobl presentation @ IHomer

public release: jan 6, 2011

state of the

11 releases

1000+ visitors/day

first external commits are in

Page 123: mobl presentation @ IHomer

future

documentation

data evolution

libraries

error handling