Friday, March 24th, 2006

Dean Edwards and Another Base.js

Category: JavaScript, Library, Tip

Dean Edwards is a smart man, and wasn’t happy with any Base classes out there in various libraries so he wrote his own Base.js.

His goals:

  • I want to easily create classes without the MyClass.prototype cruft
  • I want method overloading with intuitive access to the overloaded method (like Java’s super)
  • I want to avoid calling a class’ constructor function during the prototyping phase
  • I want to easily add static (class) properties and methods
  • I want to achieve the above without resorting to global functions to build prototype chains
  • I want to achieve the above without affecting Object.prototype

Check out Dean’s Base.js

Posted by Dion Almaer at 6:56 pm

3.7 rating from 47 votes


Comments feed TrackBack URI

Good stuff, but I was confused at first with this.inherit(), I thought it was more of a declaration of inheritence (like .extend() is), not calling an overridden method.

Comment by Andy — March 25, 2006

I agree that this is good stuff, but I also think it’s funny that we feel a need to “fix” javascript so that it looks more like a class based, declarative language than a prototype based one.

Maybe the emergence of Ajax and the influx of developers used to strongly typed languages will drive some innovations and changes in Javascript. One can only hope.

P.S. Can we go back to calling it Livescript again? ;-)

Comment by dkappe — March 27, 2006

P.S. Can we go back to calling it Livescript again? ;-)

ahahah good idea, i’m tired to have to explain that JavaScript have nothing to do with Java

Comment by h3 — August 30, 2006

Leave a comment

You must be logged in to post a comment.