[Tutor] [Slightly OT] Inheritance, Polymorphism and Encapsulation

Kent Johnson kent37 at tds.net
Wed Sep 19 13:08:15 CEST 2007


Alan Gauld wrote:

> What I was referring to was the lack of any kind of class 
> structure at all, a purely prototype driven OOP style. 
> (Somewhat like JavaScript OOP except that it's very easy 
> to fake classes in JavaScript)

Wikipedia has an article about prototype-based programming:
http://en.wikipedia.org/wiki/Prototype-based_programming

Among others, it lists JavaScript (and its variations), Lua and Self as 
prototype-based languages.

This paper makes an interesting argument for prototype-based OOP in 
user-interface programming:
http://waltersmith.us/wp-content/uploads/2005/12/OOPSLA95.pdf

They say that in UI programming, single-use classes are often created; 
classes that implement a specific widget or window. In these cases the 
dichotomy between class and object is not useful, in fact it adds extra 
cognitive load to the program without providing any benefit. 
Prototype-based programming is a better fit for this problem domain 
because instanced with the desired behaviour are created directly.

Kent


More information about the Tutor mailing list