0
Upcoming SlideShare
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Standard text messaging rates apply

# Opa hackathon

661

Published on

Published in: Technology
2 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total Views
661
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
5
0
Likes
2
Embeds 0
No embeds

No notes for slide

### Transcript

• 2. Problem #1
• 3. Problem #1 Memcache FrameworkWeb 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
• 4. Universal Language
• 5. Universal Language
• 6. Universal Language
• 7. Universal Language
• 8. Universal Language
• 9. Problem #2
• 10. This is JavaScript&gt; 9 + 5 + &#x201C; customers&#x201D; 14 customers&gt; &#x201C;Customers: &#x201D; + 9 + 5 Customers: 95
• 11. &lt; ?
• 12. 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(); }
• 13. x = &#x201C;0&#x201D; 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
• 14. This is JavaScript [] + [] [] + {} {} + [] {} + {} (@garybernhardt)
• 15. This is JavaScript [] + [] = &#x201C;&#x201C; [] + {} = {} {} + [] = 0 {} + {} = NaN (@garybernhardt)
• 16. Project Launch: June 21st 2011 Man-years: 60+
• 17. Code automation
• 18. AJAX/COMETCode automation Non-blocking Event-driven
• 19. Code veri&#xFB01;cation
• 20. Code veri&#xFB01;cation
• 21. Code veri&#xFB01;cation
• 22. Live Demo
• 23. JS-like syntaxHTML &#xFB01;rst classEvent-driven
• 24. Code veri&#xFB01;cation
• 25. Code veri&#xFB01;cation
• 26. Code veri&#xFB01;cation
• 27. Live Demo
• 28. mo De de ive hiL 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)
• 29. Type checkingfoo = 1 + "bar"; &#x201C;Types int and string are not compatible&#x201D;
• 30. Type inferencefunction foo(s) { String.length(s);}function bar(x, y) { foo(x) + y;}
• 31. Type inferenceint function foo(string s) { String.length(s);}int function bar(string x, int y) { foo(x) + y;}
• 32. Strong static typing without any hassle.
• 33. A single language
• 34. Client and server // Will be on server side: function db_update(value) { /mydb/counter &lt;- value } // Will be on client-side: function dom_update(value) { #counter = value }
• 35. Client and server function update(value) { /mydb/counter &lt;- value; #counter = value }
• 36. Client and server function init() { #counter = /mydb/counter }
• 37. Transparent distributionbetween client and server
• 38. Precise control
• 39. Live Demo
• 40. // a dangerous functionprotected function dangerous() { 42 }// a bit of codefunction code() { dangerous() }// an innocent bit of client codeclient function malicious() { code() }
• 41. // database operations are protected BY DEFAULTdatabase mydb { string /personal_data}function code() { /mydb/personal_data }// Try those different directives:// protected// server -&gt; meaning less// terminal error without &#xAB;protected&#xBB; on codeclient function malicious(code) { code() }
• 42. Precise control client server exposed protected sync async public private
• 43. Strong database mapping
• 44. Data declarationtype user = { string mail, int age, list(string) comments}database dbname @mongo { user /user[{mail}] // primary key int /user/age = 18 // default value}
• 45. Data queries/db/col[name == v; order -score; limit 50]; == skip in [e1, e2] != limit or &lt; order and &lt;= not &gt; &gt;=
• 46. Data queries/db/col[n &gt; 10 and n &lt; 20]; opause dbdb.col.find( {\$and : [{ n : { \$gt : 10 } }, { n : { \$lt : 20 } } ]}) mongoDB shell
• 47. Data updates/db/path[id == id] &lt;- { n += 1, l &lt;+ e } n += 800 l pop n++ l shift n-- l &lt;+ e n : v l &lt;++ [e1, e2, e3]
• 48. Transparent mapping between db and code values. Type checking included. (even for mongoDB)
• 49. Non-blocking
• 50. function fib(n) { if (n == 0) 0 else if (n == 1) 1 else fib(n-1) + fib(n-2)}
• 51. mo / / D e mo n s t ra te a c li en t d o esn &#x2019; 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 SL 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( ) { &lt;d i v c l a ss =" we ll "&gt; &lt;b u t t on c la ss =" bt n" on c lic k ={a c tio n }&gt;C o mpute&lt;/button&gt; &lt;h 2 i d= #r es ul t cl as s=" w ell " /&gt; &lt;/ d iv &gt; } 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 " } )
• 52. opalang.org @opalang @henri_opa
• 53. opa create myapp make run
• 54. Windows: bit.ly/O1JiKcLinux, Mac: sudo easy_install pip &amp;&amp; sudo pip install dotcloud git clone https://github.com/dotcloud/opa-on-dotcloud dotcloud create myapp dotcloud push myapp opa-on-dotcloud