4 ms·
What a straw man. Saying that OO is all about inheritance is like saying that a Tesla cars are all about having a big touch screen dashboard.
by skrebbel 11y ago
What a straw man. Saying that OO is all about inheritance is like saying that a Tesla cars are all about having a big touch screen dashboard.
- deleted 11y ago[deleted]
- twic 11y agoThe best definition of object orientation I've come across recently is this one: http://wcook.blogspot.co.uk/2012/07/proposal-for-simplified-modern.html http://wcook.blogspot.co.uk/2012/07/proposal-for-simplified-... Which identifies two defining attributes of objects as a particular kind of value: they are collections of behaviours, and invocations of their behaviours are dynamically dispatched. Inheritance isn't required; it's polymorphism that's important, and inheritance is just one way to approach polymorphism.
- srean 11y agoIn what way would that be different from the use of simple closures. Given that they predated them by a couple of decades am interested in what new or different idea (or even practice) that OOP brings to the table. My question is sincere and genuine.
- twic 11y agoWell, Guy Steele suggested [0] that > A closure is an object that supports exactly one method: "apply". In which understanding, what objects add is the ability to have multiple methods associated with one bit of closed-over state. Now, you can do that without objects by creating several closures in one context and putting them all in a record to give them names. But at that point, you've just implemented objects. Hence the famous aphorism quoted in Steele's email: objects are a poor man's closures; closures are a poor man's objects. [0] http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg03269.html http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/m...
- srean 11y agoI prefer the second idiom: Create a tuple of different functions that are closed over a common state. You get privacy and data abstraction for free. This is nothing new or ground breaking, neither in theory nor in practice. This idiom will be familiar to everyone taking a 101. So I am yet to find what is it that OOP brings to the table. Some OOP fans seem to have a large chip on their shoulder, as if they saved the world. Want to understand what's all that about.
- twic 11y agoWhen you create a tuple of different functions closed over a common state, that is object oriented programming. If that's something you find useful, then you already understand what object oriented programming brings to the table.
- srean 11y agoBut that's my point, this has been a common practice decades before OOP fanboyism came to town telling everyone they have this new solution for all software problems of the world. And all they were selling as this new paradigm was not only old hat but a special case among the many in which closures can be useful. One uses it when it matches the problem domain. The overblown fuss around it and raising it to the grand position as _the_ solution to everything, and the assertion that you are doing it wrong if your code is not OOP, keeps me permanently mystified.
- seanmcdirmid 11y agoThat never happened though, not in the 80s/90s when OO was considered new (everyone had experience with objects before they were called objects). It is something people imagine a lot, probably so they can feel more smug hating on OOP. But really, any new technology will attract clueless fanboys who think they are working with something brand new (again, to support their smugness in pretending to be a pioneer). And let's not get started with the FP fanboys, who think they are "doing functional programming" when it's obvious from looking at their actual code that they are thinking in terms of objects and don't really get FP at all.
- srean 11y agoI was waiting for the one true Scotsman argument to show up in the discussion. I had to wait less than I expected. OOP fans seem to need resort to it more often than others, I wonder why. If you take away inheritance there is nothing that the conventional OOP languages facilitate over and above what languages with closures provide (happy to be educated otherwise). Those have been around some 30 years before. Anyone likes it or not inheritance is firmly a part of the baggage now inspire of Kay being quite clear about its utility or necessity
- mcphage 11y agoThey resort to it, because programmers who dislike OO have very bizarre views of what OO is, what it's all about, and how it's used.
- srean 11y agoLittle unsolicited wordly advice: If holding on to a belief requires you to rationalize that everybody else is stupid and wrong may be it is time to re-evaluate your belief. If OOP were that good how come nobody made a killing with an implementation that would make these 'true Scotsman' folks happy. What I am pointing out is that other paradigms don't seem to need such pervasive apologism.
- mcphage 11y ago> If holding on to a belief requires you to rationalize that everybody else is stupid and wrong may be it is time to re-evaluate your belief. Hardly. There's plenty of valid criticisms of OO out there. However, that does not mean every criticism of OO is valid. Take this one, for instance: the author is complaining that OO is optimized for class inheritance, when it's not the normal case. However, plenty of OO languages don't have classes, or inheritance, and so it falls on its face as a criticism of OO. > If OOP were that good how come nobody made a killing with an implementation that would make these 'true Scotsman' folks happy. Because no OO implementation will make them happy. A little unsolicited worldly advice: programmers think themselves paragons of rationality, but they're susceptible to the same flow of fashion, and the same desire to believe ill of something they don't like, as everyone else. > other paradigms don't seem to need such pervasive apologism. They do—take a look at the comments when articles come out critical of functional programming, most of which are as good as the one under discussion here. Or when OO supplanted structural programming the first place.