3 ms·
Alan Kay claimed that the big ideas of OO were polymprhism and encapsulation, which not only are first-class features of Clojure but one of its main selling poi
by cynicalkane 11y ago
Alan Kay claimed that the big ideas of OO were polymprhism and encapsulation, which not only are first-class features of Clojure but one of its main selling points, via protocols. Haskell type classes support behavior inheritance and subclassing, with monad subclasses being the preferred way to encapsulate state.
When people talk about how their favorite FP language is not OO, it raises my hair a bit and wonder what kind of code this person produces. A Clojure programmer will throw out some multi-level map reduce that abstracts over arbitrary sequences and then jam an ordered tree map into it, and claim it's not OO. And I'm like, what do you think polymorphism and encapsulation are?
- cies 11y agoThanks for your reply. I guess my wording is not entirely accurate. I meant OO-class-based-inheritance and OO-class-based-encasulation-of-state. > I'm like, what do you think polymorphism and encapsulation are? Well, when writing Haskell I'm not dealing with object instantiation, OO-classes and OO-subclassing. I have no problem with encapsulation per se; it is an important tool of creating abstractions needed to reach any kind of productivity. It is more that the OO-style of encapsulation is no longer something that I believe works in the long run. In popular Haskell terms "it does not compose" or more lay-men terms "its likely facilitates creating a lot of maintenance burden".
- dragonwriter 11y agoI think one of the reasons people talk past each other on this issues is for lots of people, "OO" isn't the concepts that had been around under that name for at least a couple decades by the 1990s, but rather the particular mechanisms by which those ideas were realized in the popular OO languages of that time, most notably Java and C++. While for other people, Java and C++ are just examples of a particular approach to adding some OO features to an otherwise C-like language, and aren't definitive (or even necessarily very good, particularly in the early forms) examples of OO support in a programming language. This leads to both a narrow idea of what OO is (mostly limited to the way those languages differed from C), and the idea that OO is incompatible with FP (because early Java and C++ had poor FP features, even though some earlier languages in which the OO paradigm had been supported had much stronger functional features.)
- vectorjohn 11y ago> Well, when writing Haskell I'm not dealing with object instantiation, OO-classes and OO-subclassing. I think what the person you're replying to is saying is you actually are. You don't literally write "Foo x = new Foo()" but that's just a syntactic feature of some language. Haskell has types and classes and sub classes. You just don't write them the same way.
- cies 11y agoI upvoted you, but I strongly disagree with that I actually am using those in Haskell (knowing that you did not say that but merely point out what was said). In the theoretical sense OO and FP share some concept like encapsulation and polymorphism. But a class in C++/Java/Ruby is whole other thing then type-classes in Haskell.
- rukuu_001 11y agoAlan Kay believed the big idea in OO is message passing: http://c2.com/cgi/wiki?AlanKayOnMessaging http://c2.com/cgi/wiki?AlanKayOnMessaging