SlideShare uma empresa Scribd logo
1 de 71
Baixar para ler offline
Slides from keynote at MOSE 2010, Malaga, June 29, 2010




          Zef Hemel             Eelco Visser


        @mobllang @zef @eelcovisser
WebDSL




  Domain-Specific
Language Engineering

SDF    Spoofax   Stratego
domain:
mobile applications
50 million    20 million


 iPhones     iPod Touches
1.5 million             1.2 million

    G1                       Droid


     outsells iPhone in US
application
development
Objective-C        Java          J2ME/C++




 HTML/Javascript          Java
Objective-C


Android Java

Blackberry
Java
J2ME

HTML/JS
3.3.1
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).
AppStore
cross-platform development


   arbitrary rejections


we want high-level models
Webkit
HTML
WebDatabases
                 Full-screen support
Location information
       (GPS)
                       Offline support
         Canvas

  Multi-touch            Threading
“   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
syntax similar to
data model
  user interface
      script
web service access
data model
entity Task {
  name        : String (searchable)
  done        : Bool
  dueDate     : DateTime
}
entity Task {
  name          :   String (searchable)
  done          :   Bool
  dueDate       :   DateTime
  categories    :   Collection<Category>
}

entity Category {
  name        : String
  tasks       : Collection<Task> (inverse: categories)
}
user interface
screen root() {
  header("Todo")
  group {
    list(t in Task.all()) {
      item {
        checkbox(t.done)
        " "
        label(t.name)
      }
    }
  }
}
screen root() {
  header("Todo")
  topButton("Add", onclick={
     addTask();
  })
  group {
     list(t in Task.all()) {
       item {
         checkbox(t.done)
         " "
         label(t.name)
       }
     }
  }
}
screen addTask() {
  var newTask = Task {
    done = false,
    dueDate = now()
  }

    header("Add")
    backButton("Back", onclick={
       screen return;
    })
    group {
       item { textField(newTask.name) }
       item { datePicker(newTask.dueDate) }
    }
    button("Add", onclick={
       add(newTask);
       screen return;
    })
}
screen root() {
  header("Todo")
  topButton("Add", onclick={
     addTask();
  })
  group {
     list(t in Task.all()) {
       item {
         checkbox(t.done)
         " "
         label(t.name)
       }
     }
  }
}
screen root() {
  var query = ""

    header("Todo")
    topButton("Add", onclick={
      addTask();
    })
    searchBox(query)
    group {
       list(t in Task.search(query)) {
         item {
           checkbox(t.done)
           " "
           label(t.name)
         }
      }
    }
}
scripting
function cleanDoneTasks() : Num {
  var removed = 0;
  for(t in Task.all()) {
    if(t.done) {
      remove(t);
      removed = removed + 1;
    }
  }
  return removed;
}
data binding
one-way


var n = 0

label(n)

button("Up", onclick={
   n = n + 1;
})
two-way


var n = 0

inputNum(n)
label(n)
reactive/dataflow programming
var amount = 10
var percentage = 10
var total <- amount *
  (1 + percentage/100)

inputNum(amount)
inputNum(percentage)
label(total)
web services
http://api.stackoverflow.com/0.8/questions?answers=true&body=true

{
    "total": 746646,
    "page": 1,
    "pagesize": 30,
    "questions": [
      {
        "tags": ["string", "assembly", "arm"],
        "answers": [],
        "question_id": 3092029,
        "owner": {
          "user_id": 320124,
          "user_type": "registered",
          "display_name": "SoulBeaver",
          "reputation": 195
        },
        "creation_date": 1277200629,
        "score": 0,
        "title": "ARM - Infinite Loop While Searching String",
        "body": "...",
        ...
      },
      ...
    ]
}
{
    "total": 746646,
    "page": 1,
    "pagesize": 30,
    "questions": [
      {
         "tags": ["string", "assembly", "arm"],
         "answers": [],
         "question_id": 3092029,
         "owner": {
            "user_id": 320124,
            "user_type": "registered",
            "display_name": "SoulBeaver",
            "reputation": 195
         },
         "creation_date": 1277200629,
         "score": 0,
         "title": "ARM - Infinite Loop While Searching String",
         "body": "...",
         ...
      },
      ...
    ]
}
                                              external type   QuestionsResultSet {
                                                total     :   Num
                                                page      :   Num
                                                pagesize :    Num
                                                questions :   Array<QuestionResult>
                                              }
{
    "tags": ["string", "assembly", "arm"],
    "answers": [],
    "question_id": 3092029,
    "owner": {
       "user_id": 320124,
       "user_type": "registered",
       "display_name": "SoulBeaver",
       "reputation": 195
    },
    "creation_date": 1277200629,
    "score": 0,
    "title": "ARM - Infinite Loop While Searching String",
    "body": "...",
    ...
}



                                            external type QuestionResult {
                                              tags          : Array<String>
                                              answers       : Array<AnswerResult>
                                              owner         : OwnerResult
                                              creation_date : Num
                                              ...
                                            }
