Live data from Hacker News

OOP Is Dead, Long Live OOP

gamedev.net

191–200 of 357 posts

Re: OOP Is Dead, Long Live OOP

#191

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.

it unfortunately undermines the message of the post for me. it just feels like another case of absolutism, fighting fire with fire, by the One True engineer who knows The Solution.

Re: OOP Is Dead, Long Live OOP

#192
post #131

Earlier quoted context omitted.

A poor model for computation that is pervasive in the industry. Poor models usually don't become pervasive.

The engineering organization where I work is full of dysfunction. This is because numerous poor practices were ignored or encouraged over the years. Now there is strong inertia against change because the incompetent long-timers know all the tricks and manage their job security through the system as it is. This is not uncommon especially in the Bay Area.

That would be the Big Ball of Mud pattern, in which the old timers are known as swamp guides.

Re: OOP Is Dead, Long Live OOP

#193

Becoming a professional Haskell and Erlang developer really shifted my view on OOP (let OOP denote class based OOP as found in Java or C++). In my view, OOP is prove a poor model for computation, and the result has been that OO code is almost always significantly more complex and error prone than an equivalent computation written in a concurrent, functional, or structured paradigm. Recent trends in language design (s…

For some reason 'arguments' against OOP seem to follow a common pattern. You have said many things against OOP, but you haven't actually presented an argument for why it's bad. I'll present each of your assertions here individually to clarify.

> OOP is prove a poor model for computation

> OO code is almost always significantly more complex and error prone than an equivalent computation written in a concurrent, functional, or structured paradigm.

These claims may or may not be true, but they aren't very useful at all if you don't provide a justification as well as merely asserting them.

> Recent trends in language design (see Rust, Go, Elixir) also seem to be abandoning OOP in favor of other models

There are a number of ways to account for these trends besides OOP being an intrinsically bad model. The most obvious one is that there are fashions in language design, and right now OOP is not fashionable. We already know that; it's not a strong argument against it. Ironically, many in the OOP opposition use the same argument to justify OOP every getting popular in the first place: "it was just fashionable."

> OOP provides competing ways of abstracting behavior that in Haskell we can model with type parameters and constraints.

> Objects are not truly encapsulated in the way Erlang processes are and a poor fit for SMP.

You have pointed out here that more classical OOP languages do things differently from Haskell and Erlang. This should be expected and is not an argument against those OOP languages. (Yes, you could say, "Erlang is better at concurrency" because of the way in which it's different—but my understanding is it's pretty well accepted that Erlang is sort of freak of nature here, so it's not a good argument against OOP generally.)

> Objects also pathologically hide data in attempt to manage mutability, making it impossible to reason about the memory layout of the program.

They do hide data, but the 'pathologically' is something you've added on your own. There is a design philosophy in which this data hiding plays an important, positive role. When you say, "making it impossible to reason about the memory layout of the program." —this sounds to me like missing the point of that design philosophy: the purpose (and oftentimes tradeoff) of higher-level languages is that you don't need to personally manage these details. I think it's largely an application-dependent thing: you many be writing code that requires that, but not all interesting software hinges on low-level performance tuning.

> OOP is a toolkit for building bad abstractions:

> ... abstractions that do not easily model computation

> ... that hide data

> ... and has tended to create overly complex solutions to problems that are often full of errors that a language focused more on type expressivity could catch at compile time.

Another collection of unjustified assertions, except the 'hide data' part which I accounted for earlier.

So across ~10 negative assertions about OOP you have 3 quasi-justifications: newer languages aren't using OOP as much, hiding data is bad, and Erlang is better for SMP.

Re: OOP Is Dead, Long Live OOP

#194
post #120

Earlier quoted context omitted.

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

Mixins can be modeled as inheritance or as composition.

They can be modeled as inheritance or as composition plus delegation, but that's not saying much since inheritance itself can be modelled as composition plus delegation.

Re: OOP Is Dead, Long Live OOP

#195
post #163

Earlier quoted context omitted.

Someone with 15 years programming OOP told me once: here is the best way to describe object oriented programming: you asked for object “monkey”, and you got the whole jungle, as well as monkey’s bananas.

That would be Joe Armstrong: https://www.johndcook.com/blog/2011/07/19/you-wanted-banana/

You wanted a banana but you got Carmen Miranda.

"That's no banana; that's my nose! Acha cha cha cha!" -Jimmy Durante

https://youtu.be/EL_HFa13CT4?t=1540

Re: OOP Is Dead, Long Live OOP

#196

OOP in game development is in good use with engines like UE4 and Godot, so it is about choice. What really matters is how comfortable you are with the way you develop the game.

Oddly enough I've been getting into UE4 and things would be so much easier for me if the core classes were better decoupled. For instance, I'd like to have a quadraped skeleton with the ability to apply a movement vector. Unfortunately, in the Actor->Pawn->Character hierarchy, you cannot have movement (applying vectors, walk/jump/fall state) without a capsule root component - which is the only one respected for colli…

I certainly agree, I ever used ECS from the beginning. Just surprised when I saw a new engine like godot follows OOP. It might be because engines are better fit but not the game itself and gets omitted easily.

Re: OOP Is Dead, Long Live OOP

#197
post #177

All my attempts to jump off OOP train break at exact same moment when I try to write a unit test. Closure: or, simply use this monstrous component pattern when 70% of your code is boilerplate or hack into namespaces and override functions in them in runtime. And don’t forget to do it in right order! JavaScript: yeah, simply re-define ‘require’ before importing dependencies in tests. Yeah, do it in right order. Recent…

The same ideas still apply. Take a look at this explanation: http://vvgomes.com/javascript-dependency-injection/ -- suggestion for after you read the post: depending on your needs I'd recommend not using the default value as, from a dependency perspective, you end up tightly coupling the two. Hope it helps!

Re: OOP Is Dead, Long Live OOP

#198

Earlier quoted context omitted.

> OOP makes organizing software and code reuse incredibly easy. That is the big promise and the big lie of OOP. It, in fact, accomplishes the opposite. The medium used across systems today is data, not objects. Your objects are not compatible with systems across the wire, they need to be converted to data (JSON, XML, ...). They're not compatible with your data base, they need to be converted to data (SQL, ...). And i…

Except for the fact that objects can be serialized and ORM's exist to convert your data into OOP. How do you think Entity Framework works? How do you think Rails works? You can build almost an entire ORM from a database without even writing any code in Entity Framework. > And if you want to use other people's objects (say from a library) you first have to make a layer that translates them from your own objects Funny,…

> Except for the fact that objects can be serialized and ORM's exist to convert your data into OOP.

Except for the fact that there's usually a mismatch between how your database handles data and how you want to get them back into objects. Cue: Object-relational impedance mismatch.

And while your objects become bigger and bigger and your domain more complicated, you end up relying on ORMs who keep re-creating those objects from the database with every transaction and are loading lots of data no one requested. And then you are wondering why your stuff doesn't scale.

> Interfaces are essentially stripped down abstract classes. How this is not a subset of OOP, I don't know. It's not. Interfaces have been around way before OO entered the field.

Re: OOP Is Dead, Long Live OOP

#199

Does anyone know of a good reference for idiomatic OO(P)? Like the Codd paper for Relational Algebra.

Well, the best analogue to the Codd's relational algebra is Hewitt's actor model in my professional opinion. Both are based on mathematical formalism, though the Actor Model goes a bit further in that it's also informed by physics.

But, just as SQL doesn't really implement Codd's relational algebra, so it is the case that most so-called OOP languages miss the mark vis-à-vis Alan Kay's original conception.

The analogy is buttressed by the fact that many early RDBMSs didn't even support joins (path independence being an essential characteristic of RA), just as many mainstream OOP languages didn't/don't idiomatically endow objects with a strong way to protect themselves (encapsulation being a necessary characteristic, thus pervasive use of setters being the main sin)). But, Kay did praise Erlang for getting OOP right.

Re: OOP Is Dead, Long Live OOP

#200

Becoming a professional Haskell and Erlang developer really shifted my view on OOP (let OOP denote class based OOP as found in Java or C++). In my view, OOP is prove a poor model for computation, and the result has been that OO code is almost always significantly more complex and error prone than an equivalent computation written in a concurrent, functional, or structured paradigm. Recent trends in language design (s…

A poor model for computation that is pervasive in the industry. Poor models usually don't become pervasive.

Then explain web development.
Post reply on HN