3 ms·
I'd argue that this is an artifact of history at this point. This was the popular style when unreal was made, and that's why it's there. Since Unreal is an old
by whstl 2y ago
I'd argue that this is an artifact of history at this point. This was the popular style when unreal was made, and that's why it's there. Since Unreal is an old piece of software that powers older games, this code won't get removed. Because of compatibility.
The industry (and this includes Unreal, albeit slowly) has been moving to runtime composition for a reason: it is simpler and more flexible. And much better at modeling reality.
Your last paragraph pretty much sums it up: the main reason at this point for teaching implementation inheritance is because of legacy code bases. It can be a valid technique (I personally enjoy the Template Method Pattern, although it is today a maligned pattern) but it does causes more problems than it solves.
- mike_hearn 2y agoHeh, there's nothing legacy about Unreal. It's the premier game engine in the world today and actively maintained by hundreds of developers. They're now pushing into film and do new releases regularly, often breaking backwards compatibility when they do. Where is this move away from OOP and inheritance? Even newly developed features like Nanite use it: https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Landscape/ULandscapeNaniteComponent https://dev.epicgames.com/documentation/en-us/unreal-engine/... But more importantly, is this take falsifiable? What does "old" or "legacy" mean? People have been pushing this line for at least 15 years here on HN, yet what we see in the most well funded and actively maintained codebases is lots and lots of inheritance, with no efforts to remove it. Not just Unreal but also Chrome, MS Office, iOS, Android, Java, and more, all use this technique with no ill effects as far as anyone can tell. When the maintainers talk about what issues they face and are putting refactoring efforts into, inheritance or OOP never seem to be on the list. In the Java case it's actually the opposite, they like to complain about people violating OOP encapsulation and want to make enforcement stricter. Meanwhile heavily hyped successors that lacked it, like Haskell, have vanished without a trace, leaving not even one widely used program in their wake. What would it take to falsify the claim that inheritance is a legacy technique? Because I see no real evidence of it. Every codebase I've worked on has used it without anyone remarking on that fact, and it didn't seem to cause issues more often than other design patterns.
- whstl 2y agoA programming style isn't automatically "good" just because it's financially and technically unfeasible to migrate to something else overnight. The reason Unreal uses inheritance is because this is what people did in 1998. The reason it can't stop using is because it's too late to change. There's nothing more to it.
- the-smug-one 2y ago> Meanwhile heavily hyped successors that lacked it, like Haskell, have vanished without a trace, leaving not even one widely used program in their wake. Do you think that inheritance had something to do with that?
- kryptiskt 2y ago> Meanwhile heavily hyped successors that lacked it, like Haskell, have vanished without a trace, leaving not even one widely used program in their wake. Haskell still is a thing, and Pandoc and shellcheck are widely used, if you aren't, you're missing out. And Haskell impressed Tim Sweeney enough that a whole bunch of Haskell people are working on Epic's Verse language.
- mike_hearn 2y agoWell, Verse has both OOP and inheritance: https://dev.epicgames.com/documentation/en-us/uefn/subclass-in-verse https://dev.epicgames.com/documentation/en-us/uefn/subclass-... Epic is a very successful software company, they're familiar with FP/Haskell, and their new language has classes with inheritance. There is no evidence here of any shift away from the concept, let alone Unreal being legacy! Apple is the same. Swift deviates from other languages in many ways, but it has inheritance: https://docs.swift.org/swift-book/documentation/the-swift-programming-language/inheritance/ https://docs.swift.org/swift-book/documentation/the-swift-pr... Jetbrains also designed a new language in the past decade, and it has inheritance. Nobody objected (pun intended) and people use it successfully. So I think that kind of reinforces my point that the dislike of OOP and inheritance is largely restricted to the HN bubble.
- loup-vaillant 2y ago