Live data from Hacker News

Was object-oriented programming a failure? (2015)

quora.com

21–30 of 126 posts

Re: Was object-oriented programming a failure? (2015)

#21
post #13

Pure OOP programming (as Alan Kay intented) never took off in the large scale. The good thing about these OO-inspired class based languages (C++, Java, etc) is that it has forced people to write their spaghetti code inside modules (classes) with documented interface. They also made using algebraic data types common.

A must read, from Alan Kay himself: http://lists.squeakfoundation.org/pipermail/squeak-dev/1998-...

"The key in making great and growable systems is much more to design how its modules communicate rather than what their internal properties and behaviors should be."

Re: Was object-oriented programming a failure? (2015)

#22
post #3

His points aren't OO. He claims overengineering. That can happen in any setting.

True, but it's more likely to happen in an OOP setting. Especially if functions are not first class objects. Then you start wrapping things in classes and turning them into methods when you otherwise wouldn't, and that's how you eventually go down the road of FactoryFactoryFactoryFactories if you're not careful.

Re: Was object-oriented programming a failure? (2015)

#23
post #7

As somebody who works on many different OOP-projects, could somebody tell me how I should structure my software if not using OOP?

This is the basic stategy that I try to follow as much as possible: Classes that hold data have no methods (beyond getters/setters). Classes that implement behavior have no mutable state; they exist as namespaces for the functionality that they provide. I've been quite successful with this approach. It leads to code that is easier to understand than a big ball of stateful objects.

Funny, I tend to go the opposite way (immutable value types, stateful-as-needed behavior classes). I wonder how you argue that you have less stateful objects considering data objects are usually instantiated more than logic objects?

Re: Was object-oriented programming a failure? (2015)

#24
There's people here claiming that the problem is OOP done wrong. Let's talk about stuff that pretty much every OO language shares:

* syntax that favours inheritance over composition * inability to specify polymorphism over two input types * inability to specify polymorphism over return type (Both of these are symptoms of close identification of type and table) * Syntax that makes generics unwieldy to the point that many think they're just for collections * Inability to make third-party types expose your own interfaces (Clojure manages this. Some languages manage this through monkey-patching, but that's a cure worse than the disease.)

OO is broken. The biggest problem is that we're all so invested in it we have trouble seeing there's another way.

Re: Was object-oriented programming a failure? (2015)

#25
Having been a programmer before OO was invented (or at least available to all) I would have to say no. Was LISP a failure since generations of descendent languages have replaced it? Was Fortran a failure because I don't write iOS apps in it today? Of course not, all of these things are tools you can choose to use or not. Whether something is a failure is up to the programmer and how you wield them. If there was one single language/framework/concept/idea/tool that was perfect we'd all use it - there isn't so we pick something and make use of it.

Re: Was object-oriented programming a failure? (2015)

#26
post #2

Why are there still those who think any advocate of OOP is an advocate of "OOP or Nothing! All things are Objects! All things are an instantiation of a class! All things must derive from a root class! etc."? OOP is a tool. And generally a useful one. Every new programming paradigm at its inception was going to Save The World and make programming A Better Place. Turns out, every one if these paradigms is a tool with u…

> Why are there still those who think any advocate of OOP is an advocate of "OOP or Nothing! All things are Objects! All things are an instantiation of a class! All things must derive from a root class! etc."? Because there are many low skill, poorly-informed people who write code still believe these things. In particular that "OOP" is automatically equivalent to "better quality code." It’s a sort of cargo cultism th…

Indeed, but what is more disappointing are the high-skilled, well-informed people who believe these things. In particular that "functional" is automatically equivalent to "better quality code".

It's dogma either way. There is no single true religion just advantages and disadvantages

Re: Was object-oriented programming a failure? (2015)

#27
post #11

The idea is good, but the wide spread implementations are rather bad. Funny that with JavaScript a rather undervalued OOP model (prototype based) got such a spread :)

Sturgeon's Law: "Sure 90% of OO is crap. That's because 90% of everything is crap" https://en.wikipedia.org/wiki/Sturgeon%27s_law

There are laws for everything :D

Re: Was object-oriented programming a failure? (2015)

#28
post #10

It seems like he is ranting about the properties that allows us to keep controll over larger codebase. Data hiding (and immutability) are good thing even as they sometimes force you duplicate data. So is separation between public and private, no matter what exact syntax is used to achieve it. Interfaces when done right allows you to reduce cognitive overload. I could go on, but really oop was huge improvement over wh…

[deleted]

Re: Was object-oriented programming a failure? (2015)

#29
post #3

His points aren't OO. He claims overengineering. That can happen in any setting.

True, but it's more likely to happen in an OOP setting. Especially if functions are not first class objects. Then you start wrapping things in classes and turning them into methods when you otherwise wouldn't, and that's how you eventually go down the road of FactoryFactoryFactoryFactories if you're not careful.

It's just likely to happen in a functional setting. E.g. That quadruple indirect function applied via some obscure algebraic pattern can be just as bad as an FactoryFactoryFactoryFactories.

We just don't see it because FP is not as common, but spend any amount of time with some Haskell programmers and you'll see the hazard is just as real.

Re: Was object-oriented programming a failure? (2015)

#30
post #16

Earlier quoted context omitted.

Exactly. "Everything is an object" was an extremism (today's extremism is the crusade against 'mutable state'), but otherwise OoO has been useful. For example it has seen great success in GUIs.

I can definitely state that OOP allows to implement GUI. But "great success" I can see only for vendors selling OOP tools for GUI development. Consider web frameworks. Given a choice I select React and similar functional frameworks than OOP based ones. They are just more productive and scale better. Or consider QT. My colleagues with a lot of QT experience use QML to create GUI. They avoid any C++ GUI code unless it…

React itself does much less then what component oriented oop frameworks used to do. Achieving same functionality with react is more work. They were not on the Web tho, so the comparison is a bit weird.
Post reply on HN