service StackOverflow {
  root = "http://api.stackoverflow.com/0.8"
  resource questions(answers : Bool, body : Bool) : QuestionsResultSet {
    uri = "/questions"
    method = "GET"
    encoding = "json"
  }
  ...
}
function fetchQuestions() {
  var res = StackOverflow.questions(answers=true, body=true);
  for(question : QuestionResult in res.questions) {
    mapQuestion(question);
  }
}
entity Question {
  questionId   : Num
  title        : String
  body         : Text
  answers      : Collection<Answer> (inverse: question)
  creationDate : DateTime
  owner        : User
}

entity Answer {
  question        :   Question
  answerId        :   Num
  owner           :   User
  body            :   Text
}

entity User {
  userId     : Num
  name       : String
  reputation : Num
}
function mapQuestion(qr : QuestionResult) : Question {
  var q : Question = cachedQuestion(remote.question_id);
  if(q == null) {
    q = Question {
       questionId = qr.question_id,
       title = qr.title,
       body = qr.body,
       answers = mapAnswers(qr.answers),
       creationDate = DateTime.fromTimestamp(qr.creation_date),
       owner = mapUser(qr.owner)
    };
    add(q);
  }
  return q;
}
implementation
mobl code



   parse


   check


  desugar


 generate
   code


HTML/Javascript
entity Task {
          name        : String (searchable)
          done        : Bool
          dueDate     : DateTime
        }



                             Javascript using
                             persistence.js
                               HTML5 ORM


tasks.Task = persistence.define('tasks__Task', {
  'name': 'TEXT',
  'done': 'BOOL',
  'dueDate': 'DATE'
});
tasks.Task.textIndex('name');
screen root() {
                header("Todo")
                ...
              }



                           Javascript functions
                              building DOM


tasks.root = function(callback, screenCallback) {
   var root1018 = $("<div>");
   mobl.header(ref("Todo"), function(node) {
     root1018.append(node);
     ...
   });
};
function cleanDoneTasks() : Num {
       var removed = 0;
       for(t in Task.all()) {
         if(t.done) {
           remove(t);
           removed = removed + 1;
         }
       }
       return removed;
     }




tasks.cleanDoneTasks = function() {
  var removed = 0;
  var results = Task.all();
  for(var i = 0; i < results.length; i++) {
    var t = results[i];
    if(t.done) {
      remove(t);
      removed = removed + 1;
    }
  }
  return removed;
}
function cleanDoneTasks() : Num {
        var removed = 0;
        for(t in Task.all()) {
          if(t.done) {
            remove(t);
            removed = removed + 1;
          }
        }
        return removed;
      }




tasks.cleanDoneTasks = function() {
   var removed = 0;
   var results = Task.all();
   for(var i = 0; i < results.length; i++) {
     var t = results[i];
     if(t.done) {
       remove(t);
       removed = removed + 1;
     }
   }
   return removed;
};
tasks.cleanDoneTasks = function() {
   var removed = 0;
   var results = Task.all();
   for(var i = 0; i < results.length; i++) {
     var t = results[i];
     if(t.done) {
       remove(t);
       removed = removed + 1;
     }
   }
   return removed;
};

                             continuation-passing
                               style transform
tasks.cleanDoneTasks = function(callback) {
   var removed = 0;
   Task.all(function(results) {
     for(var i = 0; i < results.length; i++) {
       var t = results[i];
       if(t.done) {
         remove(t);
         removed = removed + 1;
       }
     }
     callback(removed);
   });
};
reactive programming
screen root() {
  var n = 8
  label(n * n)
  button("Inc", onclick={
     n = n + 1;
  })
}
var n = 8



       var n = ref(8);

