Live data from Hacker News

OOP Is Dead, Long Live OOP

gamedev.net

81–90 of 357 posts

Re: OOP Is Dead, Long Live OOP

#81
post #40
post #20

I’d be very wary of hiring an ”OO” dev who can’t reasonably formulate what the SOLID principles are and why they exist.

Even Solid, like OOP is one of those concepts that has morphed more into an ideology than it needs to be with blind faith adherents https://speakerdeck.com/tastapod/why-every-element-of-solid-... I'll take someone who writes simple code that can be easily changed 101 out of 100 times over a SOLID, OOP Adherent.

That presentation basically says "write simple code". I'm not sure how is that helpful to anyone.

Re: OOP Is Dead, Long Live OOP

#82
post #9

If we just had made inheritance as something to be avoided unless absolutely needed then OOP would have probably never got such a bad reputation. All the other concepts make perfect sense.

I've found that inheritance is very useful in one situation, and adds nothing over mixins otherwise. If a class does two broad things simultaneously then inheritance can work great. For example, a User class that inherits from a DB mapper class. I don't want to have to tell my class how to write a record to the DB. All that code can be centralized into one thing and then relied upon for its uniformity across all my m…

Mixin inheritance is also inheritance, just linearized multiple inheritance actually.

Re: OOP Is Dead, Long Live OOP

#83
post #31

The problem is not OOP, but how C++ and Java implement it. Ruby is a much nicer OOP platform.

Please don't include C++ in that statement. C++ doesn't "implement" OOP in any particular way. It gives you a pile of tools which can be mix/matched with other tools in the language to create any number of paradigms.

The "pure OOP" style that is so roundly criticized is just one of C++'s possible styles. The whole article is effectively about how there are other ways to use C++. I actually tend to think that much of the style he is describing (composition based) is really just what the pure OOP people used to criticize as "C with objects".

Re: OOP Is Dead, Long Live OOP

#84
post #65
post #45

Earlier quoted context omitted.

Depends on what this dev would be building, if you have to build framework or you build a library then I agree. If you build next off the mill "business" system then... Single responsibility principle, yes nice but we have deadlines and no time to argue if that one function should be somewhere else, fix it when we have some slack. Open closed principle, you don't have to think about if you use DI and have interfaces.…

> Liskov substitution is useless, you should not use inheritance but composition. Liskov substitution is more about interface inheritance than implementation inheritance, really. LSP basically says that the implementer of an interface must obey the contract the interface specifies. As a real-world example, throwing UnsupportedOperationException in a method implementation is an LSP violation. Of course, this makes it…

Ok yes, it is about subtypes and interface is quite of an abstract base class. But if you have interface as in Java or C# and maybe 2 or 3 implementations without complicated type hierarchy under it, it is not an issue in practice to be not strict about contract, because you can spot deviation from it and fix it quick (ideally you also have integration tests to spot it for you).

Re: OOP Is Dead, Long Live OOP

#85

Earlier quoted context omitted.

> The great architect has the foresight on how the code will be used in five years and design it accordingly Perhaps this is a function of me working in startups and consulting my whole career, but it seems extremely misguided, if not negligent for an experienced engineer trying to design for use cases five years in the future. Five months into the future is even pushing it. What kind of companies operate in this way…

Consultant here, and I think that's a big blind spot we tend to have: we don't stick around for long enough to see the consequences of what we designed, usually.

I have more experience at startups than as a consultant. I was the 6th hire at a company that grew to 130 over three years and I was never thinking more than a few months in advance. A lot changes in five years — your customers, the competitive landscape. It's an enormously long period of time in technology. It seems like such a waste of time when you have customers that have real, unsolved problems today

Re: OOP Is Dead, Long Live OOP

#87

OOP is just a mental model. Deep down everything is made of bits. The church of OOP has failed but if something looks like a duck, walks like a duck and talks like a duck it probably is useful to make a duck class. We're now down to fighting for nuances. You can do most things with OOP or without OOP but each path has some upsides and downsides and most of the time it's good to use some things it provides where it ma…

> The great architect has the foresight on how the code will be used in five years and design it accordingly Perhaps this is a function of me working in startups and consulting my whole career, but it seems extremely misguided, if not negligent for an experienced engineer trying to design for use cases five years in the future. Five months into the future is even pushing it. What kind of companies operate in this way…

Companies that are here to stay and plan to stay for longer, not the hipster wannabe unicorn type

Re: OOP Is Dead, Long Live OOP

#88
post #63

I think OOP is fine as long as it's the only thing you are doing and as long as it is single-threaded. Problems will occur if you need to convert the innards of your objects to data (i.e. JSON etc.), if you need to materialize objects from data (i.e. ORM) or if you need to write multi-threading safe code. If you expose things as data, just be honest about it and treat it as such. It's already out in the open, why hid…

> If you expose things as data, just be honest about it and treat it as such. It's already out in the open, why hide it in objects again?

What if this exposure occurs at the boundaries of your system, or when interacting with certain libraries? Surely there's value as "mostly" handling some things as objects within your system, even if you expose their innards and maybe break their invariants at the boundaries.

Re: OOP Is Dead, Long Live OOP

#89
post #63

I think OOP is fine as long as it's the only thing you are doing and as long as it is single-threaded. Problems will occur if you need to convert the innards of your objects to data (i.e. JSON etc.), if you need to materialize objects from data (i.e. ORM) or if you need to write multi-threading safe code. If you expose things as data, just be honest about it and treat it as such. It's already out in the open, why hid…

> I think OOP is fine as long as you are doing it and as long as it is single-threaded.

I don't really see how threading has anything to do with it.

What OOP allows you to do is choose what terms you want to express your solution in. You can choose language that exposes thread-safe aspects of your problem domain without requiring the user to be aware that they are expressing things in thread-safe terms. In my last project one of the early elements of our architecture was a thread-safe message queue for each thread to receive messages from across the thread boundary. Discussions on our team involved talk of messaging and threading because those were the abstractions we chose to use to express our solution.

We knew that order of access was important and so we chose to make it explicit in the language we used to express the problem. And the abstraction we chose allowed us to hide the details of the problem in such a way that we did not have to worry about memory protection as long as we were consistently using the architecture we built. That was a concern of the messaging system's maintainer. We could just as easily have chosen rows and columns and operators on such and expressed the same solution in those terms. What mattered to us was making sense of the problem, domain and solution.

It really doesn't matter which paradigm you use. What matters more is that you express your solution in terms that are consistent with the problem domain, and that you actually make an effort to understand the problem you're trying to solve well enough to express the solution. Anything beyond that is just sugar.

Re: OOP Is Dead, Long Live OOP

#90

I don't understand why this article is so angry? ECS is a great subset of OOP. Both are helpful tools where they make sense.

For at least the last ten years, maybe fifteen, on the GameDev.net forums you haven't been able to swing a dead cat without hitting somebody going on and on about entity/component systems or pushing them as the One True Path, or trying to create their own implementation. It's probably worse now that Unity is so big. I'm not sure it is something I would pitch at beginning programmers, and there are a lot of them that wander into that, decide they are going to follow that advice, make a big mess, then wind up asking Hodgman and the handful other saintly regulars that keep that place going, to help them out.
Post reply on HN