top | item 40528568

(no title)

ebolyen | 1 year ago

I like that approach.

discuss

order

Spivak|1 year ago

I've had the mantra "inheritance is only for code reuse" and it's never steered me wrong.

jameshart|1 year ago

Inheritance is only good for code reuse, and it’s a trick you only get to use once for each piece of code, so if you use it you need to be absolutely certain that the taxonomy you’re using it to leverage code across is the right one.

All ‘is-a so it gets this code’ models can be trivially modeled as ‘has-a so it gets this code’ patterns, which don’t have that single-use constraint… so the corollary to this rule tends towards ‘never use inheritance’.

zeroCalories|1 year ago

It seems like OP is describing a shared interface, not necessarily inheritance.