4 ms·
The advantage of OO has always been its accessible constructs and abstractions that mirror how we talk about things linguistically. Nouns are just sticky that w
by seanmcdirmid 12y ago
The advantage of OO has always been its accessible constructs and abstractions that mirror how we talk about things linguistically. Nouns are just sticky that way. It isn't a big delta over procedural programming, and you can find object systems in many C programs written before OOP was even a word. Heck, even Clojure has its own object systems; they just often call them entities rather than objects (what is an entity? well, its an object, but not the object you are used to). I think our current OO abstractions suck, but the paradigm is OK, especially when considered in the abstract (go back to the treaty of Orlando to see how diverse objects can be!). And the biggest pushers of objects in the early day were CLOS people like Richard P Gabriel, and CLOS (edit: Flavors actually as lipsm points out) gave us mixins, which are a pretty advanced OO construct (though RPG argues the mixins that got adopted in OO languages were not the ones CLOS intended).
People were using LISP in production in the 90s as an advantage, but then they were also using Smalltalk or Objective C also (ironically often in the same places...on Wall street). A new generation is discovering LISP while learning other languages first, but the phenomena is the same: OO was just less popular in the past and so they would come from C or Perl instead of Java.
[edit: not sure why you were downvoted, I thought your post was completely reasonable]
- lispm 12y agoMixins are from Flavors, not CLOS. CLOS has no special support for mixins - they are just a sub-functionality of CLOS.
- seanmcdirmid 12y agoThanks, my understanding of history is probably a bit confused: http://en.wikipedia.org/wiki/Mixin#In_Common_Lisp http://en.wikipedia.org/wiki/Mixin#In_Common_Lisp In RPG's inconsumerability essay [1], he describes it like: > In that paper they described looking at Beta, Smalltalk, Flavors, and CLOS, and discovering a mechanism that could account for the three different sorts of inheritance found in these languages—including mixins from Flavors and CLOS. They did come from Flavors first regardless (mixins being named after an ice cream shop with mixins near MIT, so I heard). I think it was also the first system to allow for aspect advice via a first-class construct. [1] http://www.dreamsongs.com/Files/Incommensurability.pdf http://www.dreamsongs.com/Files/Incommensurability.pdf
- lispm 12y agoMixins were introduced with Flavors by Howard Cannon in 1979. Flavors/Mixins were used to implement some of the early MIT Lisp Machine user interface, IO and networking code. http://lispm.de/docs/Publications/Flavors/Flavors,%20a%20non-hierarchical%20approach%20to%20object-oriented%20programming.pdf http://lispm.de/docs/Publications/Flavors/Flavors,%20a%20non... 'aspect advice' was mostly introduced in Lisp in 1966 by Warren Teitelman: http://dspace.mit.edu/handle/1721.1/6905 http://dspace.mit.edu/handle/1721.1/6905 See the discussion of ADVISE and a BEFORE example in the paper... From there it came to Interlisp, Maclisp, Flavors and CLOS...
- seanmcdirmid 12y agoThanks. The Teitelman work is what I cite as the introduction of aspects, but I didn't realize it was more than just a pattern back then.
- twic 12y agoBecause people come to the HN comments for stimulating, challenging, passionate expressions of thought, not reasonable ones!
- mikerichards 12y agoThe advantage of OO has always been its accessible constructs and abstractions that mirror how we talk about things linguistically. Nouns are just sticky that way. But I only see that argument giving an advantage to some weird language that doesn't have structures. In C, Pascal, COBOL, you have "objects"....you just don't have any methods attached to them. And the biggest pushers of objects in the early day were CLOS people like Richard P Gabriel, and CLOS (edit: Flavors actually as lipsm points out) gave us mixins, which are a pretty advanced OO construct (though RPG argues the mixins that got adopted in OO languages were not the ones CLOS intended). I'd argue that methods and data don't belong together (like in CLOS), but don't have the inclination to argue it right now. I'll just say it's never felt natural to me, and actually hurts reusability.
- seanmcdirmid 12y ago> In C, Pascal, COBOL, you have "objects"....you just don't have any methods attached to them. When I encoded my own objects in C, I definitely had v-tables (though I didn't know they were called that at the time). > I'd argue that methods and data don't belong together (like in CLOS), but don't have the inclination to argue it right now. It is difficult not to put behavior and data together while still having encapsulation (it is still possible). It makes much more sense for functional programming since values lack identities (they are completely defined by their structure), but objects have state that need to be protected for sanity reasons.
- bad_user 12y agoYeah, but your argument is kind of circular - we put behavior and data together because we need encapsulation and we need encapsulation because objects have an identity that needs protection, yet those objects need an identity because we are putting behavior and data together, in combination with mutability of course. Also encapsulation happens quite well in languages that do not have the "private" or "protected" keywords. In Javascript encapsulation happens by closures and local scoping. In Python it happens by convention. Also, take most software developed ever in an OOP style and you'll find plenty of examples of leaky encapsulation (i.e. APIs that leak restricting implementation details), starting with the popular Iterator. IMHO, the best abstractions I know come from languages that are not OOP at all. I'd also argue that the encapsulation you're talking about doesn't have much to do with OOP in general, only with a particular flavor of it. But that's the problem in all conversations about OOP - take any 2 random people and they'll have different opinions about what OOP is. For me OOP is about subtyping or more specifically a form of ad-hoc polymorphism that's solved at runtime. It's very convenient for modeling certain kinds of problems for sure - graphical UIs are the best example, or a browser's DOM and even die-hard detractors would find it hard to argue that a Monoid isn't a Semigroup, or that a Set shouldn't be a Function. In fact, objects in OOP do not necessarily need an identity, in which case they are just values, yet you can still put that polymorphism to good use. But then OOP as implemented and used in mainstream languages is truly awful, being no wonder that people still consider C with half-baked object systems as being something acceptable.
- weavejester 12y ago> The advantage of OO has always been its accessible constructs and abstractions that mirror how we talk about things linguistically. I don't think there's much of a connection to natural language. OO is about commanding objects through messages; if we must make a connection to language, it would be equivalent to the imperative tense. > Heck, even Clojure has its own object systems; they just often call them entities rather than objects Which object systems would these be?
- seanmcdirmid 12y ago> I don't think there's much of a connection to natural language. OO is about commanding objects through messages; if we must make a connection to language, it would be equivalent to the imperative tense. I've designed non-imperative OO languages before; e.g. http://research.microsoft.com/apps/pubs/default.aspx?id=179366 http://research.microsoft.com/apps/pubs/default.aspx?id=1793... The community didn't scream out and say "but that language doesn't have messages, it can't be object oriented!" Of course, Alan Kay wasn't at ECOOP that year, but I did get an argument from Ralph Johnson that what I did was just Smalltalk :p. > Which object systems would these be? Clojure's (Rich Hickey's?) ideas about OO are surprisingly close to my own: http://clojure.org/state http://clojure.org/state > OO is, among other things, an attempt to provide tools for modeling identity and state in programs (as well as associating behavior with state, and hierarchical classification, both ignored here). OO typically unifies identity and state, i.e. an object (identity) is a pointer to the memory that contains the value of its state. The important thing about objects is their identity; they have names like Fred or Bob; they aren't anonymous values that can only be identified by their structure 42 or (2, 3). > There is no way to observe a stable state (even to copy it) without blocking others from changing it. He is not against objects, just how they are realized in imperative languages. > OO doesn't have to be this way, but, usually, it is (Java/C++/Python/Ruby etc). Yep. So he solves the problem in a smart way: > In coming to Clojure from an OO language, you can use one of its persistent collections, e.g. maps, instead of objects. Use values as much as possible. And for those cases where your objects are truly modeling identities (far fewer cases than you might realize until you start thinking about it this way), you can use a Ref or Agent... I will disagree, as soon as you have a collection with a key that is a GUID (or a name like Fred or Bob), you've just invented an object, whether its properties are embedded in the object or not. Clojure just has its own ways of doing OO programming. If you hate OO, then you might simply claim "it is not OO", but this definitely is not pure functional programming that lacks identity at all (and pure Haskell solutions really do avoid all of this, Haskell is very non-OO in ways that pragmatic LISPs are not). Note that there are other ways of fixing this problem, one can manage time so that object properties are always observed safely; this is the approach I'm currently taking with my own research: http://research.microsoft.com/pubs/211297/onward14.pdf http://research.microsoft.com/pubs/211297/onward14.pdf