SlideShare a Scribd company logo
1 of 11
Download to read offline
Helma / RingoJS
   Philipp Naderer / @botic
Helma / RingoJS

• JavaScript on the JVM
• Both based on Mozilla Rhino
• Helma is EOF, 1998 – 2008
• RingoJS is the successor of Helma
Features
• CommonJS modules & packages
• Full access to Java libraries
• ECMAScript 5 and JS 1.8 support
• Lots of „ringo/“ modules
 • dates, http, concurrency, logging,
    subprocesses, jsgi, command line, ...
Debugger
Multithreaded JS?

• Ringo‘s concept: Workers
• You can still use an EventLoop
• No shared global object*
• Singletons instead of shared data
Ringo Workers
• Look like Web Workers in Browsers
• No JSON serialization needed = faster!
• Send a message with postMessage(e)
• React on message with onMessage(e)
• Return the result to the caller with
  postMessage(e)
fibobuster.js
1. var {Worker} = require("ringo/worker");
2.
3. // Create 50 Workers = 50 Threads
4. for (var i = 50; i < 100; i++) {
5.    var w = new Worker(module.resolve("./fibonacci"));
6.
7.    // Callback for the output
8.    w.onmessage = function(returnObj) {
9.        console.log("Result: " + returnObj.data.result);
10.   }
11.
12.   // Start with the calculation
13.   w.postMessage(i);
14. }
fibonacci.js
function onmessage(message) {
  var limit = message.data;

    console.log("Fibonacci #" + limit);

    /* Calculate the fibonacci number */
    var a = ..., b = ..., c = ...;
    for (...) { ... }

    message.source.postMessage({ result: c });
}
webserver.js
var response = require("ringo/jsgi/response");
var {Application} = require("stick");

var app = exports.app = new Application();

// Configure stick middlewares
app.configure("notfound", "route");

app.get("/", function(request) {
 return response.html("<h1>I‘m a todo app!</h1>");
});

if (require.main == module) {
   require("ringo/httpserver").main(module.id);
}
webserver.js serving 10.000 HTTP requests
More infos

• ringojs.org – basic information
• github.com/ringojs – source + examples
• @ringojs – official account
• IRC: irc.freenode.net #ringojs

More Related Content

What's hot

Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?Christian Joudrey
 
Create a RESTful API with NodeJS, Express and MongoDB
Create a RESTful API with NodeJS, Express and MongoDBCreate a RESTful API with NodeJS, Express and MongoDB
Create a RESTful API with NodeJS, Express and MongoDBHengki Sihombing
 
MongoDB, Node.js And You: PART II
MongoDB, Node.js And You: PART IIMongoDB, Node.js And You: PART II
MongoDB, Node.js And You: PART IIMitch Pirtle
 
Server side scripting smack down - Node.js vs PHP
Server side scripting smack down - Node.js vs PHPServer side scripting smack down - Node.js vs PHP
Server side scripting smack down - Node.js vs PHPMarc Gear
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.jsjacekbecela
 
Presentation of JSConf.eu
Presentation of JSConf.euPresentation of JSConf.eu
Presentation of JSConf.euFredrik Wendt
 
Non-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsNon-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsMarcus Frödin
 
Jugando con websockets en nodeJS
Jugando con websockets en nodeJSJugando con websockets en nodeJS
Jugando con websockets en nodeJSIsrael Gutiérrez
 
Javascript asynchronous
Javascript asynchronousJavascript asynchronous
Javascript asynchronouskang taehun
 
JavaScript Engines and Event Loop
JavaScript Engines and Event Loop JavaScript Engines and Event Loop
JavaScript Engines and Event Loop Tapan B.K.
 
Ember and WebSockets
Ember and WebSocketsEmber and WebSockets
Ember and WebSocketsSteve Kinney
 
Async programming on NET
Async programming on NETAsync programming on NET
Async programming on NETyuyijq
 

What's hot (20)

Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?
 
Create a RESTful API with NodeJS, Express and MongoDB
Create a RESTful API with NodeJS, Express and MongoDBCreate a RESTful API with NodeJS, Express and MongoDB
Create a RESTful API with NodeJS, Express and MongoDB
 
MongoDB, Node.js And You: PART II
MongoDB, Node.js And You: PART IIMongoDB, Node.js And You: PART II
MongoDB, Node.js And You: PART II
 
Server side scripting smack down - Node.js vs PHP
Server side scripting smack down - Node.js vs PHPServer side scripting smack down - Node.js vs PHP
Server side scripting smack down - Node.js vs PHP
 
ActionHeroJS Talk
ActionHeroJS TalkActionHeroJS Talk
ActionHeroJS Talk
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
 
