3 ms·
In 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
by srean 11y ago
In 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 agoAgreed in full about FP fanboyism, and exactly as you said, some write Java code in their shiny new language.