h-ubu : CDI in JavaScript
-
Upload
clement-escoffier -
Category
Technology
-
view
1.118 -
download
0
description
Transcript of h-ubu : CDI in JavaScript
![Page 1: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/1.jpg)
h-ubuCDI in JavaScript
Clement Escoffier
Group
![Page 2: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/2.jpg)
![Page 3: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/3.jpg)
![Page 4: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/4.jpg)
How do we do that in Java ?
![Page 5: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/5.jpg)
![Page 6: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/6.jpg)
Components
![Page 7: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/7.jpg)
Interfaces
![Page 8: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/8.jpg)
DependencyInjection
![Page 9: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/9.jpg)
What do we havein JavaScript ?
![Page 10: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/10.jpg)
Module Patterns
+ -Fix visibility A bit complex
No interfaces
![Page 11: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/11.jpg)
Module loaders
+ -Avoid <script>
TransitiveReuse
Hard-codeddependencies
![Page 12: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/12.jpg)
MVC / MVVM
+ -Code
organizationUI Bindings
Pushingthe limits
![Page 13: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/13.jpg)
Well, so what’sh-ubu ?
![Page 14: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/14.jpg)
Service-basedInjection
Framework
![Page 15: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/15.jpg)
hub
![Page 16: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/16.jpg)
components
![Page 17: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/17.jpg)
var component = {configure : function(hub, conf) { },getComponentName : function() { },start : function() { },stop : function() {}
};
hub.registerComponent(component).start()
![Page 18: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/18.jpg)
contracts
![Page 19: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/19.jpg)
var myService= {doSomething : function() {}
}
![Page 20: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/20.jpg)
services
![Page 21: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/21.jpg)
servicesServiceRegistry
1 - Publication2 – Lookup,Service Listener 3 - Binding
![Page 22: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/22.jpg)
Why services ?
SubstitutabilityLoose-coupling
TestableDynamic
![Page 23: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/23.jpg)
var provider = {configure : function(hub, conf) {
hub.provideService({component: this,contract: myService
});},getComponentName : function() { },start : function() { },stop : function() {},doSomething : function() { … }
}
![Page 24: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/24.jpg)
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();}
}
![Page 25: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/25.jpg)
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
![Page 26: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/26.jpg)
events
![Page 27: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/27.jpg)
var publisher = {configure : function(hub, conf) {}getComponentName : function() { },start : function() {},stop : function() {},work : function() {
this.hub.publish(this, "my/topic", event);
}}
![Page 28: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/28.jpg)
var receiver = {configure : function(hub, conf) {
hub.subscribe(this, "my/(.)*?", this.receive);
},getComponentName : function() { },start : function() {},stop : function() {},receive: function(event) { }
}
![Page 29: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/29.jpg)
Modularize yourJavaScript
require.js/node.jsComposition
StandaloneConfigurability
![Page 30: h-ubu : CDI in JavaScript](https://reader036.fdocuments.in/reader036/viewer/2022081511/555ac767d8b42a761a8b4ed2/html5/thumbnails/30.jpg)
http://nano-project.github.com/h-ubu/snapshot/
h buStop hacking,
Start composing