5 ms·
Yes, the article is terrible as it does not show any polymorphism. Also, yes, doing genuine polymorphic OO in C ends up horrible because you invent a new langua
by lll-o-lll 4y ago
Yes, the article is terrible as it does not show any polymorphism. Also, yes, doing genuine polymorphic OO in C ends up horrible because you invent a new language. (Source: many years working on a truely evil code-base of OO C. Originally the work of one twisted genius. Brilliant, but evil).
OO was just a failed paradigm anyway, I’m amazed anyone would try and shoe-horn it into C in the modern day.
- isityouyesitsme 4y agoI don't think OOP has failed at all. It has become the foundation of all reusable code in every language. What failed was the idea that internal state can be managed and shared with derived classes. The key to OOP is extracting the idea of types/concepts into interfaces that may have different implementations. You don't even need a language that supports polymorphism as a first-class concept in order to do this, though it is certainly much safer. Python chooses duck typing, modern C++ uses "concepts," etc. You can do SOLID under any of this. Some languages or frameworks take it too far and think of everything as an instance of a base object, for no great reason. I guess a summary of my thesis is that the "L" in SOLID is what makes an architecture OOP.
- lll-o-lll 4y agoEh, this is a very separate debate. You don’t need OO for modularity. This should be obvious. You need an API/Contract and for re-use you need a “module” (such as a dll or a web interface). For example something like: int CreateTheStatefulThing(blah* thing); DoStuffWithThing(blah* thing); void CleanUpThing(blah* thing); To suggest OOP is the foundation of reusable code is simply wrong.
- isityouyesitsme 4y agoYou are reading in to what I wrote something I did not say. I said that "OOP has become the foundation," not "OOP is the foundation." There is a very big, historical, fact-based distinction between those two statements. Modularity and reuse are completely different things. A highly modular codebase is more amenable to write reusable code, but many modular systems have been written with very little concept and code reuse. Of course there was a measure of reusable code before OOP was a more formalized language for discussing it. But to say "you can do these things without OOP" is like saying you don't need structured programming to write maintainable systems. And it's like "ok, but you're still using "if," possibly "return," and you know... functions." Essentially the exact same ideas that the paradigm gave formal language to. I think people who say that OOP wasn't responsible for the understanding of modern paradigms haven't read much of the theory behind it and have hyper focused on the poor series of books and articles that came out from the 1980s through about 2010 that encouraged hidden state ownership and inheritance of state.
- lll-o-lll 4y agoAnyone who disagrees with you is simply poorly read and uninformed? You cannot separate theory and practice in the way you are attempting to. It’s not just “bad books” that lead to the abuse of inheritance that is so familiar, there were (and are) broken concepts that only became visible with time. I highlighted “module” for a reason, because one of the key mistakes of practitioners was to view the element of re-use as the “class”. In reality if we want to create a reusable component the boundary is much higher. We create an api and a library or some other component that can be distributed. Building a reusable component is much more work, and recognising when that is necessary and designing accordingly is an important engineering discipline. To finish with a snipe of my own; I think people who take an OOP is primary view of the world need to do a little more programming in lisp to properly understand the fundamentals.
- isityouyesitsme 4y agoYour straw men fall easily. But your "snipe" doesn't even apply. I spent the two years of my masters program editing a NASA-owned LISP codebase. it wasn't huge. Maybe 100kloc. But I'm definitely not ignorant or LISP. Look, you don't like OOP, who cares? I certainly don't. But that's different than trying to explain that you have a fundamental misunderstanding. Whether you accept it or not, it's in your head now ;)
- lll-o-lll 4y agoI’m too old and tired for the insult slinging anyway. What’s my fundamental misunderstanding? What’s the straw man? Class == re-use? I don’t hate OO by the way, it’s just not the first, only, or in my opinion best way to think about or structure code. I do think the expectations that OO would bring increased productivity, code-reuse, etc were not realised and hence why I referred to it as a “failed paradigm”. Not because it is bad from a theory perspective, but because in practice none/few of the things it was expected to deliver actually materialised. And also that the real challenges with “code reuse” are different. I have read the bad books, but also the good books. I’ve done more OOP programming than anything else over my career, and it can be done well. I’ve also worked with and coded in extremely well written C code bases. I just can’t see the value that OOP provided over modular C. Perhaps you can enlighten me?
- rramadass 4y agohttps://news.ycombinator.com/item?id=34220101 https://news.ycombinator.com/item?id=34220101
- lll-o-lll 4y agoThis isn’t a religion. I really don’t see what is so controversial about suggesting OOP has clearly failed on the majority of its original stated goals. That’s not to say that nothing has been salvaged from the wreckage; languages like Rust are a great example of retaining what actually was useful.
- isityouyesitsme 4y agoWell, maybe. But that is a different debate. I do not see where this topic was raised, except by you right here.
- rramadass 4y ago>I really don’t see what is so controversial about suggesting OOP has clearly failed on the majority of its original stated goals. Because it is not borne out by facts. The explosion of software since the 80's(?) was a direct result of OOD/OOP becoming the dominant paradigm. Your posts remind me of this: https://twitter.com/awbjs/status/625082965257654272 https://twitter.com/awbjs/status/625082965257654272
- lll-o-lll 4y agoSo my views are hopelessly uninformed opinions, while yours are undeniable facts? Please do go on and prove how the explosion of software since the 80s was the direct result of OOD/OOP. Please be sure to reference Linus, Joe Armstrong, Alexander Stepanov. Surely such undeniable facts will be supported by relevant leaders in the field? This quote from Eric Lippert clearly sums your position well “ “It may be that this success is a consequence of a massive industry that supports and is supported by OOP.” which is true by virtue of it being tautological. We can do better than a tautology to answer the question posed in the title of the piece by observing that OOP style directly and deliberately maps well to the typical hierarchical organization of large corporations. Why do we hate working in OOP? For the same reasons we hate working for inflexible, siloed, process-heavy, policy-heavy, bureaucratic, mutually-distrusting teams in corporations. Why is it a success? For the same reasons that those corporations are successful: organizations with those characteristics have historically been strongly correlated with creation of value that increases the wealth of the billionaire class, and therefore billionaires pay for the creation of those systems. It should be no surprise that OOP style is popular in corporations; OOP is the reification in code of corporate thought patterns.”