Search code examples
oopobjectimplementationsmalltalksqueak

Implementation Strategies for Object Orientation


I'm currently learning Smalltalk in the Squeak environment and I'm reading "Squeak - A Quick Trip To ObjectLand". I enter the object-oriented paradigm with some prior knowledge from Python and Java and this sentence from the book on page 36 has made me think:

Smalltalk is a class-based implementation of an object-oriented language.

Short sentence but very interesting. In OO all terms like class, object, instance seem to be well-defined and seem to point to the one and only true meaning and you're likely to come across generic sentences like "objects are instances of a class".
But you hear seldom about implementation strategies. What does implementation of the object-oriented concept mean in this case? Are there implementations of OO languages other than classes?


Solution

  • Javascript is a prototype based implementation of an OO language.

    Instead of subclassing a class and creating an instance of that new class, you inherit behaviour by cloning a prototype.

    As a historical note I should add that while Javascript is probably the most widely used prototype-using language, the first was David Ungar's and Randall Smith's Self language.

    There are several implementations of prototypes floating around for Squeak. I haven't used them, so I can't comment on the libraries.