Not sure why we need anything other than a flat hierarchy of objects in order to do OOP...
On 22 May 2012, at 21:53, Duncan Gmail <[email protected]> wrote: Not sure about using OOP instead of functional. But leaving that aside, what differentiates this from the Server-side MooTools? On 22 May 2012, at 18:07, Jeff Barczewski <[email protected]> wrote: Nodir, For OOP work, your defineClass looks really nice. I need to take a closer look but from first glance I like what you have created. Thanks for sharing! Jeff On Monday, 21 May 2012 21:25:33 UTC-5, Nodir Turakulov wrote: > > 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 -- 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 -- 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
