Live data from Hacker News

Was object-oriented programming a failure? (2015)

quora.com

61–70 of 126 posts

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

#61
post #45

Adding my two cents : To some point I can follow the argumentation of the author. However, I do not see any superior alternative to the OO paradigm especially combined with Unit testing. Thus, HN, what are the alternatives to OO ?

procedural / functional / declarative / concatenative

I would not call these alternatives, as others have commented these are all tools, no one is superior. In my opinion, C++ is a failure. I wouldn't call Object Oriented a failure. I do think OO could be way better.

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

#62
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…

> 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."

This about sums up my experience with these discussions, too. I know a lot of people who are absolutely convinced that C++ "is better" than C because you can write object-oriented code in it -- you have native support for "classes and stuff".

The whole "is better than" thing is a little childish to begin with, but this argument is on the thin and confusing border between "meaningless" and "but why?"

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

#63
post #34

>Was object-oriented programming a failure? Only ignoring the fact that almost ALL programs we care about, from OSes (Windows, OS X) to Games, and from Office applications (MS Office, Open Office) to graphics apps (Photoshop, etc) to NLEs (Premiere, FCPX, Avid), to IDEs (Eclipse, IDEA, Visual Studio), to major compilers, JITs and runtimes (LLVM, Oracle HotSpot, MS CLR) etc, including all major browsers people browse…

True, kernels create resource abstractions, which are basically objects. But they are written using a variety of approaches, and mostly in C.

Also true, graphical applications have elements that lend themselves to "object" abstractions. But that's not all that goes on under the hood.

I have watched numerous talks from game architects (John Carmack, Jonathan Blow, Casey Muratori, Mike Acton, and many less well-known) and OO just isn't a big concern. "Data-oriented Design" is (to offer a different buzzword).

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

#64

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 s…

Just want to add that Lisp is still famous in symbolic AI and Fortran is great for numerical computing (it’s a dependency of numpy)

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

#65
It's not a failure, and it was an improvement over some paradigms. But it's been oversold and parts of it are terrible. It was sold on the promise of reuse but accomplishes it at the expense of understandability and maintainability. As such it's a huge foot gun: it's very easy to solve complex problems with complex solutions, and that's not a feature it's a bug.

The right level of OO is "very little". Some mostly-FP languages like F# are closer to the ideal level of OO than the mostly-OO languages.

We learned a lot from the Java age, and new languages show it (Swift, Rust, ...)

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

#66
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.

A class that holds data and has no methods other than get/set is basically a struct. Why even bother with the get/set methods?

You assert that code based on this approach is easier to understand, but you don't give a reason why this is so.

This sounds a lot like a pre-OO approach to organizing code and data, and I don't understand the benefits. To use the tried-and-true example: I want my stack state and code to go together. Why would I want to expose the stack state, and keep the code manipulating it separate?

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

#68
post #40

Part of the problem with OO is the other stuff we heaped on it, while still calling it OO. So, we're not always assessing "pure" OO when we talk about it. For instance, immutability and OO are diametrically opposed concepts. Objects were supposed to encapsulate data (state) and expose operations that would mutate that state in a controlled fashion. But, we then imposed this immutability requirement, whereby we create…

Inheritance is arguably one of those things. It certainly goes against Kay's original scheme, which was more like actors. To me OOP winds up looking a lot better without the inheritance

Yeah, there are probably degrees of purity. With inheritance, I can at least see how it tries to respect the OO paradigm, by giving you ways to extend without breaking some of the core concepts like encapsulation.

While, on the other end, immutability fundamentally undermines the very premise of OO, which is to model the domain as state and behavior vs treating objects as data wrappers to be manipulated externally.

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

#69
post #45

Adding my two cents : To some point I can follow the argumentation of the author. However, I do not see any superior alternative to the OO paradigm especially combined with Unit testing. Thus, HN, what are the alternatives to OO ?

procedural / functional / declarative / concatenative I would not call these alternatives, as others have commented these are all tools, no one is superior. In my opinion, C++ is a failure. I wouldn't call Object Oriented a failure. I do think OO could be way better.

I've been studying about C++ lately. It has proven to be a lot harder to learn than PHP, JavaScript, Java, C# and Haskell. It's one of the most powerful and widely used languages around however, so calling it a failure seems rather unfair.

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

#70

Part of the problem with OO is the other stuff we heaped on it, while still calling it OO. So, we're not always assessing "pure" OO when we talk about it. For instance, immutability and OO are diametrically opposed concepts. Objects were supposed to encapsulate data (state) and expose operations that would mutate that state in a controlled fashion. But, we then imposed this immutability requirement, whereby we create…

> immutability and OO are diametrically opposed concepts.

Why do you say that? It is completely reasonable to define objects whose state is fixed at creation, hide a representation, and have methods that implement some abstraction. E.g., strings, complex numbers, points in a space, and possibly even more complex things like sets. All the advantages of OO apply, even for objects whose interface does not provide a way to mutate the object.

Post reply on HN