SlideShare una empresa de Scribd logo
1 de 72
Descargar para leer sin conexión
Hackathon

WiFi pass: groundfloorsv
Download Opa 1.0.5 at opalang.org
while bandwidth lasts
Problem #1
Problem #1
                                                     Memcache                   Framework
Web Browser
 Web Browser
  Web Browser
   Web Browser                                 Web
    Web Browser                                 Web
                                                 Web
     Web Browser
      Web Browser                            Server               Language
                                                                   Language
       Web Browser
        Web Browser                           Server
                                               Server               Language
         Web Browser                                                 Language
          Web Browser
           Web Browser                      Web Server
            Web Browser
             Web Browser
              Web Browser
               Web Browser
                Web Browser
                 Web Browser
                  Web Browser                                        ORM
                   Web Browser
                    Web Browser
                     Web Browser
                      Web Browser
                       Web Browser
                        Web Browser                    Database
                         Web Browser
                          Web Browser                   Database
                                                         Database
                           Web Browser
                            Web Browser                   Database
                                                           Database
                             Web Browser
                              Web Browser
                               Web Browser
                                Web Browser               Database
                            Web Browser
Universal Language
Universal Language
Universal Language
Universal Language
Universal Language
Problem #2
This is JavaScript

> 9 + 5 + “ customers”
  14 customers
> “Customers: ” + 9 + 5
  Customers: 95
<   ?
This is JavaScript
                   switch (x) {
                     case 0:
if (x == 0)            retry();
  retry();             break;
else if (x == 1)     case 1:
  success();           success();
else                   break;
  error();           default:
                       error();
                   }
x = “0”
                       switch (x) {
                         case 0:
if (x == 0)                retry();
  retry();                 break;
else if (x == 1)         case 1:
  success();               success();
else                       break;
  error();               default:
                           error();
                       }

        retry                 error
This is JavaScript

   []   +   []
   []   +   {}
   {}   +   []
   {}   +   {}




   (@garybernhardt)
This is JavaScript

   []   +   []   =   ““
   []   +   {}   =   {}
   {}   +   []   =   0
   {}   +   {}   =   NaN




   (@garybernhardt)
Project Launch: June 21st 2011


       Man-years: 60+
Code automation
AJAX/COMET

Code automation   Non-blocking

                  Event-driven
Code verification
Code verification
Code verification
Live Demo
JS-like syntax

HTML first class

Event-driven
Code verification
Code verification
Code verification
Live Demo
mo
     De de
 ive hi
L o
    T
             // try different typing errors:
             // show errors in the terminal
             // show type infered

             function foo(s) {
                 String.length(s);
             }

             function bar(x, y) {
              foo(x) + y;
              // foo("hello") + y;
              // foo(x) + y + "hello";
             }

             _ = bar("hello", 2)
             //_ = bar(1, 2)
Type checking


foo = 1 + "bar";
          “Types int and string are
               not compatible”
Type inference

function foo(s) {
   String.length(s);
}

function bar(x, y) {
   foo(x) + y;
}
Type inference

int function foo(string s) {
   String.length(s);
}

int function bar(string x, int y) {
   foo(x) + y;
}
Strong static typing without any hassle.
A single language
Client and server
  // Will be on server side:
  function db_update(value) {
      /mydb/counter <- value
  }

  // Will be on client-side:
  function dom_update(value) {
      #counter = value
  }
Client and server

  function update(value) {
    /mydb/counter <- value;
    #counter = value
  }
Client and server


  function init() {
    #counter = /mydb/counter
  }
Transparent distribution

between client and server
Precise control
Live Demo
// a dangerous function
protected function dangerous() { 42 }

// a bit of code
function code() { dangerous() }

// an innocent bit of client code
client function malicious() { code() }
// database operations are protected BY DEFAULT

database mydb {
 string /personal_data
}

function code() { /mydb/personal_data }
// Try those different directives:
// protected
// server -> meaning less

// terminal error without «protected» on code
client function malicious(code) { code() }
Precise control
 client     server


 exposed   protected


  sync      async


 public     private
Strong database mapping
Data declaration
type user = {
   string mail, int age,
   list(string) comments
}

