If anybody is still interested in OOP, I've made an npm 
package<http://search.npmjs.org/#/defineClass>that provides: 

   1. Class inheritance
   2. True method overriding
   3. Proxy class generation
   4. Scala-like traits (Ruby-like mixins)
   5. Nested classes (with overriding in subclasses).
   
Here is an example of usage:

var Person = defineClass({  cash: 0,
  constructor: function (firstName, lastName) {
    this.firstName = firstName;
    this.lastName = lastName;
  },

  greet: function (name) {
    console.log("Hello " + name + ". My name is " + this.firstName);
  } });*var* Developer = defineClass({   _super: Person,

  // override a field default value
  cash: 100,

  // override the constructor
  constructor: function (firstName, lastName, language) {
    // you may have code before the base constructor call

    // call the base constructor
    this._super(firstName, lastName);
    this.language = language;
  }

  // override a method
  greet: function (name) {
    console.log("Hey, " + name + ". I'm " + this.firstName)
  },

  // override a method and call its base method
  earn: function (amount) {
    return this._super(amount * 1.2);
  }});

More in the readme: https://github.com/nodirt/defineClass

Installation:
    
    $ npm install defineClass

-Nodir

On Friday, May 6, 2011 12:07:47 PM UTC+5, Thierry Templier wrote:
>
> Hello, 
>
> I wonder what is the best / recommended approaches and/or JS libraries 
> to use in order to implement OOP within node.js applications. 
>
> Thanks very much for your help! 
> Thierry

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to