Observable
- set(value)
- get()
- addEventListener(eventType, callback)
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);
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);
screen root() {
  var n = 8
  label(n * n)
  button("Inc", onclick={
     n = n + 1;
  })
}
conclusion
many mobile platforms


      HTML5/JS


avoid AppStore approval
statically-typed WebDSL-like language


        generates HTML/JS


CPS transform/reactive programming
get it?

http://mobl-lang.org




 http://spoofax.org

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

The Ring programming language version 1.5.1 book - Part 43 of 180
The Ring programming language version 1.5.1 book - Part 43 of 180The Ring programming language version 1.5.1 book - Part 43 of 180
The Ring programming language version 1.5.1 book - Part 43 of 180
 
Functional Scala 2020
Functional Scala 2020Functional Scala 2020
Functional Scala 2020
 
JDD 2016 - Pawel Byszewski - Kotlin, why?
JDD 2016 - Pawel Byszewski - Kotlin, why?JDD 2016 - Pawel Byszewski - Kotlin, why?
JDD 2016 - Pawel Byszewski - Kotlin, why?
 
Rデバッグあれこれ
RデバッグあれこれRデバッグあれこれ
Rデバッグあれこれ
 
The Ring programming language version 1.10 book - Part 39 of 212
The Ring programming language version 1.10 book - Part 39 of 212The Ring programming language version 1.10 book - Part 39 of 212
The Ring programming language version 1.10 book - Part 39 of 212
 
The Ring programming language version 1.8 book - Part 50 of 202
The Ring programming language version 1.8 book - Part 50 of 202The Ring programming language version 1.8 book - Part 50 of 202
The Ring programming language version 1.8 book - Part 50 of 202
 
The Ring programming language version 1.8 book - Part 75 of 202
The Ring programming language version 1.8 book - Part 75 of 202The Ring programming language version 1.8 book - Part 75 of 202
The Ring programming language version 1.8 book - Part 75 of 202
 
The Ring programming language version 1.4.1 book - Part 12 of 31
The Ring programming language version 1.4.1 book - Part 12 of 31The Ring programming language version 1.4.1 book - Part 12 of 31
The Ring programming language version 1.4.1 book - Part 12 of 31
 
The Ring programming language version 1.10 book - Part 22 of 212
The Ring programming language version 1.10 book - Part 22 of 212The Ring programming language version 1.10 book - Part 22 of 212
The Ring programming language version 1.10 book - Part 22 of 212
 
The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31
 
The Ring programming language version 1.5.2 book - Part 29 of 181
The Ring programming language version 1.5.2 book - Part 29 of 181The Ring programming language version 1.5.2 book - Part 29 of 181
The Ring programming language version 1.5.2 book - Part 29 of 181
 
[2019-07] GraphQL in depth (serverside)
[2019-07] GraphQL in depth (serverside)[2019-07] GraphQL in depth (serverside)
[2019-07] GraphQL in depth (serverside)
 
The Ring programming language version 1.5.3 book - Part 40 of 184
The Ring programming language version 1.5.3 book - Part 40 of 184The Ring programming language version 1.5.3 book - Part 40 of 184
The Ring programming language version 1.5.3 book - Part 40 of 184
 
Rのスコープとフレームと環境と
Rのスコープとフレームと環境とRのスコープとフレームと環境と
Rのスコープとフレームと環境と
 
The Ring programming language version 1.4 book - Part 8 of 30
The Ring programming language version 1.4 book - Part 8 of 30The Ring programming language version 1.4 book - Part 8 of 30
The Ring programming language version 1.4 book - Part 8 of 30
 
The Ring programming language version 1.9 book - Part 53 of 210
The Ring programming language version 1.9 book - Part 53 of 210The Ring programming language version 1.9 book - Part 53 of 210
The Ring programming language version 1.9 book - Part 53 of 210
 
The Ring programming language version 1.5.1 book - Part 36 of 180
The Ring programming language version 1.5.1 book - Part 36 of 180The Ring programming language version 1.5.1 book - Part 36 of 180
The Ring programming language version 1.5.1 book - Part 36 of 180
 
The Ring programming language version 1.6 book - Part 46 of 189
The Ring programming language version 1.6 book - Part 46 of 189The Ring programming language version 1.6 book - Part 46 of 189
The Ring programming language version 1.6 book - Part 46 of 189
 
D3.js workshop
D3.js workshopD3.js workshop
D3.js workshop
 
