3 ms·
I 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 not
by srean 11y ago
I 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.