Ender
EnderEnder
Ender
 
JavaScript on the Desktop
JavaScript on the DesktopJavaScript on the Desktop
JavaScript on the Desktop
 
Presentation of JSConf.eu
Presentation of JSConf.euPresentation of JSConf.eu
Presentation of JSConf.eu
 
webworkers
webworkerswebworkers
webworkers
 
Non-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsNon-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.js
 
What is Node.js
What is Node.jsWhat is Node.js
What is Node.js
 
Jugando con websockets en nodeJS
Jugando con websockets en nodeJSJugando con websockets en nodeJS
Jugando con websockets en nodeJS
 
Javascript asynchronous
Javascript asynchronousJavascript asynchronous
Javascript asynchronous
 
JavaScript Engines and Event Loop
JavaScript Engines and Event Loop JavaScript Engines and Event Loop
JavaScript Engines and Event Loop
 
Ember and WebSockets
Ember and WebSocketsEmber and WebSockets
Ember and WebSockets
 
NodeJs
NodeJsNodeJs
NodeJs
 
Async programming on NET
Async programming on NETAsync programming on NET
Async programming on NET
 
Node.js - A Quick Tour
Node.js - A Quick TourNode.js - A Quick Tour
Node.js - A Quick Tour
 
ECMAScript 6
ECMAScript 6ECMAScript 6
ECMAScript 6
 

Viewers also liked

Pink Denim Shorts
Pink Denim ShortsPink Denim Shorts
Pink Denim ShortsJennaLee31
 
Urdangarín no ha tenido un comportamiento “ejemplar”
Urdangarín no ha tenido un comportamiento “ejemplar”Urdangarín no ha tenido un comportamiento “ejemplar”
Urdangarín no ha tenido un comportamiento “ejemplar”Javi Andreu
 
Organisation can grow fast with proper change management corporate governance...
Organisation can grow fast with proper change management corporate governance...Organisation can grow fast with proper change management corporate governance...
Organisation can grow fast with proper change management corporate governance...Robinsigma
 
Book reference management
Book reference managementBook reference management
Book reference managementjmunks
 
Mojo, Twitter und Konsorten
Mojo, Twitter und KonsortenMojo, Twitter und Konsorten
Mojo, Twitter und KonsortenPhilipp Naderer
 
Journal article reference
Journal article referenceJournal article reference
Journal article referencejmunks
 

Viewers also liked (6)

Pink Denim Shorts
Pink Denim ShortsPink Denim Shorts
Pink Denim Shorts
 
Urdangarín no ha tenido un comportamiento “ejemplar”
Urdangarín no ha tenido un comportamiento “ejemplar”Urdangarín no ha tenido un comportamiento “ejemplar”
Urdangarín no ha tenido un comportamiento “ejemplar”
 
Organisation can grow fast with proper change management corporate governance...
Organisation can grow fast with proper change management corporate governance...Organisation can grow fast with proper change management corporate governance...
Organisation can grow fast with proper change management corporate governance...
 
Book reference management
Book reference managementBook reference management
Book reference management
 
Mojo, Twitter und Konsorten
Mojo, Twitter und KonsortenMojo, Twitter und Konsorten
Mojo, Twitter und Konsorten
 
Journal article reference
Journal article referenceJournal article reference
Journal article reference
 

Similar to Helma / RingoJS – Vienna.js Minitalk

Node js
Node jsNode js
Node jshazzaz
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...Fabio Franzini
 
NodeJs
NodeJsNodeJs
NodeJsdizabl
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch
 
Introduction to Vert.x
Introduction to Vert.xIntroduction to Vert.x
Introduction to Vert.xYiguang Hu
 
Groovy Ecosystem - JFokus 2011 - Guillaume Laforge
Groovy Ecosystem - JFokus 2011 - Guillaume LaforgeGroovy Ecosystem - JFokus 2011 - Guillaume Laforge
Groovy Ecosystem - JFokus 2011 - Guillaume LaforgeGuillaume Laforge
 
Building and Scaling Node.js Applications
Building and Scaling Node.js ApplicationsBuilding and Scaling Node.js Applications
Building and Scaling Node.js ApplicationsOhad Kravchick
 
Workshop 4: NodeJS. Express Framework & MongoDB.
Workshop 4: NodeJS. Express Framework & MongoDB.Workshop 4: NodeJS. Express Framework & MongoDB.
Workshop 4: NodeJS. Express Framework & MongoDB.Visual Engineering
 
Introduction to REST API with Node.js
Introduction to REST API with Node.jsIntroduction to REST API with Node.js
Introduction to REST API with Node.jsYoann Gotthilf
 
