Hacker News new | ask | show | jobs
by Retric 3738 days ago
Sure, but routing get's complex in your solution. The point was OOP is a natural fit for collections of different types in some context ex:GUI, Simulation, etc. The classic OOP case is probably a MUD where OO code ends up being very straightforward.

IMO, the problem is it works really well in so many contexts that people end up trying to use it everywhere.

2 comments

OO in MUDs seemed so natural to me, I think, because they're closer to the actor model that OO was really designed for. Instead of "methods", many objects in MUDs (depending on the system, I used to know more when I was research writing a MUD engine in erlang), respond to messages in more of a smalltalk-style.
Routing? I'm just saying that OOP is as much of a perfect fit to GUI that Entity Component Systems (composition) are.
ECS works well when you can predefine everything ahead of time. But, it must be extended for every additional type.

As to messaging, consider what happens when you add JavaScript that can change the DOM. Now, you need to pass messages in both directions not just What is your Height- Width, but also my Height-Width has changed. Animated Gifs or Videos now want to update things in real time, and other windows can cover parts of your view port.

And let's not forget about transparency.

PS: ECS can still work, but it starts getting really complex.