The Ring programming language version 1.10 book - Part 43 of 212
The Ring programming language version 1.10 book - Part 43 of 212The Ring programming language version 1.10 book - Part 43 of 212
The Ring programming language version 1.10 book - Part 43 of 212
 

Destaque

Destaque (9)

Programming languages shape computational thinking
Programming languages shape computational thinkingProgramming languages shape computational thinking
Programming languages shape computational thinking
 
Strategies for Rule-Based Program Transformation
Strategies for Rule-Based Program TransformationStrategies for Rule-Based Program Transformation
Strategies for Rule-Based Program Transformation
 
Grammarware Memes
Grammarware MemesGrammarware Memes
Grammarware Memes
 
Code Generation
Code GenerationCode Generation
Code Generation
 
Online partial evaluation
Online partial evaluationOnline partial evaluation
Online partial evaluation
 
Automating Feedback & Assessment in WebLab
Automating Feedback & Assessment in WebLabAutomating Feedback & Assessment in WebLab
Automating Feedback & Assessment in WebLab
 
A Language Designer’s Workbench. A one-stop shop for implementation and verif...
A Language Designer’s Workbench. A one-stop shop for implementation and verif...A Language Designer’s Workbench. A one-stop shop for implementation and verif...
A Language Designer’s Workbench. A one-stop shop for implementation and verif...
 
Generative Software Development. Overview and Examples
Generative Software Development. Overview and ExamplesGenerative Software Development. Overview and Examples
Generative Software Development. Overview and Examples
 
Model-Driven Software Development - Context-Sensitive Transformation
Model-Driven Software Development - Context-Sensitive TransformationModel-Driven Software Development - Context-Sensitive Transformation
Model-Driven Software Development - Context-Sensitive Transformation
 

Semelhante a mobl

mobl presentation @ IHomer
mobl presentation @ IHomermobl presentation @ IHomer
mobl presentation @ IHomer
zefhemel
 
mobl - model-driven engineering lecture
mobl - model-driven engineering lecturemobl - model-driven engineering lecture
mobl - model-driven engineering lecture
zefhemel
 
Functional programming using underscorejs
Functional programming using underscorejsFunctional programming using underscorejs
Functional programming using underscorejs
偉格 高
 
mobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkelingmobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkeling
Devnology
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
Sven Haiges
 

Semelhante a mobl (20)

mobl presentation @ IHomer
mobl presentation @ IHomermobl presentation @ IHomer
mobl presentation @ IHomer
 
mobl - model-driven engineering lecture
mobl - model-driven engineering lecturemobl - model-driven engineering lecture
mobl - model-driven engineering lecture
 
mobl
moblmobl
mobl
 
The Ring programming language version 1.5.4 book - Part 40 of 185
The Ring programming language version 1.5.4 book - Part 40 of 185The Ring programming language version 1.5.4 book - Part 40 of 185
The Ring programming language version 1.5.4 book - Part 40 of 185
 
Functional programming using underscorejs
Functional programming using underscorejsFunctional programming using underscorejs
Functional programming using underscorejs
 
mobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkelingmobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkeling
 
Persisting Data on SQLite using Room
Persisting Data on SQLite using RoomPersisting Data on SQLite using Room
Persisting Data on SQLite using Room
 
The Ring programming language version 1.5.3 book - Part 44 of 184
The Ring programming language version 1.5.3 book - Part 44 of 184The Ring programming language version 1.5.3 book - Part 44 of 184
The Ring programming language version 1.5.3 book - Part 44 of 184
 
The Ring programming language version 1.5.3 book - Part 54 of 184
The Ring programming language version 1.5.3 book - Part 54 of 184The Ring programming language version 1.5.3 book - Part 54 of 184
The Ring programming language version 1.5.3 book - Part 54 of 184
 
Software Language Design & Engineering
Software Language Design & EngineeringSoftware Language Design & Engineering
Software Language Design & Engineering
 
Next-generation API Development with GraphQL and Prisma
Next-generation API Development with GraphQL and PrismaNext-generation API Development with GraphQL and Prisma
Next-generation API Development with GraphQL and Prisma
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 
The Ring programming language version 1.10 book - Part 54 of 212
The Ring programming language version 1.10 book - Part 54 of 212The Ring programming language version 1.10 book - Part 54 of 212
The Ring programming language version 1.10 book - Part 54 of 212
 
Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#
 
Scala on Your Phone
Scala on Your PhoneScala on Your Phone
Scala on Your Phone
 
