Joose is a meta object system for JavaScript that helps write well-structured, expressive, declarative, maintainable JavaScript applications. It allows for classes, interfaces, mixins, modules/packages/namespaces, roles, and method modifiers. Joose aims to bring features from other programming languages like Java, C#, Smalltalk, Ruby, and Perl to JavaScript in a native way. It provides a declarative syntax for building classes and other structures and also includes meta features for introspecting and manipulating objects at runtime.
4. Joose is not
a browser/DOM/Ajax/Widget library
like jQuery, Prototype, YUI,
Mootools or Dojo
5. Joose is not
a browser/DOM/Ajax/Widget library
like jQuery, Prototype, YUI,
Mootools or Dojo
hen
uch need these w
Y ou wil still very m
the Browser
you use Joose in
31. JSON Integration
var p = new Geometry.Point({x: 10, y: 20})
var jsonSring = JSON.stringify(p);
var p2 = JSON.parse(jsonString);
alert(p2.getX())
32. JSON Integration
var p = new Geometry.Point({x: 10, y: 20})
var jsonSring = JSON.stringify(p);
var p2 = JSON.parse(jsonString);
alert(p2.getX())
ON
JSON and turn JS
Turn Joose Objects into s
into Joose object
33. JSON Integration
var p = new Geometry.Point({x: 10, y: 20})
var jsonSring = JSON.stringify(p);
var p2 = JSON.parse(jsonString);
alert(p2.getX()) tion!
Backe nd Integra
ON
JSON and turn JS
Turn Joose Objects into s
into Joose object
35. Classes and Namespaces in native
JS
if(Test == null) {
Test = {};
}
Test.StandardPoint = function (x, y) {
this.x = x || 0
this.y = y || 0
}
Test.StandardPoint.prototype = {
getX: function () {
return this.x
},
setX: function (x) {
this.x = x
},
getY: function () {
return this.y
},
setY: function (y) { Dramatization
36. if(Test == null) {
Test = {};
Classes and Namespaces in native
}
JSthis.x = x || 0= function (x, y) {
Test.StandardPoint
this.y = y || 0
}
Test.StandardPoint.prototype = {
getX: function () {
return this.x
},
setX: function (x) {
this.x = x
},
getY: function () {
return this.y
},
setY: function (y) {
this.y = y;
},
clear: function () {
this.setX(0)
this.setY(0)
} Dramatization
}
37. Using Joose
Module(quot;Testquot;, function (m) {
Class(quot;Pointquot;, {
has: {
x: {
is: quot;rwquot;,
init: 0
},
y: {
is: quot;rwquot;,
init: 0
}
},
methods: {
clear: function () {
this.setX(0);
this.setY(0);
}
}
})
})
38. Using Joose
Module(quot;Testquot;, function (m) {
Class(quot;Pointquot;, {
has: {
x: {
is: quot;rwquot;,
init: 0
},
y: {
is: quot;rwquot;,
lling!
ed for scro
init: 0
} No ne
},
methods: {
clear: function () {
this.setX(0);
this.setY(0);
}
}
})
})
39. Class inheritance and method
wrappers in native JS
// We need a utility function to do the inheritance
function inherit(superClass, subClass) {
for(var i in superClass.prototype) {
subClass.prototype[i] = superClass.prototype[i]
}
}
Test.StandardPoint3D = function (x, y, z) {
this.x = x || 0
this.y = y || 0
this.z = z || 0
}
// Make Test.Standard the super class of Test.StandardPoint3D
inherit(Test.StandardPoint, Test.StandardPoint3D)
// we cant assign a new prototype because we already have the
one from the super
Test.StandardPoint3D.prototype.getZ = function () {
return this.z Dramatization
}
40. }
Test.StandardPoint3D = function (x, y, z) {
this.x = x || 0
Class inheritance and method
this.y = y || 0
this.z = z || 0
wrappers in native JS
}
// Make Test.Standard the super class of Test.StandardPoint3D
inherit(Test.StandardPoint, Test.StandardPoint3D)
// we cant assign a new prototype because we already have the
one from the super
Test.StandardPoint3D.prototype.getZ = function () {
return this.z
}
Test.StandardPoint3D.prototype.setZ = function (z) {
this.z = z;
}
var superMethod = Test.StandardPoint3D.prototype.clear;
Test.StandardPoint3D.prototype.clear = function () {
superMethod.apply(this);
this.z = 0;
}
Dramatization
41. Using Joose
Module(quot;Testquot;, function (m) {
Class(quot;Point3Dquot;, {
isa: m.Point,
has: {
z: {
is: quot;rwquot;,
init: 0
}
},
after: {
clear: function () {
this.setZ(0)
}
}
})
})
46. Speed
Should be fine if you're not building a
canvas based ray tracer for real time
animations.
Profiling shows that Joose's overhead
is negligible in most real world
applications.
47. Speed
Should be fine if you're not building a
canvas based ray tracer for real time
animations.if you do, though!
Tell me
Profiling shows that Joose's overhead
is negligible in most real world
applications.
48. Other Frameworks
_ Integration with jQuery works like a charm
_ YUI should be fine, too (Because YUI is very serious about namespaces).
_ Others should be fine as well
49. Joose does not
_ extend any default object prototypes.
Object.prototype.boom = function () {
alert(„Dont try this at home“)
}
50. Joose runs
_ in all common browsers
_ Rhino
_ JScript.NET
_ Flash comming soon
_ Ensured by an extensive automated test suite.
51. Joose runs
_ in all common browsers
_ Rhino
_ JScript.NET
_ Flash comming soon
_ Ensured by an extensive automated test suite.
ired :)
sting in IE6 requ
No extra te