database dbname @mongo {
   user /user[{mail}]    // primary key
   int /user/age = 18    // default value
}
Data queries
/db/col[name == v; order -score; limit 50];



     ==               skip                in [e1, e2]
     !=               limit               or
     <                order               and
     <=                                   not
     >
     >=
Data queries
/db/col[n > 10 and n < 20];

                                                opa

use db
db.col.find(
   {$and : [{ n : { $gt : 10 } },
             { n : { $lt : 20 } } ]
})

                                      mongoDB shell
Data updates
/db/path[id == id] <- { n += 1, l <+ e }



       n += 800              l   pop
       n++                   l   shift
       n--                   l   <+ e
       n : v                 l   <++ [e1, e2, e3]
Transparent mapping between db and code values.

            Type checking included.

              (even for mongoDB)
Non-blocking
function fib(n) {
  if (n == 0)
    0
  else if (n == 1)
    1
  else
    fib(n-1) + fib(n-2)
}
mo
             / / D e mo n s t ra te a c li en t d o esn ’ t b l ock an o the r
     De de
             / / S e ve r a l c om pu ta ti on at the tim e ar e po s sib le

 ive hi
             / / T a lk a b ou t CP S
L o
    T        i m po r t s t d li b. th em es .b oot s tra p

             / / n a iv e f ib on ac ci
             f u nc t io n f ib (i d, n ) {
                 if (n = = 0 )
                    0
                 el s e i f (n = = 1)
                    1
                 el s e
                    f ib ( n - 1) + f ib (n -2 )
             }

             s e rv e r f u n ct io n ac ti on (_) {
               # re s ul t = f ib (4 0)
             }

             f u nc t io n p ag e( ) {
                 <d i v c l a ss =" we ll ">
                    <b u t t on c la ss =" bt n" on c lic k ={a c tio n }>C o mpute</button>
                    <h 2 i d= #r es ul t cl as s=" w ell " />
                 </ d iv >
             }

             S e rv e r. s t a rt (
                 Se r ve r . h tt p,
                 { ~ pa g e , t it le : "H el lo f ibo " }
             )
opalang.org
 @opalang


         @henri_opa
opa create myapp

   make run
Windows: bit.ly/O1JiKc
Linux, Mac: sudo easy_install pip && sudo pip install dotcloud
  git clone https://github.com/dotcloud/opa-on-dotcloud
                   dotcloud create myapp
          dotcloud push myapp opa-on-dotcloud

Más contenido relacionado

La actualidad más candente

Template Haskell Tutorial
Template Haskell TutorialTemplate Haskell Tutorial
Template Haskell Tutorial
kizzx2
 
Tips
TipsTips
Tips
mclee
 

La actualidad más candente (20)

Unfiltered Unveiled
Unfiltered UnveiledUnfiltered Unveiled
Unfiltered Unveiled
 
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
 
