Comment

Comment by v1sea

The article has a nice history review of inheritance, but it would have been useful for there to be some concrete examples.

The worst example of inheritance I've ever found is in java Minecraft's mobs[0]. It is very deep in some places and has numerous examples of sub classes not fully implementing their parent interfaces.

Example 1: Donkey[1]

Donkey > Chested_Horse > Abstract Horse > Animal > Ageable Mob > Pathfinder Mob > Mob > Living Entity > Entity

Example 2: Blaze[2]

Blaze has a bit for 'Is on fire', but how is this any different from Mob 'Is aggressive'? Blaze > Monster > Pathfinder Mob > Mob > Living Entity > Entity

[0] https://wiki.vg/Entity_metadata#Entity

[1] https://wiki.vg/Entity_metadata#Donkey

[2] https://wiki.vg/Entity_metadata#Blaze

parent v1sea 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton