JOOT - JavaScript Object-Oriented Tools

A

Aleksey Zhendi

Description:
JOOT is a small JavaScript library that provides convenient and
simple API designed for sole purpose: to simplify creation of the
object-oriented code.

Project URL:
http://code.google.com/p/joot/

Features:
* Narrow purpose. No redundant API.
* Simple and convenient API.
* Fully based on the ECMAScript specification (ECMA-262 3rd edition).
* Respects ECMAScript 5 "strict mode".
* No environment-specific code.
* No external library dependencies.
* Does not modify native objects.
* Minimum probability of name conflicts. Adds only a single property
to the global context.
* Small size.
 
M

Michael Haufe (\TNO\)

Description:
   JOOT is a small JavaScript library that provides convenient and
simple API designed for sole purpose: to simplify creation of the
object-oriented code.

Project URL:
   http://code.google.com/p/joot/

Features:
 * Narrow purpose. No redundant API.
 * Simple and convenient API.
 * Fully based on the ECMAScript specification (ECMA-262 3rd edition).
 * Respects ECMAScript 5 "strict mode".
 * No environment-specific code.
 * No external library dependencies.
 * Does not modify native objects.
 * Minimum probability of name conflicts. Adds only a single property
to the global context.
 * Small size.

Yet another "OO" library.

For easier review/consumption, could you provide an example of how
your library would implement this:

function Animal(){}
function Cat(){}
Cat.prototype = Object.create(Animal.prototype);
Cat.prototype.constructor = Cat;
Cat.prototype.myExtendedMember = function(){
return "foo";
}

While maintaining the appropriate constructor and instanceof
relationships.
 
A

Aleksey Zhendi

Yet another "OO" library.

For easier review/consumption, could you provide an example of how
your library would implement this:

function Animal(){}
function Cat(){}
Cat.prototype = Object.create(Animal.prototype);
Cat.prototype.constructor = Cat;
Cat.prototype.myExtendedMember = function(){
    return "foo";

}

While maintaining the appropriate constructor and instanceof
relationships.

1) Yes of course:

var Animal = joot.createClass();

var Cat = joot.createClass( {
$parent: Animal,
myExtendedMember: function() {
return 'foo';
}
} );

var x = new Cat();

console.log( x instanceof Animal ); // true
console.log( x instanceof Cat ); // true
console.log( x.constructor === Cat ); // true

2) JOOT emulates inheritance by linking classes prototypes.
To emulate true private properties\methods we must declare them in the
constructor function with 'var' statement.
So they are stored in a closure, not in the class prototype.
So the answer is no.

3) Although it can be easily implemented, for now there is no any
'sugar' for it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top