3 ms·
I consider "true OOP" what SmallTalk introduced. And the most fundamental thing in SmallTalk OOP is the encapsulation of complexity in the idea of an object, an
by antirez 6y ago
I consider "true OOP" what SmallTalk introduced. And the most fundamental thing in SmallTalk OOP is the encapsulation of complexity in the idea of an object, and the ability to pass messages to such objects that can be other objects, including "blocks". There is more than that to OOP, but I think that the fundamental idea is that code and functions operating on a given software component are defined within the concept of a class, and that objects only communicate with the other parts via messages. From that, a lot of things happen that are not obvious given this simple idea of OOP. For instance every object knows how to turn itself into a string, or to compare it with another one of its kind or of different kinds. And so forth.
- CyberDildonics 6y agoWhat smalltalk introduced is not widely spread, which would imply it is not what the title is about.
- scroot 6y agoMaybe. But the article opens by quoting Dave Robson's article in the 1981 Byte issue and even links to the archived version of the magazine. That issue was entirely dedicated to articles about Smalltalk. Robson's article is also about Smalltalk.
- igouy 6y agoAnd yet, the "Why is OOP still so widely spread?" article never mentions Smalltalk. Perhaps the author did not wish to admit that even back in 1980, "you [could] have your class Cake and EatCake() it too". [:each :aCake | each eat: aCake]
- dnautics 6y agoWhile that's true historically, SmallTalk has more in common with some functional languages (like erlang) than it does with even Ruby, which is directly a SmallTalk derivate. I think when everyone talks about OOP today they mean the lineage that descended from C++, which broadly is: Java, Javascript, C#, Python, and Ruby, to a lesser extent Go. Contemporary OOP is the enforced semantic association of data with their methods, encapsulation of private data, and shared memory.
- antirez 6y agoRuby and C++ OOP don't belong to the same lineage. Ruby is effectively "Smalltalk alike" OOP IMHO.
- dnautics 6y agoIt is under the hood but all of that is heavily encapsulated to make it more like other algol languages that people are familiar with.
- andrekandre 6y agothats really interesting what are the big differences that make ruby more algol-like? and conversely, what are the smalltalk features that make it less so?
- dragonwriter 6y ago> SmallTalk has more in common with some functional languages (like erlang) than it does with even Ruby, which is directly a SmallTalk derivate. Having used all three of the named languages, I disagree. Smalltalk has a lot more in common with Ruby than Erlang. > I think when everyone talks about OOP today they mean the lineage that descended from C++, which broadly is: Java, Javascript, C#, Python, and Ruby, to a lesser extent Go. Ruby, as you yourself noted, descends from Smalltalk, not C++. JavaScript descends from Self, not C++. Python doesn't really seem to descend from C++ either. I think you are confusing having (very loosely, in some cases) Algol-derived syntax for being descended from C++. > Contemporary OOP is the enforced semantic association of data with their methods, encapsulation of private data, and shared memory. I disagree with this description; shared memory is orthogonal to OOP, and encapsulation isn't even provided without awkward gymnastics in some of the contemporary OOP languages you (erroneously) describe as C++ descendants (e.g., Python has a unenforced convention for notating that a member should be considered private, and Ruby has private methods and makes instance variables essentially private, but also includes encapsulation-busting methods near the top of the inheritance heirarchy, like Object#instance_eval.) And without strict encapsulation, enforced syntactic association of methods with data also doesn't exist (not sure what enforced semantic association is supposed to mean, unless it is enforced by way of enforced syntactic association.)
- lmm 6y agoIf you're saying that the idea of namespacing together a data structure and functions that operate on that datastructure is OOP then I have to disagree; plenty of other paradigms do that. Likewise the idea of polymorphism: plenty of paradigms can express an interface for "can turn into a string" (and I think the idea that every object needs to support this is a mistake). The part that's unique to OOP is encapsulating mutable state in an object, and that turns out to be a mistake, IME.