by palata · 2y ago · 0 comments
For the former, then I would expect a computer science professor to do better than just bashing the concept. When is it good, and when is it bad? What did it bring to programming languages?
For the latter, I would expect a computer science professor to know that epidemiology is not their thing and they should refrain from concluding "stuff" from a scientific paper they found.
"The lesson you should draw is not that object-oriented is bad, but rather that whatever is the current trendy technique and trendy idea, is likely grossly overrated."
It just felt like it was meant as an analysis: "Learning from ..." and "The lesson you should draw is ...". But that is not what it is.
Why do you think it is a poor take? What are your views on OOP?
It's called "Learning from the Object Oriented Mania", but what did we learn exactly? Would the industry be in a better place if all languages looked a lot more like C? Or maybe Haskell? Does Rust count as OOP or not? Was Object Oriented an unjustified trend, or was it a "natural" evolution of languages?
That last question is actually similar to the mask question: was it indeed stupid to ask people to wear masks, or did it make sense at the time, given our understanding at the time? But the article misses on this opportunity by just bashing at the masks without going any further.
> What are your views on OOP?
My view (which I wouldn't consider informed enough to be a blog post) is that modern languages like Rust mostly drops class inheritance, but other than that they look a lot more like Java/C++ than C. And that's the new "trend": dropping class inheritance, "Composition over inheritance". Which is a fair point: class inheritance can have issues. In some cases it actually does make sense, but languages like Rust decide not to allow it (I guess partly to avoid "footguns" and partly for performance reasons).
But the idea of encapsulation in an object is there in the most popular modern languages. If the concept of calling `my_list.is_empty()` instead of `is_empty(my_list)` is "OOP", then I think it is actually still very much in fashion and for good reasons.
Encapsulation is not specific to OOP at all. C is not OOP and yet it has encapsulation just fine.
> If the concept of calling `my_list.is_empty()` instead of `is_empty(my_list)` is "OOP", then I think it is actually still very much in fashion and for good reasons.
You're absolutely right, it's fashion.
> And that's the new "trend": dropping class inheritance, "Composition over inheritance".
New trend, huh? You realise that that saying came out 30 years ago? It took that long for the brainwashed OOP masses to even acknowledge that inheritance is bad.
The point of scientific papers is for experts to share observations with other experts. Given enough studies, a group of experts may reach a consensus. Believing that a single study "proves" anything at all is a big misunderstanding of how science works. A single study "suggests" something, but the goal is to reach a consensus.
In this particular case, a computer science professor who is (apparently) not at all an expert in epidemiology throws sarcasm against an emergency response to Covid-19 for no apparent reason (unless object-oriented was an emergency response to some virus, I don't know).
What this computer science professor could do (but doesn't), though, is bring insights related to their expertise (presumably "computer science"). I mean something other than "object oriented == baaaaad, believe me".
I am pretty sure you understood what I meant: it is a poor take in terms of computer science (which I find disappointing coming from a "computer science professor") that includes unnecessary bashing at a completely unrelated measure.
If that were the case there'd have been no open access movement, and papers wouldn't even exist at all, just discussions in conference halls and private listservs. You also wouldn't need citations because you'd just assume every reader was already familiar with the literature.
The point of scientific papers is to disseminate knowledge and findings as widely as possible. This is the first time I've seen anyone explicitly argue otherwise.
> Believing that a single study "proves" anything at all is a big misunderstanding of how science works
If a single paper is done correctly then it can in fact prove things. History is full of examples like that. Again, the idea that science is all about consensus is just wrong - it's an idea modern academics cling too far too regularly but it's simply not true. Einstein himself said that.
Open access means that people don't need to be researchers at Harvard to have access to science. You can be an expert without being rich or without working in a rich university. I won't address the last part of the sentence because it is preposterous.
> The point of scientific papers is to disseminate knowledge and findings as widely as possible. This is the first time I've seen anyone explicitly argue otherwise.
Sure it is! But the target audience of a paper is quite obviously other experts in the field.
> If a single paper is done correctly then it can in fact prove things. History is full of examples like that.
Well of course, it can happen: a mathematical proof does not need consensus. But a study about the efficiency of masks in preventing Covid-19 is extremely different. If you are not convinced, try to read the study in question. The tone there explicitly shows that there is no certainty: they contribute valuable information, but it's not a definitive proof.
Not to mention that even if we could say today that masks were not effective, it does not mean that back then it was a ridiculous decision. Back then we did not know exactly how Covid-19 was propagating, so it seemed reasonable to wear masks.
Good question. OOP seperates software into isolated units called "objects". But in order to function as a cohesive whole, these units have to communicate somehow. And this is usually where the fun begins.
OOP intentionally turns all software into a distributed system --- even if it is not distributed.
Whether there is any real advantage to this is a matter of opinion --- it can't be proven one way or the other. But in my experience with distributed systems, it is often less efficient and more difficult to see and reason about the logic flow and harder to debug and test. Your mileage may vary.
OOP turns software into a message passing architecture, which definitely has its advantages if the software you need to write fits well into its compartmentalisation features.
Like you mention (and as with almost anything with software development) it's a trade-off, reasoning about the logic flow can be harder if the design of the OOP software is too convoluted but the same is absolutely true for a badly designed C code with function calls, I don't think OOP itself makes software harder to reason about but it has footguns with its features to make code unreadable through layers of indirection/delegation, badly designed inheritance models (which I tend to avoid nowadays, I really prefer composition over inheritance for most cases), etc.
OOP does have a message-passing version, but even though the coiner of the term prefers this version, no one in the industry used it that way.
The industry settled on method calls as the primary channel for these messages, which are most of the way a form of synchronous communication on the same thread, quite far from being a distributed system.
Object `a` calling a method from object b’s public API is not a distributed system at all. And while I do agree that this cohesive whole is not necessarily represented in OOP, one solution is to create an object over the whole, that itself upholds the necessary conditions/order/etc between its subcomponents, exposing only a higher level API to the outside world, and making those subcomponents otherwise inaccessible.
What is the fundamental difference between a 'method call' and a 'message pass'?
In both scenarios, you can be synchronous or asynchronous, blocking or non-blocking, remain on one thread (technically 2 if it's across a network) or fork out into multiple threads. You can wait for a result, or you can fire-and-forget (void). A networking problem is just another kind of Exception.
Even in a typical microservice codebase, it's not immediately apparent from reading the code whether userService.createUser() will call across a network, or just into another class.
The only fundamental difference I can think of right now is that in a non-networked system, you can be pretty sure your static typing holds for the whole program, whereas in a networked system, your types might drift between versions.
But again, more similarities than differences.
Also, Smalltalk and alia of the “real OOP” kind has some extremes with regards to messaging, like the number 3 being told to increase itself by one, which would not be done this way in today’s OOP languages and not just for performance reasons.
Method calls are more of a degenerate case of a distributed system, which is significantly easier to reason about.
This is my main beef with OO: a good design will have good clean statefulness, and getting there is completely orthogonal to how much object-orientation you got.
Could you elaborate on that? And would you say for instance that Rust suffers from the same problems? Because Rust offers many characteristics of OOP.
Distributed systems typically rely on messaging passing to some sort of "interface" in order to communicate and coordinate actions with remote nodes. Objects work much the same way and are designed to mimic the characteristics of an independent, remote computer node.
This can be done in any language that offers encapsulation of data, methods and state.