JavaScript Class Inheritance Framework

October 29th, 2009 | Posted by Quixey in Technology - (1 Comments)

In order to write elegant JS code, the first thing we needed was to set up a framework for object-oriented programming. A lot of what we need is already built into the JavaScript language, which is a fully object-oriented language. But we wanted to sidestep some of the pitfalls of standard inheritance patterns while adding some extra features.

We started with this class inheritance framework by John Resig, which gave us the ability to write beautiful code like this example from Resig:

var Person = Class.extend({
    init: function(isDancing){
        this.dancing = isDancing;
    },
    dance: function(){
        return this.dancing;
    }
});

var Ninja = Person.extend({
    init: function(){
        this._super( false );
    },
    dance: function(){
        // Call the inherited version of dance()
        return this._super();
    },
    swingSword: function(){
        return true;
    }
});

var p = new Person(true);
p.dance(); // => true

var n = new Ninja();
n.dance(); // => false
n.swingSword(); // => true

// Should all be true
p instanceof Person && p instanceof Class &&
n instanceof Ninja && n instanceof Person && n instanceof Class

Resig’s framework is great, but we wanted some additional features in our Class implementation:

(more…)

Quixey’s Technology

October 29th, 2009 | Posted by Quixey in Technology - (0 Comments)

We are doing some serious software engineering to help users discover apps. We’ve decided to bring back our tech blog in order to give you an inside view of the product we’re building. In this section of the blog, you’ll be able to read about our unique technology and how it’s built.

A few interesting points as we begin:

  • On the back end, we’re using the Django web framework on top of Google App Engine for data storage. Just your standard, solid, elegant back-end stack.
  • On the front end, we’re doing some cutting-edge stuff. We have decided to render the entire page client-side using JavaScript.
  • Of course, the danger of JavaScript is that it gets messy. That’s why we’ve written an extremely elegant, object-oriented framework for AJAX sites rendered client-side.

More info about our technology will be coming soon.