Remix.run Logo
phkahler 5 hours ago

>> Anecdotally, I've replaced OOP with plain data structures and functions.

Agreed. I think objects/classes (C++) should be for software subsystems and not so much for user data. Programs manipulate data, not the other way around - polymorphism and overloading can be bad for performance.

cogman10 5 hours ago | parent [-]

Objects/classes work best for datastructures (IMO).

Outside that usecase, I think polymorphism via inheritance is generally a mistake.

Programs manipulate data and datastructures organize that data in a way that's algorithmically efficient.

The main issue with OOP is that without a very clear abstraction, it can be almost impossible to reason about code as you end up needing to know too much about the hierarchy of code to correctly understand what will happen next. As it turns out, most programmers are pretty bad at managing that abstraction boundary.

FartinMowler 4 hours ago | parent [-]

OOP is like alcohol: enjoyable in moderation but dangerous in excess.

In moderation, an object is a data structure with associated functions (methods) that acts as a kind of namespace. If your data structure and functions are separate, you might start having function name collisions.

Hopefully we won't see a prohibition against OOP.