Haste (Same Language, Multiple Platforms) and Tagless Final Style (Same Synta...
Haste (Same Language, Multiple Platforms) and Tagless Final Style (Same Synta...Haste (Same Language, Multiple Platforms) and Tagless Final Style (Same Synta...
Haste (Same Language, Multiple Platforms) and Tagless Final Style (Same Synta...
 
Good Code
Good CodeGood Code
Good Code
 
20141011 mastering mysqlnd
20141011 mastering mysqlnd20141011 mastering mysqlnd
20141011 mastering mysqlnd
 
OpenGurukul : Language : PHP
OpenGurukul : Language : PHPOpenGurukul : Language : PHP
OpenGurukul : Language : PHP
 
How to stand on the shoulders of giants
How to stand on the shoulders of giantsHow to stand on the shoulders of giants
How to stand on the shoulders of giants
 
Bash Scripting Workshop
Bash Scripting WorkshopBash Scripting Workshop
Bash Scripting Workshop
 
08 php-files
08 php-files08 php-files
08 php-files
 
Template Haskell Tutorial
Template Haskell TutorialTemplate Haskell Tutorial
Template Haskell Tutorial
 
Groovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトークGroovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトーク
 
Whispered secrets
Whispered secretsWhispered secrets
Whispered secrets
 
ZeroMQ Is The Answer: PHP Tek 11 Version
ZeroMQ Is The Answer: PHP Tek 11 VersionZeroMQ Is The Answer: PHP Tek 11 Version
ZeroMQ Is The Answer: PHP Tek 11 Version
 
Creating Domain Specific Languages in Python
Creating Domain Specific Languages in PythonCreating Domain Specific Languages in Python
Creating Domain Specific Languages in Python
 
The Ruby Guide to *nix Plumbing: on the quest for efficiency with Ruby [M|K]RI
The Ruby Guide to *nix Plumbing: on the quest for efficiency with Ruby [M|K]RIThe Ruby Guide to *nix Plumbing: on the quest for efficiency with Ruby [M|K]RI
The Ruby Guide to *nix Plumbing: on the quest for efficiency with Ruby [M|K]RI
 
Tips
TipsTips
Tips
 
Asynchronous PHP and Real-time Messaging
Asynchronous PHP and Real-time MessagingAsynchronous PHP and Real-time Messaging
Asynchronous PHP and Real-time Messaging
 
ZeroMQ Is The Answer: DPC 11 Version
ZeroMQ Is The Answer: DPC 11 VersionZeroMQ Is The Answer: DPC 11 Version
ZeroMQ Is The Answer: DPC 11 Version
 
ZeroMQ Is The Answer
ZeroMQ Is The AnswerZeroMQ Is The Answer
ZeroMQ Is The Answer
 
Functional pe(a)rls: Huey's zipper
Functional pe(a)rls: Huey's zipperFunctional pe(a)rls: Huey's zipper
Functional pe(a)rls: Huey's zipper
 

Destacado

Познакомимся?
Познакомимся?Познакомимся?
Познакомимся?
marina0962
 
Innovation current
Innovation currentInnovation current
Innovation current
MCHLSLBR
 
Directed Research Final Presentation
Directed Research Final PresentationDirected Research Final Presentation
Directed Research Final Presentation
MCHLSLBR
 
Current and emerging trends in buying selling and valuing ambulatory surgery ...
Current and emerging trends in buying selling and valuing ambulatory surgery ...Current and emerging trends in buying selling and valuing ambulatory surgery ...
Current and emerging trends in buying selling and valuing ambulatory surgery ...
Ambulatory Alliances
 
Km教育訓練用簡報
Km教育訓練用簡報Km教育訓練用簡報
Km教育訓練用簡報
chloe0723
 
Opa presentation at GamesJs
Opa presentation at GamesJsOpa presentation at GamesJs
Opa presentation at GamesJs
Henri Binsztok
 

Destacado (20)

Познакомимся?
Познакомимся?Познакомимся?
Познакомимся?
 
Employee communication
Employee communicationEmployee communication
Employee communication
 
AWS Lambda
AWS LambdaAWS Lambda
AWS Lambda
 
Innovation current
Innovation currentInnovation current
Innovation current
 
Selling your ambulatory surgery center (part 3 of 4)
Selling your ambulatory surgery center (part 3 of 4)Selling your ambulatory surgery center (part 3 of 4)
Selling your ambulatory surgery center (part 3 of 4)
 
Academic earth
Academic earthAcademic earth
Academic earth
 
Presentation4
Presentation4Presentation4
Presentation4
 
114 646-2-pb(1)mixoma
114 646-2-pb(1)mixoma 114 646-2-pb(1)mixoma
114 646-2-pb(1)mixoma
 
Rellenos
RellenosRellenos
Rellenos
 
Fabjam invitation
Fabjam invitationFabjam invitation
Fabjam invitation
 
Glimpses of 2011
Glimpses of 2011Glimpses of 2011
Glimpses of 2011
 
Capas
CapasCapas
Capas
 
conexion-ordenador-movil-presentacion
conexion-ordenador-movil-presentacionconexion-ordenador-movil-presentacion
conexion-ordenador-movil-presentacion
 
Capitalization of a profit company
Capitalization of a profit companyCapitalization of a profit company
Capitalization of a profit company
 
Business
BusinessBusiness
Business
 
Comandos básicos
Comandos básicosComandos básicos
Comandos básicos
 
Directed Research Final Presentation
Directed Research Final PresentationDirected Research Final Presentation
Directed Research Final Presentation
 
Current and emerging trends in buying selling and valuing ambulatory surgery ...
Current and emerging trends in buying selling and valuing ambulatory surgery ...Current and emerging trends in buying selling and valuing ambulatory surgery ...
Current and emerging trends in buying selling and valuing ambulatory surgery ...
 
Km教育訓練用簡報
Km教育訓練用簡報Km教育訓練用簡報
Km教育訓練用簡報
 
Opa presentation at GamesJs
Opa presentation at GamesJsOpa presentation at GamesJs
Opa presentation at GamesJs
 

Similar a Opa hackathon

주로사용되는 Xss필터와 이를 공격하는 방법
주로사용되는 Xss필터와 이를 공격하는 방법주로사용되는 Xss필터와 이를 공격하는 방법
주로사용되는 Xss필터와 이를 공격하는 방법
guestad13b55
 
支撐英雄聯盟戰績網的那條巨蟒
支撐英雄聯盟戰績網的那條巨蟒支撐英雄聯盟戰績網的那條巨蟒
支撐英雄聯盟戰績網的那條巨蟒
Toki Kanno
 
JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big Picture
Simon Willison
 
Why Node.js
Why Node.jsWhy Node.js
Why Node.js
guileen
 

Similar a Opa hackathon (20)

Ruby on Rails 3.1: Let's bring the fun back into web programing
Ruby on Rails 3.1: Let's bring the fun back into web programingRuby on Rails 3.1: Let's bring the fun back into web programing
Ruby on Rails 3.1: Let's bring the fun back into web programing
 
주로사용되는 Xss필터와 이를 공격하는 방법
주로사용되는 Xss필터와 이를 공격하는 방법주로사용되는 Xss필터와 이를 공격하는 방법
주로사용되는 Xss필터와 이를 공격하는 방법
 
Tips And Tricks For Bioinformatics Software Engineering
Tips And Tricks For Bioinformatics Software EngineeringTips And Tricks For Bioinformatics Software Engineering
Tips And Tricks For Bioinformatics Software Engineering
 
Nodejs Explained with Examples
Nodejs Explained with ExamplesNodejs Explained with Examples
Nodejs Explained with Examples
 
Nodejsexplained 101116115055-phpapp02
Nodejsexplained 101116115055-phpapp02Nodejsexplained 101116115055-phpapp02
Nodejsexplained 101116115055-phpapp02
 
Clojure: Simple By Design
Clojure: Simple By DesignClojure: Simple By Design
Clojure: Simple By Design
 
Node.js - async for the rest of us.
Node.js - async for the rest of us.Node.js - async for the rest of us.
Node.js - async for the rest of us.
 
支撐英雄聯盟戰績網的那條巨蟒
支撐英雄聯盟戰績網的那條巨蟒支撐英雄聯盟戰績網的那條巨蟒
支撐英雄聯盟戰績網的那條巨蟒
 
XRobots
XRobotsXRobots
XRobots
 
JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big Picture
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
Node azure
Node azureNode azure
Node azure
 
Cより速いRubyプログラム
Cより速いRubyプログラムCより速いRubyプログラム
Cより速いRubyプログラム
 
Beyond php it's not (just) about the code
Beyond php   it's not (just) about the codeBeyond php   it's not (just) about the code
Beyond php it's not (just) about the code
 
Quick Intro To JRuby
Quick Intro To JRubyQuick Intro To JRuby
Quick Intro To JRuby
 
Streaming Data Flow with Apache Flink @ Paris Flink Meetup 2015
Streaming Data Flow with Apache Flink @ Paris Flink Meetup 2015Streaming Data Flow with Apache Flink @ Paris Flink Meetup 2015
Streaming Data Flow with Apache Flink @ Paris Flink Meetup 2015
 
ClojureScript for the web
ClojureScript for the webClojureScript for the web
ClojureScript for the web
 
Why Nodejs Guilin Shanghai
Why Nodejs Guilin ShanghaiWhy Nodejs Guilin Shanghai
Why Nodejs Guilin Shanghai
 
Why Node.js
Why Node.jsWhy Node.js
Why Node.js
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 Engine
 

Último

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)

Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
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
 
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...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
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...
 
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
 
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​
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
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
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
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
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
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
 

Opa hackathon