6

It is easy to find the origin of the term OOP coined by Alan Kay when he created Smalltalk, but I can't find if when creating the language he also created the 3 tenets of OOP (Encapsulation, Inheritance, Polymorphism). Especially since he is much more focused on the message passing aspect of the language.

So where did the 3 pillars originate from? Was it Smalltalk and Alan Kay or someplace else?

10

Alan Kay may have created the term, but object-oriented programming didn't originate with Smalltalk; it originated with Simula, an ALGOL variant with classes and many of the concepts we consider to be core OOP principles today, including inheritance and virtual methods (polymorphism).

Encapsulation (private, protected, public) was not in the original Simula, but it was added to the TOPS-10 version, and was later integrated into Simula 87. From there, these core concepts have spread to the rest of the object-oriented world.

For all Alan Kay's talk of inventing OOP, it's Simula's style that has been successful. Smalltalk-style OOP has largely failed in the marketplace of ideas everywhere and every time it's been introduced, with one notable exception. Objective-C uses Smalltalk-style OOP, and it's found a good deal of success in iOS, because Apple built their whole API around it and thus shoved it down their developers' throats. Outside of the Apple ecosystem, though, Objective-C is as little used as any other implementation of OOP-by-message-passing.

  • 4
    I'm not sure I agree with calling JavaScript or Ruby a failure. – Jörg W Mittag Dec 22 '14 at 4:33
  • 1
    @JörgWMittag: I certainly wouldn't call either language a success. JS rode HTML's coattails to prominence by being the only game in town, but developers with experience in other languages almost universally hate it. Just look how popular alternative languages that compile down to JavaScript are becoming! And Ruby was popular for a while, but these days it really feels like a fad whose time has come and gone, as people start to (re-)discover the problems inherent in message-passing OOP. – Mason Wheeler Dec 22 '14 at 4:47
7

Both Encapsulation and Polymorphism are consequences of Message Passing. (If all you can do is send a message and wait for a response, then you cannot possibly know what the receiver does to generate the response (Encapsulation) and different receiver may respond differently to the same message (Polymorphism).)

Alan Kay liked Inheritance, but didn't consider it fundamental. In fact, he designed the first version of Smalltalk without inheritance, because he couldn't figure out how to do inheritance without classes, and he disliked classes even more than he liked inheritance. It was only when Dan Ingalls came up with the design of metaclasses that Dr. Kay found classes at least somewhat acceptable. In any case, he considered inheritance simply a method of code reuse, not something inherent to OO.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.