Re:The world's smallest and fastest classical JavaScript inh...
by bruceboughton on Saturday February 15, 2014 @07:12PM
(#7246086)
No, there's just not that many true instances of the is_a relationship outside of shapes. Reuse is often better achieved via composition rather than complex up-and-then-down-again virtual call chains.
[ Parent
| on HN ]
Re:The world's smallest and fastest classical JavaScript inh...
by coldtea on Sunday February 16, 2014 @01:49AM
(#7246886)
>No, there's just not that many true instances of the is_a relationship outside of shapes.
I was talking about if the majority shuns inheritance or not [it does not]. Not whether it's the correct way to go.
That said, there's lots of instances of is_a relationship. Anywhere where you have different types of something.
A work hierarchy for example. While composition might work for the methods we want to have, conceptually a manager is not someone who HAS an employee (composition), he IS-AN empoyee.
GUI widgets. Game sprites. Vehicles. Animals. Simulation objects.
Consider how the "semantic web" is all about taxonomies -- put everything into taxonomies.