JavaScript Object Oriented Programming
June 20th, 2010 by JorisO | Filed under Front-end development, JavaScript.Practical usage of classical object oriented programming methodology in any scripting or programming language can usually be explained by setting apart the language-specific implementation of the principles of polymorphism, inheritance and encapsulation.
JavaScript is somewhat of a different animal when it comes to object oriented programming. It is one of the few widely spread (or even the most widely spread) fully prototype-based programming languages. Prototype based languages depend on premises different from what most programmers familiar with object oriented programming techniques have come to rely on.

Prototype-based programming
In prototype-based programming there’s is no real distinction between class and instance or object. Prototype-based programming is a manner of object-oriented programming in which the concept of class is simply not existent , and inheritance is performed via a process of cloning existing objects that serve as prototypes. This model is also known as class-less, prototype-oriented or instance-based programming.
The first and iconic programming language fully based around the idea that the duality between class and object actually impedes the efficiency and flexibility of scalable complex systems, was “Self“. In Self, and the prototype-based languages emulating it, the distinction between class and instance is completely eliminated. Only objects, or instances exist and are acted upon. The idea was that this would increase flexibility and allow complex structures to respond to change and variety much easier and also use computer resources more efficiently.
Although the prototypal-based model was thus set up as an improvement to the classical model of OOP several paradigms attempting to re-conciliate JavaScript with classical class based OOP have become popular, mainly to appease the large community of programmers who grew up on the classical model of OOP.
Some popular methods among these are described here:
OOP JavaScript
Correct OOP JavaScript
http://www.prototypejs.org/
Douglas Crockford
Ideally however, one would not try to revert to the classical model and instead try to take full advantage of the possibilities offered by the prototype based syntax. For some ideas on how to do this see the next article on Inheritance in JavaScript
Tags: ActionScript, JavaScript
[...] conceptually simpler than classical model – the prototypal model offers much more flexibility in the implementation of inheritance, making it easier for for a [...]