r/ProgrammerHumor • • Jun 12 '25 • This 3

Meme andJavascriptForWeb

Post image
7.9k Upvotes

270 comments sorted by

View all comments

Show parent comments

2

u/stipulus Jun 12 '25

Honestly I think what you are doing here is a better embodiment of oop than the infinite inheritance, and dont even get me going with multiple inheritance. The core concept of oop is creating a cookie cutter that makes as many cookies as you need. Massive inheritance chains just to create a singleton is not even oop in my professional opinion. I'll look more into the ECS pattern although I also agree there is no one size fits all pattern. Sometimes you even create your own for a specific situation (shh don't tell pattern police). OOP is something that should always be in one's toolbox though.

2

u/Attileusz Jun 12 '25

I didn't really go into why ECS works well with this comment. The ECS way to organise code is basically:

My program has a database (or databases), everything is a database entry. A function will query the database and either mutate it, or make a monadic operation (write to file/screen).

Very good for games and simulations, or basically everything with a lot of similar data. Easy to manage memory because every datatype (component) basically has it's own array/vector, and related components are resolved by belonging to the same entity.

There are some good articles from the creators of the flecs ecs library.

1

u/stipulus Jun 12 '25

Aw I see! Yeah that makes a lot of sense for games and simulations. Im not in game dev but a game developed without oop sounds insane haha. I work in web application development. There are a lot of crossovers, although maybe a few more steps to get to display and a lot more data siloing (you can only see your user data).