2 ms·
> does NOT mean you need this complication: > Human <- BillablePerson <- Patient (this is somewhat whacky). Whenever I see something like this I push the impl
by commandlinefan 3y ago
> does NOT mean you need this complication:
> Human <- BillablePerson <- Patient (this is somewhat whacky).
Whenever I see something like this I push the implementor to point me to some code that accepts a "Human" as a parameter and actually does something with it (other than casting it down to Patient). If they can't, I try to encourage them to drop the unneeded hierarchy.
- zwieback 3y agoUnless Human already existed and you want to inherit the functionality without retyping stuff or delegating. I think that's where the old "prefer delegation over inheritance" advice comes in but I'm not against convenience-inheritance.
- commandlinefan 3y agoRight - in which case, Human must already be used (by itself) somewhere else.