Tips and Tricks of Developing .NET Application
Tips and Tricks of Developing .NET ApplicationTips and Tricks of Developing .NET Application
Tips and Tricks of Developing .NET Application
 
Introduction to Scalding and Monoids
Introduction to Scalding and MonoidsIntroduction to Scalding and Monoids
Introduction to Scalding and Monoids
 
Extreme Swift
Extreme SwiftExtreme Swift
Extreme Swift
 
GraphTour - Utilizing Powerful Extensions for Analytics & Operations
GraphTour - Utilizing Powerful Extensions for Analytics & OperationsGraphTour - Utilizing Powerful Extensions for Analytics & Operations
GraphTour - Utilizing Powerful Extensions for Analytics & Operations
 

Mais de Eelco Visser

Declarative Type System Specification with Statix
Declarative Type System Specification with StatixDeclarative Type System Specification with Statix
Declarative Type System Specification with Statix
Eelco Visser
 

Mais de Eelco Visser (20)

CS4200 2019 | Lecture 5 | Transformation by Term Rewriting
CS4200 2019 | Lecture 5 | Transformation by Term RewritingCS4200 2019 | Lecture 5 | Transformation by Term Rewriting
CS4200 2019 | Lecture 5 | Transformation by Term Rewriting
 
CS4200 2019 | Lecture 4 | Syntactic Services
CS4200 2019 | Lecture 4 | Syntactic ServicesCS4200 2019 | Lecture 4 | Syntactic Services
CS4200 2019 | Lecture 4 | Syntactic Services
 
CS4200 2019 | Lecture 3 | Parsing
CS4200 2019 | Lecture 3 | ParsingCS4200 2019 | Lecture 3 | Parsing
CS4200 2019 | Lecture 3 | Parsing
 
CS4200 2019 | Lecture 2 | syntax-definition
CS4200 2019 | Lecture 2 | syntax-definitionCS4200 2019 | Lecture 2 | syntax-definition
CS4200 2019 | Lecture 2 | syntax-definition
 
CS4200 2019 Lecture 1: Introduction
CS4200 2019 Lecture 1: IntroductionCS4200 2019 Lecture 1: Introduction
CS4200 2019 Lecture 1: Introduction
 
A Direct Semantics of Declarative Disambiguation Rules
A Direct Semantics of Declarative Disambiguation RulesA Direct Semantics of Declarative Disambiguation Rules
A Direct Semantics of Declarative Disambiguation Rules
 
Declarative Type System Specification with Statix
Declarative Type System Specification with StatixDeclarative Type System Specification with Statix
Declarative Type System Specification with Statix
 
Compiler Construction | Lecture 17 | Beyond Compiler Construction
Compiler Construction | Lecture 17 | Beyond Compiler ConstructionCompiler Construction | Lecture 17 | Beyond Compiler Construction
Compiler Construction | Lecture 17 | Beyond Compiler Construction
 
Domain Specific Languages for Parallel Graph AnalytiX (PGX)
Domain Specific Languages for Parallel Graph AnalytiX (PGX)Domain Specific Languages for Parallel Graph AnalytiX (PGX)
Domain Specific Languages for Parallel Graph AnalytiX (PGX)
 
Compiler Construction | Lecture 15 | Memory Management
Compiler Construction | Lecture 15 | Memory ManagementCompiler Construction | Lecture 15 | Memory Management
Compiler Construction | Lecture 15 | Memory Management
 
Compiler Construction | Lecture 14 | Interpreters
Compiler Construction | Lecture 14 | InterpretersCompiler Construction | Lecture 14 | Interpreters
Compiler Construction | Lecture 14 | Interpreters
 
Compiler Construction | Lecture 13 | Code Generation
Compiler Construction | Lecture 13 | Code GenerationCompiler Construction | Lecture 13 | Code Generation
Compiler Construction | Lecture 13 | Code Generation
 
Compiler Construction | Lecture 12 | Virtual Machines
Compiler Construction | Lecture 12 | Virtual MachinesCompiler Construction | Lecture 12 | Virtual Machines
Compiler Construction | Lecture 12 | Virtual Machines
 
Compiler Construction | Lecture 11 | Monotone Frameworks
Compiler Construction | Lecture 11 | Monotone FrameworksCompiler Construction | Lecture 11 | Monotone Frameworks
Compiler Construction | Lecture 11 | Monotone Frameworks
 
Compiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow AnalysisCompiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow Analysis
 
Compiler Construction | Lecture 9 | Constraint Resolution
Compiler Construction | Lecture 9 | Constraint ResolutionCompiler Construction | Lecture 9 | Constraint Resolution
Compiler Construction | Lecture 9 | Constraint Resolution
 
Compiler Construction | Lecture 8 | Type Constraints
Compiler Construction | Lecture 8 | Type ConstraintsCompiler Construction | Lecture 8 | Type Constraints
Compiler Construction | Lecture 8 | Type Constraints
 
Compiler Construction | Lecture 7 | Type Checking
Compiler Construction | Lecture 7 | Type CheckingCompiler Construction | Lecture 7 | Type Checking
Compiler Construction | Lecture 7 | Type Checking
 
Compiler Construction | Lecture 6 | Introduction to Static Analysis
Compiler Construction | Lecture 6 | Introduction to Static AnalysisCompiler Construction | Lecture 6 | Introduction to Static Analysis
Compiler Construction | Lecture 6 | Introduction to Static Analysis
 
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term RewritingCompiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 

mobl

  • 1. Slides from keynote at MOSE 2010, Malaga, June 29, 2010 Zef Hemel Eelco Visser @mobllang @zef @eelcovisser
  • 2. WebDSL Domain-Specific Language Engineering SDF Spoofax Stratego
  • 4. 50 million 20 million iPhones iPod Touches
  • 5. 1.5 million 1.2 million G1 Droid outsells iPhone in US
  • 6.
  • 8. Objective-C Java J2ME/C++ HTML/Javascript Java
  • 10.
  • 11. 3.3.1
  • 12. 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).
  • 13.
  • 15.
  • 16. cross-platform development arbitrary rejections we want high-level models
  • 17.
  • 19. HTML
  • 20. WebDatabases Full-screen support Location information (GPS) Offline support Canvas Multi-touch Threading
  • 21.
  • 22. 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
  • 23.
  • 24.
  • 26. data model user interface script web service access
  • 28. entity Task { name : String (searchable) done : Bool dueDate : DateTime }
  • 29. entity Task { name : String (searchable) done : Bool dueDate : DateTime categories : Collection<Category> } entity Category { name : String tasks : Collection<Task> (inverse: categories) }
  • 31. screen root() { header("Todo") group { list(t in Task.all()) { item { checkbox(t.done) " " label(t.name) } } } }
  • 32. screen root() { header("Todo") topButton("Add", onclick={ addTask(); }) group { list(t in Task.all()) { item { checkbox(t.done) " " label(t.name) } } } }
  • 33. screen addTask() { var newTask = Task { done = false, dueDate = now() } header("Add") backButton("Back", onclick={ screen return; }) group { item { textField(newTask.name) } item { datePicker(newTask.dueDate) } } button("Add", onclick={ add(newTask); screen return; }) }
  • 34. screen root() { header("Todo") topButton("Add", onclick={ addTask(); }) group { list(t in Task.all()) { item { checkbox(t.done) " " label(t.name) } } } }
  • 35. screen root() { var query = "" header("Todo") topButton("Add", onclick={ addTask(); }) searchBox(query) group { list(t in Task.search(query)) { item { checkbox(t.done) " " label(t.name) } } } }
  • 37. function cleanDoneTasks() : Num { var removed = 0; for(t in Task.all()) { if(t.done) { remove(t); removed = removed + 1; } } return removed; }
  • 39. one-way var n = 0 label(n) button("Up", onclick={ n = n + 1; })
  • 40. two-way var n = 0 inputNum(n) label(n)
  • 42.
  • 43. var amount = 10 var percentage = 10 var total <- amount * (1 + percentage/100) inputNum(amount) inputNum(percentage) label(total)
  • 45.
  • 46.
  • 47. http://api.stackoverflow.com/0.8/questions?answers=true&body=true { "total": 746646, "page": 1, "pagesize": 30, "questions": [ { "tags": ["string", "assembly", "arm"], "answers": [], "question_id": 3092029, "owner": { "user_id": 320124, "user_type": "registered", "display_name": "SoulBeaver", "reputation": 195 }, "creation_date": 1277200629, "score": 0, "title": "ARM - Infinite Loop While Searching String", "body": "...", ... }, ... ] }
  • 48. { "total": 746646, "page": 1, "pagesize": 30, "questions": [ { "tags": ["string", "assembly", "arm"], "answers": [], "question_id": 3092029, "owner": { "user_id": 320124, "user_type": "registered", "display_name": "SoulBeaver", "reputation": 195 }, "creation_date": 1277200629, "score": 0, "title": "ARM - Infinite Loop While Searching String", "body": "...", ... }, ... ] } external type QuestionsResultSet { total : Num page : Num pagesize : Num questions : Array<QuestionResult> }
  • 49. { "tags": ["string", "assembly", "arm"], "answers": [], "question_id": 3092029, "owner": { "user_id": 320124, "user_type": "registered", "display_name": "SoulBeaver", "reputation": 195 }, "creation_date": 1277200629, "score": 0, "title": "ARM - Infinite Loop While Searching String", "body": "...", ... } external type QuestionResult { tags : Array<String> answers : Array<AnswerResult> owner : OwnerResult creation_date : Num ... }
  • 50. service StackOverflow { root = "http://api.stackoverflow.com/0.8" resource questions(answers : Bool, body : Bool) : QuestionsResultSet { uri = "/questions" method = "GET" encoding = "json" } ... }
  • 51. function fetchQuestions() { var res = StackOverflow.questions(answers=true, body=true); for(question : QuestionResult in res.questions) { mapQuestion(question); } }
  • 52. entity Question { questionId : Num title : String body : Text answers : Collection<Answer> (inverse: question) creationDate : DateTime owner : User } entity Answer { question : Question answerId : Num owner : User body : Text } entity User { userId : Num name : String reputation : Num }
  • 53. function mapQuestion(qr : QuestionResult) : Question { var q : Question = cachedQuestion(remote.question_id); if(q == null) { q = Question { questionId = qr.question_id, title = qr.title, body = qr.body, answers = mapAnswers(qr.answers), creationDate = DateTime.fromTimestamp(qr.creation_date), owner = mapUser(qr.owner) }; add(q); } return q; }
  • 54.
  • 56. mobl code parse check desugar generate code HTML/Javascript
  • 57. entity Task { name : String (searchable) done : Bool dueDate : DateTime } Javascript using persistence.js HTML5 ORM tasks.Task = persistence.define('tasks__Task', { 'name': 'TEXT', 'done': 'BOOL', 'dueDate': 'DATE' }); tasks.Task.textIndex('name');
  • 58. screen root() { header("Todo") ... } Javascript functions building DOM tasks.root = function(callback, screenCallback) { var root1018 = $("<div>"); mobl.header(ref("Todo"), function(node) { root1018.append(node); ... }); };
  • 59. function cleanDoneTasks() : Num { var removed = 0; for(t in Task.all()) { if(t.done) { remove(t); removed = removed + 1; } } return removed; } tasks.cleanDoneTasks = function() { var removed = 0; var results = Task.all(); for(var i = 0; i < results.length; i++) { var t = results[i]; if(t.done) { remove(t); removed = removed + 1; } } return removed; }
  • 60. function cleanDoneTasks() : Num { var removed = 0; for(t in Task.all()) { if(t.done) { remove(t); removed = removed + 1; } } return removed; } tasks.cleanDoneTasks = function() { var removed = 0; var results = Task.all(); for(var i = 0; i < results.length; i++) { var t = results[i]; if(t.done) { remove(t); removed = removed + 1; } } return removed; };
  • 61. tasks.cleanDoneTasks = function() { var removed = 0; var results = Task.all(); for(var i = 0; i < results.length; i++) { var t = results[i]; if(t.done) { remove(t); removed = removed + 1; } } return removed; }; continuation-passing style transform tasks.cleanDoneTasks = function(callback) { var removed = 0; Task.all(function(results) { for(var i = 0; i < results.length; i++) { var t = results[i]; if(t.done) { remove(t); removed = removed + 1; } } callback(removed); }); };
  • 63. screen root() { var n = 8 label(n * n) button("Inc", onclick={ n = n + 1; }) }
  • 64. var n = 8 var n = ref(8); Observable - set(value) - get() - addEventListener(eventType, callback)
  • 65. 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);
  • 66. 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);
  • 67. screen root() { var n = 8 label(n * n) button("Inc", onclick={ n = n + 1; }) }
  • 69. many mobile platforms HTML5/JS avoid AppStore approval
  • 70. statically-typed WebDSL-like language generates HTML/JS CPS transform/reactive programming