Introducing the Seneca MVP framework for Node.js
Introducing the Seneca MVP framework for Node.jsIntroducing the Seneca MVP framework for Node.js
Introducing the Seneca MVP framework for Node.jsRichard Rodger
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applicationsTom Croucher
 
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...GITS Indonesia
 
How and why i roll my own node.js framework
How and why i roll my own node.js frameworkHow and why i roll my own node.js framework
How and why i roll my own node.js frameworkBen Lin
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot CampTroy Miles
 

Similar to Helma / RingoJS – Vienna.js Minitalk (20)

NodeJS
NodeJSNodeJS
NodeJS
 
Node js
Node jsNode js
Node js
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
 
Node intro
Node introNode intro
Node intro
 
NodeJs
NodeJsNodeJs
NodeJs
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
 
Introduction to Vert.x
Introduction to Vert.xIntroduction to Vert.x
Introduction to Vert.x
 
Groovy Ecosystem - JFokus 2011 - Guillaume Laforge
Groovy Ecosystem - JFokus 2011 - Guillaume LaforgeGroovy Ecosystem - JFokus 2011 - Guillaume Laforge
Groovy Ecosystem - JFokus 2011 - Guillaume Laforge
 
Future of NodeJS
Future of NodeJSFuture of NodeJS
Future of NodeJS
 
Building and Scaling Node.js Applications
Building and Scaling Node.js ApplicationsBuilding and Scaling Node.js Applications
Building and Scaling Node.js Applications
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
 
Workshop 4: NodeJS. Express Framework & MongoDB.
Workshop 4: NodeJS. Express Framework & MongoDB.Workshop 4: NodeJS. Express Framework & MongoDB.
Workshop 4: NodeJS. Express Framework & MongoDB.
 
Introduction to REST API with Node.js
Introduction to REST API with Node.jsIntroduction to REST API with Node.js
Introduction to REST API with Node.js
 
Introducing the Seneca MVP framework for Node.js
Introducing the Seneca MVP framework for Node.jsIntroducing the Seneca MVP framework for Node.js
Introducing the Seneca MVP framework for Node.js
 
20120816 nodejsdublin
20120816 nodejsdublin20120816 nodejsdublin
20120816 nodejsdublin
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
 
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
 
How and why i roll my own node.js framework
How and why i roll my own node.js frameworkHow and why i roll my own node.js framework
How and why i roll my own node.js framework
 
Scripting GeoServer
Scripting GeoServerScripting GeoServer
Scripting GeoServer
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot Camp
 

Helma / RingoJS – Vienna.js Minitalk

  • 1. Helma / RingoJS Philipp Naderer / @botic
  • 2. Helma / RingoJS • JavaScript on the JVM • Both based on Mozilla Rhino • Helma is EOF, 1998 – 2008 • RingoJS is the successor of Helma
  • 3. Features • CommonJS modules & packages • Full access to Java libraries • ECMAScript 5 and JS 1.8 support • Lots of „ringo/“ modules • dates, http, concurrency, logging, subprocesses, jsgi, command line, ...
  • 5. Multithreaded JS? • Ringo‘s concept: Workers • You can still use an EventLoop • No shared global object* • Singletons instead of shared data
  • 6. Ringo Workers • Look like Web Workers in Browsers • No JSON serialization needed = faster! • Send a message with postMessage(e) • React on message with onMessage(e) • Return the result to the caller with postMessage(e)
  • 7. fibobuster.js 1. var {Worker} = require("ringo/worker"); 2. 3. // Create 50 Workers = 50 Threads 4. for (var i = 50; i < 100; i++) { 5. var w = new Worker(module.resolve("./fibonacci")); 6. 7. // Callback for the output 8. w.onmessage = function(returnObj) { 9. console.log("Result: " + returnObj.data.result); 10. } 11. 12. // Start with the calculation 13. w.postMessage(i); 14. }
  • 8. fibonacci.js function onmessage(message) { var limit = message.data; console.log("Fibonacci #" + limit); /* Calculate the fibonacci number */ var a = ..., b = ..., c = ...; for (...) { ... } message.source.postMessage({ result: c }); }
  • 9. webserver.js var response = require("ringo/jsgi/response"); var {Application} = require("stick"); var app = exports.app = new Application(); // Configure stick middlewares app.configure("notfound", "route"); app.get("/", function(request) { return response.html("<h1>I‘m a todo app!</h1>"); }); if (require.main == module) { require("ringo/httpserver").main(module.id); }
  • 11. More infos • ringojs.org – basic information • github.com/ringojs – source + examples • @ringojs – official account • IRC: irc.freenode.net #ringojs