Nanoko
Design – Deliver - Drive
Clement Escoffier
Thomas Leveque
Web
?
Write once, Run everywhere
How do we do that
with OSGi™?
Modules
Components
Services
Dependency
Injection
Robust build
processes
Unit / Integration
Tests
What do we have
in JavaScript ?
Module Patterns
+ -
Fix visibility A bit complex
No interfaces
Module loaders
+ -
Avoid <script>
Transitive
Reuse
Hard-coded
dependencies
MVC / MVVM
+ -
Code
organization
UI Bindings
Pushing
the limits
Well, so what’s
Nanoko ?
It’s an open
stack
Build
Run
Adapt
Build
Maven
coffee-mill
play2
Run
h-ubu
Cordoba
play2, grails
Adapt
Platform
Environment
Something close to
OSGi™ : h-ubu
Service-based
Injection
Framework
hub
components
var component = {
configure : function(hub, conf) { },
getComponentName : function() { },
start : function() { },
stop : function() {}
};
hub
.registerComponent(component)
.start()
contracts
var myService= {
doSomething : function() {}
}
services
services
Service
Registry
1 - Publication2 – Lookup,
Service Listener 3 - Binding
Why services ?
Substitutability
Loose-coupling
Testable
Dynamic
var provider = {
configure : function(hub, conf) {
hub.provideService({
component: this,
contract: myService
});
},
getComponentName : function() { },
start : function() { },
stop : function() {},
doSomething : function() { … }
}
var consumer = {
configure : function(hub, conf) {
hub.requireService({
component: this,
contract: myService,
field: "svc"
});
},
getComponentName : function() { },
start : function() {},
stop : function() {},
work : function() {
this.svc.doSomething();
}
}
var consumer = {
configure : function(hub, conf) {
hub.requireService({
component: this,
contract: myService,
field: "svc"
});
},
getComponentName : function() { },
start : function() {},
stop : function() {},
work : function() {
this.svc.doSomething();
}
}
Proxy
events
var publisher = {
configure : function(hub, conf) {}
getComponentName : function() { },
start : function() {},
stop : function() {},
work : function() {
this.hub.publish(this, "my/topic",
event);
}
}
var receiver = {
configure : function(hub, conf) {
hub.subscribe(this, "my/(.)*?",
this.receive);
},
getComponentName : function() { },
start : function() {},
stop : function() {},
receive: function(event) { }
}
Modularize your
JavaScript
require.js/node.js
Composition
Standalone
Configurability
http://nano-project.github.com/h-ubu/snapshot/
h bu
Stop hacking,
Start composing
Nanoko
Design – Deliver - Drive
http://nanoko.org

OW2 Nanoko