Sunday, February 10th, 2008 at 3:53 pm
Filed under: Javascript
If you’re anything like me, hardcore object-oriented Javascript coding always come with unexpected errors and some of the strangest behavior you can’t really explain.
But that’s always the programmer’s fault, of course. It turns out Javascript isn’t made to be used in a object-oriented way, but rather in a prototype-oriented fashion.
This lengthy post compares Java and Javascript and explains how a Javascript programmer should implement object inheritance.
I found a few things strikingly useful in there, notably the delegation of the whole obj.prototype reference and the fact he never explicitly declares any class attributes as he does in Java (and how I was trained to do it).
Comments
Responses are currently closed, but you can trackback from your own site. No Responses to “OOP Javascript”.