Live data from Hacker News

The Case Against OOP Is Wildly Overstated

medium.com

121–130 of 312 posts

Re: The Case Against OOP Is Wildly Overstated

#121

People love to hate on inheritance and suggest that there are no cases where its use is warranted. But inheritance absolutely is used, and successfully, in many frameworks. For example GUI frameworks [1] [2] or server-side web frameworks [3]. People have been writing code in frameworks like this for ages and as far as I can see they worked well. Including key use cases such as being able to use the provided component…

Not very compelling. Your point that people have been able to leverage something to build something applies to everything. Doesn't mean it's good nor that there isn't a whole rest-of-the-continuum of things that are better. Look at all the things humans built before 21st-century tooling. So what?

GUI frameworks like NS/UIKit and CoreData aren't good. They're quite bad, actually. That's why we are moving on.

It's just that the pendulum has swing so far away from OOP in our zeitgeist for enough time that the new audience is feeding a new wave of "X is actually good!" We can see the same with PHP-related HN submissions right now.

Re: The Case Against OOP Is Wildly Overstated

#122
Usually when I see people rant against OOP, they're not ranting in favor of FP (or even better, in favor of something like Scala that combines OOP and FP) but rather in favor of a return to procedural/top-down programming. There are very good reasons that procedural programming was abandoned a long time ago and the need for global variables to make it work is one of the big ones.

Re: The Case Against OOP Is Wildly Overstated

#123
I respectfully disagree that frameworks and stdlibs for languages like Java and .Net are better due to use of Inheritance. In fact I struggle to come up with a single occasion where use of Inheritance was not an Antipattern. The exception I suppose is when you have no other way to do polymorphic interfaces.

Re: The Case Against OOP Is Wildly Overstated

#125

Earlier quoted context omitted.

More concretely, for every bit of state in the program I'm interested in two big questions, each with two subquestions: 1.) Who can access this state, and which of those accesses allow writes vs. which are read-only? 2.) What is the lifetime of that state, and what portion of that lifetime is mutable vs. read-only? Java-style OOP can control #1, but makes no distinction between reads & writes. C++ const correctness a…

That would be really cool, but I think enforcing that is undecidable. My gut tells me that having that language feature at compile time is the same as the Halting Problem.

I suspect that the ideal language (at least for human use) is one that is just shy of Turing completeness. Once a program compiles and an initial configuration phase has passed all loops would be bounded and all recursions would be guaranteed to terminate. Except for the case of programs that aren't supposed to terminate for which there would be a single construct allowing wrapping everything inside one and only one infinite loop.

Re: The Case Against OOP Is Wildly Overstated

#126

Usually when I see people rant against OOP, they're not ranting in favor of FP (or even better, in favor of something like Scala that combines OOP and FP) but rather in favor of a return to procedural/top-down programming. There are very good reasons that procedural programming was abandoned a long time ago and the need for global variables to make it work is one of the big ones.

In my opinion, the case against inheritance is strong, but it’s in favor of composition, which is still often object oriented.

Re: The Case Against OOP Is Wildly Overstated

#127

Earlier quoted context omitted.

OOPs original premise is homoiconicity? Really?

I'm not sure anyone really knows what OOP's original premise is. There are various legends, and they mostly conflict with each other.

It was whatever Simula and then Smalltalk's goals were.

Re: The Case Against OOP Is Wildly Overstated

#128
post #123

I respectfully disagree that frameworks and stdlibs for languages like Java and .Net are better due to use of Inheritance. In fact I struggle to come up with a single occasion where use of Inheritance was not an Antipattern. The exception I suppose is when you have no other way to do polymorphic interfaces.

I'm no expert, but the mental model of an interface is so simple. The inheritance model I liked in school, but practically the payoff just never seems to show up.

Re: The Case Against OOP Is Wildly Overstated

#129
post #123

I respectfully disagree that frameworks and stdlibs for languages like Java and .Net are better due to use of Inheritance. In fact I struggle to come up with a single occasion where use of Inheritance was not an Antipattern. The exception I suppose is when you have no other way to do polymorphic interfaces.

Lots of things in software development have an is-a relationship. The only time inheritance is an antipattern is when it's used for code-reuse and it isn't modeling an is-a relationship.

Once you get to application code there aren't a lot of is-a relationships but inside operating systems, libraries, and frameworks it does come up legitimately.

Re: The Case Against OOP Is Wildly Overstated

#130
post #4

This doesn't speak to what I consider some of the most dangerous parts of OOP, which include the assumptions that tightly binding data and code is helpful, and that statefulness is fine to freely sprinkle throughout your program.

"Tightly binding data and code" allows you to maintain complex invariants via code, and to abstract away from the specifics of any single implementation. Statefulness per se is quite manageable; what's not manageable is shared, mutable state that isn't isolated to a single, modular, highly cohesive "unit" of code that can be understood in its totality. The real issues with OOP have to do precisely with things that br…

> "Tightly binding data and code" allows you to maintain complex invariants via code

Not sure I understand what this means. Could you give an example?

Post reply on HN