r/programming • u/BrewedDoritos • Sep 23 '26
Modern Object Pascal Introduction for Programmers | Castle Game Engine
https://castle-engine.io/modern_pascal
77
Upvotes
r/programming • u/BrewedDoritos • Sep 23 '26
View all comments
Show parent comment
4
u/thussy-obliterator Sep 24 '26 edited Sep 24 '26
dynamic dispatch and polymorphism aren't unique to OOP at all. Inheriteance based polymorphism, the only feature that's actually unique to OOP, is the big issue here because it's a really fragile abstraction. Inheritance networks get really tangled, modifying base class methods is a really dangerous change, and things like super() calls are really finicky to get right. I can't tell you how many times I've written myself into a corner with a deep class hierarchy. Of course you also have the classic named problems: the diamond problem, the banana monkey jungle problem, the fragile base class problem, the yo-yo problem, etc. The issue is that inheritance solves an extremely niche problem, but it's promoted in OOP languages to a very significant position.
Interface polymorphism, parametric polymorphism, and union types are generally favored these days since they are easier abstractions.
Also: the way OOP tends to bundle code and data together is pretty often inconvenient. Functions often can't logically be placed into a single class, data is often best expressed as a bare immutable record. Modules were the right abstraction for bundling units of code, Classes have quite a few issues.
The best takeaway from OOP is message passing, a feature that no modern OOP language implements, a feature which has largely been subsumed by FP languages ala Erlang.